Skip to content

Commit

Permalink
improve ci (#192)
Browse files Browse the repository at this point in the history
* ci: push image on PR

* ci: push image on PR

* ci: push image on PR

* ci: push image on PR

* ci: push image on PR

* ci: push image on PR

* ci: push image on PR
  • Loading branch information
Fraccaman authored Dec 10, 2024
1 parent b763c29 commit 6e5628c
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/queue_and_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Check Stuff 👨‍🔧
on:
merge_group:
pull_request:
branches:
- main
push:
branches:
- main
Expand Down Expand Up @@ -100,27 +102,10 @@ jobs:
cache: true
- run: just fmt

build:
if: ${{ github.event_name == 'pull_request' }}
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- uses: rui314/setup-mold@v1
- uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: true
- run: just build

docker:
name: Docker
runs-on: ubuntu-latest
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' }}
if: ${{ github.event_name == 'merge_group' || github.event_name == 'pull_request' }}
env:
GIT_LFS_SKIP_SMUDGE: 1
REGISTRY_URL: ghcr.io
Expand All @@ -145,6 +130,18 @@ jobs:
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_URL }}/anoma/namada-indexer
flavor: |
latest=auto
prefix=${{ matrix.docker.image }}
suffix=
tags: |
type=ref,event=branch,prefix=${{ matrix.docker.image }}-branch-
type=ref,event=pr,prefix=${{ matrix.docker.image }}-pr-
- name: Login to GHCR
uses: docker/login-action@v3
with:
Expand All @@ -157,15 +154,15 @@ jobs:
with:
context: .
file: Dockerfile
build-args: PACKAGE=${{matrix.docker.package}}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ env.REGISTRY_URL }}/anoma/namada-indexer:${{ matrix.docker.image }}-main
build-args: PACKAGE=${{ matrix.docker.package }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

can_enqueue:
needs: [clippy, format, build, validate-swagger]
needs: [clippy, format, docker, validate-swagger]
if: always() && github.event_name != 'merge_group'
permissions:
actions: read
Expand Down

0 comments on commit 6e5628c

Please sign in to comment.