Skip to content

Commit ca42c7f

Browse files
committed
improve ci
1 parent f06ad09 commit ca42c7f

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

.github/workflows/queue_and_merge.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -99,32 +99,15 @@ jobs:
9999
repo-token: ${{ secrets.GITHUB_TOKEN }}
100100
- uses: actions-rust-lang/setup-rust-toolchain@v1
101101
with:
102-
toolchain: nightly
102+
toolchain: nightly-2024-06-14
103103
components: rustfmt
104104
cache: true
105-
- run: just fmt
106-
107-
build:
108-
if: ${{ github.event_name == 'pull_request' }}
109-
name: Build
110-
runs-on: ubuntu-latest
111-
steps:
112-
- uses: actions/checkout@v4
113-
- uses: taiki-e/install-action@just
114-
- uses: rui314/setup-mold@v1
115-
- uses: heliaxdev/setup-protoc@v2
116-
with:
117-
version: "25.0"
118-
repo-token: ${{ secrets.GITHUB_TOKEN }}
119-
- uses: actions-rust-lang/setup-rust-toolchain@v1
120-
with:
121-
cache: true
122-
- run: just build
105+
- run: just fmt-check
123106

124107
docker:
125108
name: Docker
126109
runs-on: ubuntu-latest
127-
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/1.0.0-maint' }}
110+
if: ${{ github.event_name == 'merge_group' || github.event_name == 'pull_request' }}
128111
env:
129112
GIT_LFS_SKIP_SMUDGE: 1
130113
REGISTRY_URL: ghcr.io
@@ -149,6 +132,18 @@ jobs:
149132
uses: actions/checkout@v4
150133
- name: Set up Docker Buildx
151134
uses: docker/setup-buildx-action@v3
135+
- name: Docker meta
136+
id: meta
137+
uses: docker/metadata-action@v5
138+
with:
139+
images: ${{ env.REGISTRY_URL }}/anoma/namada-indexer
140+
flavor: |
141+
latest=auto
142+
prefix=${{ matrix.docker.image }}
143+
suffix=
144+
tags: |
145+
type=ref,event=branch,prefix=${{ matrix.docker.image }}-branch-
146+
type=ref,event=pr,prefix=${{ matrix.docker.image }}-pr-
152147
- name: Login to GHCR
153148
uses: docker/login-action@v3
154149
with:
@@ -161,15 +156,15 @@ jobs:
161156
with:
162157
context: .
163158
file: Dockerfile
164-
build-args: PACKAGE=${{matrix.docker.package}}
165-
push: ${{ github.ref == 'refs/heads/main' }}
166-
tags: ${{ env.REGISTRY_URL }}/anoma/namada-indexer:${{ matrix.docker.image }}-main
159+
build-args: PACKAGE=${{ matrix.docker.package }}
160+
push: ${{ github.event.pull_request.head.repo.full_name == 'anoma/namada-indexer' }}
161+
tags: ${{ steps.meta.outputs.tags }}
167162
labels: ${{ steps.meta.outputs.labels }}
168163
cache-from: type=gha
169164
cache-to: type=gha,mode=max
170165

171166
can_enqueue:
172-
needs: [clippy, format, build, validate-swagger]
167+
needs: [clippy, format, docker, validate-swagger]
173168
if: always() && github.event_name != 'merge_group'
174169
permissions:
175170
actions: read
@@ -199,5 +194,4 @@ jobs:
199194
run: |
200195
echo "ALL_SUCCESS=$(echo "$NEEDS_JSON" | jq '. | to_entries | map([.value.result == "success", .value.result == "skipped"] | any) | all')" >> $GITHUB_ENV
201196
- name: check outcomes
202-
run: "[ $ALL_SUCCESS == true ]"
203-
197+
run: "[ $ALL_SUCCESS == true ]"

0 commit comments

Comments
 (0)