Skip to content

Commit 04efc26

Browse files
authored
Add github badges and update workflows (#344)
1 parent 6bfec5a commit 04efc26

9 files changed

Lines changed: 145 additions & 75 deletions

File tree

.github/actions/setup-jvm-toolchain/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
based build.sh which does not use Gradle.
2626
required: false
2727
default: ""
28+
cache-disabled:
29+
description: "Disable Gradle cache restore and save"
30+
required: false
31+
default: "false"
2832

2933
runs:
3034
using: composite
@@ -58,9 +62,10 @@ runs:
5862
5963
- name: Setup Gradle ${{ inputs.gradle-version }}
6064
if: ${{ inputs.gradle-version != '' }}
61-
uses: gradle/actions/setup-gradle@v6
65+
uses: gradle/actions/setup-gradle@v6.3.0
6266
with:
6367
gradle-version: ${{ inputs.gradle-version }}
68+
cache-disabled: ${{ inputs.cache-disabled }}
6469

6570
- name: Put configured JDK first on PATH
6671
shell: bash

.github/workflows/benchmark.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
gradle-version: ${{ needs.get-configs.outputs.gradle-version }}
4848

4949
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
50-
uses: dtolnay/rust-toolchain@stable
50+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
5151
with:
5252
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
5353
targets: wasm32-unknown-unknown
5454

5555
- name: Cache Cargo
56-
uses: Swatinem/rust-cache@v2
56+
uses: Swatinem/rust-cache@v2.9.2
5757
with:
5858
workspaces: ${{ env.WORKING_DIR }}
5959

@@ -63,7 +63,7 @@ jobs:
6363
node-version: ${{ needs.get-configs.outputs.node-version }}
6464

6565
- name: Install wasm-pack ${{ needs.get-configs.outputs.wasm-pack-version }}
66-
uses: taiki-e/install-action@v2
66+
uses: taiki-e/install-action@v2.86.7
6767
with:
6868
tool: wasm-pack@${{ needs.get-configs.outputs.wasm-pack-version }}
6969

.github/workflows/build-artifacts.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,18 @@ jobs:
8484
ref: ${{ needs.resolve-ref.outputs.sha }}
8585

8686
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
87-
uses: dtolnay/rust-toolchain@stable
87+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
8888
with:
8989
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
9090

9191
- name: Cache Cargo
92-
uses: Swatinem/rust-cache@v2
92+
if: ${{ github.event_name != 'workflow_dispatch' }}
93+
uses: Swatinem/rust-cache@v2.9.2
9394
with:
9495
workspaces: ${{ env.WORKING_DIR }}
9596

9697
- name: Install cargo-about ${{ needs.get-configs.outputs.cargo-about-version }}
97-
uses: taiki-e/install-action@v2
98+
uses: taiki-e/install-action@v2.86.7
9899
with:
99100
tool: cargo-about@${{ needs.get-configs.outputs.cargo-about-version }}
100101

@@ -141,12 +142,13 @@ jobs:
141142
ref: ${{ needs.resolve-ref.outputs.sha }}
142143

143144
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
144-
uses: dtolnay/rust-toolchain@stable
145+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
145146
with:
146147
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
147148

148149
- name: Cache Cargo
149-
uses: Swatinem/rust-cache@v2
150+
if: ${{ github.event_name != 'workflow_dispatch' }}
151+
uses: Swatinem/rust-cache@v2.9.2
150152
with:
151153
workspaces: ${{ env.WORKING_DIR }}
152154

@@ -158,6 +160,7 @@ jobs:
158160
kotlin-version: ${{ needs.get-configs.outputs.kotlin-version }}
159161
ktlint-version: ${{ needs.get-configs.outputs.ktlint-version }}
160162
gradle-version: ${{ needs.get-configs.outputs.gradle-version }}
163+
cache-disabled: ${{ github.event_name == 'workflow_dispatch' }}
161164

162165
- name: Log tool versions
163166
uses: ./.github/actions/print-build-versions
@@ -204,12 +207,13 @@ jobs:
204207
ref: ${{ needs.resolve-ref.outputs.sha }}
205208

206209
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
207-
uses: dtolnay/rust-toolchain@stable
210+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
208211
with:
209212
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
210213

211214
- name: Cache Cargo
212-
uses: Swatinem/rust-cache@v2
215+
if: ${{ github.event_name != 'workflow_dispatch' }}
216+
uses: Swatinem/rust-cache@v2.9.2
213217
with:
214218
workspaces: ${{ env.WORKING_DIR }}
215219

@@ -219,7 +223,7 @@ jobs:
219223
node-version: ${{ needs.get-configs.outputs.node-version }}
220224

221225
- name: Install wasm-pack ${{ needs.get-configs.outputs.wasm-pack-version }}
222-
uses: taiki-e/install-action@v2
226+
uses: taiki-e/install-action@v2.86.7
223227
with:
224228
tool: wasm-pack@${{ needs.get-configs.outputs.wasm-pack-version }}
225229

@@ -272,12 +276,13 @@ jobs:
272276
ref: ${{ needs.resolve-ref.outputs.sha }}
273277

274278
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
275-
uses: dtolnay/rust-toolchain@stable
279+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
276280
with:
277281
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
278282

279283
- name: Cache Cargo
280-
uses: Swatinem/rust-cache@v2
284+
if: ${{ github.event_name != 'workflow_dispatch' }}
285+
uses: Swatinem/rust-cache@v2.9.2
281286
with:
282287
workspaces: ${{ env.WORKING_DIR }}
283288

@@ -320,12 +325,13 @@ jobs:
320325
ref: ${{ needs.resolve-ref.outputs.sha }}
321326

322327
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
323-
uses: dtolnay/rust-toolchain@stable
328+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
324329
with:
325330
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}
326331

327332
- name: Cache Cargo
328-
uses: Swatinem/rust-cache@v2
333+
if: ${{ github.event_name != 'workflow_dispatch' }}
334+
uses: Swatinem/rust-cache@v2.9.2
329335
with:
330336
workspaces: ${{ env.WORKING_DIR }}
331337

@@ -376,13 +382,14 @@ jobs:
376382
ref: ${{ needs.resolve-ref.outputs.sha }}
377383

378384
- name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }}
379-
uses: dtolnay/rust-toolchain@stable
385+
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
380386
with:
381387
toolchain: ${{ needs.get-configs.outputs.rust-toolchain }}${{ matrix.target && format('-{0}', matrix.target) || '' }}
382388
targets: ${{ matrix.target || '' }}
383389

384390
- name: Cache Cargo
385-
uses: Swatinem/rust-cache@v2
391+
if: ${{ github.event_name != 'workflow_dispatch' }}
392+
uses: Swatinem/rust-cache@v2.9.2
386393
with:
387394
workspaces: ${{ env.WORKING_DIR }}
388395

@@ -392,6 +399,7 @@ jobs:
392399
go-version: ${{ needs.get-configs.outputs.go-version }}
393400

394401
- name: Cache uniffi-bindgen-go
402+
if: ${{ github.event_name != 'workflow_dispatch' }}
395403
id: cache-uniffi-bindgen-go
396404
uses: actions/cache@v4
397405
with:
@@ -528,7 +536,7 @@ jobs:
528536
echo "Merged JVM jar:"; ls -1 bindings-jvm/generated
529537
530538
- name: Create Pull Request
531-
uses: peter-evans/create-pull-request@v8
539+
uses: peter-evans/create-pull-request@v8.1.1
532540
with:
533541
commit-message: 'chore: Update bindings'
534542
branch: ${{ needs.resolve-ref.outputs.pr-branch }}

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ jobs:
1414
contents: read
1515
with:
1616
ref: ${{ github.sha }}
17+
release-run: false

.github/workflows/pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
uses: ./.github/workflows/validate.yml
1818
permissions:
1919
contents: read
20+
pull-requests: read
2021
with:
2122
ref: ${{ github.sha }}
22-
rust-tests-only: true
23+
release-run: false

.github/workflows/release.yml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
required: true
1010
type: string
1111
ref:
12-
description: "Source ref: main (default), an existing Git tag, or a hotfix/* branch."
12+
description: "Source Git commit, branch, or tag"
1313
required: false
1414
type: string
1515
default: 'main'
@@ -21,16 +21,38 @@ jobs:
2121
get-configs:
2222
uses: ./.github/workflows/configs.yml
2323

24+
resolve-ref:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
sha: ${{ steps.source.outputs.sha }}
28+
steps:
29+
- uses: actions/checkout@v6
30+
with:
31+
ref: ${{ inputs.ref }}
32+
fetch-depth: 0
33+
fetch-tags: true
34+
35+
- name: Pin release source commit
36+
id: source
37+
env:
38+
RELEASE_SOURCE_REF: ${{ inputs.ref }}
39+
run: |
40+
set -euo pipefail
41+
source_commit="$(git rev-parse HEAD^{commit})"
42+
echo "sha=$source_commit" >> "$GITHUB_OUTPUT"
43+
echo "Resolved release source $RELEASE_SOURCE_REF to commit $source_commit."
44+
2445
validate:
46+
needs: [ resolve-ref ]
2547
uses: ./.github/workflows/validate.yml
2648
permissions:
2749
contents: read
2850
with:
29-
ref: ${{ inputs.ref }}
51+
ref: ${{ needs.resolve-ref.outputs.sha }}
3052
fail-fast: true
3153

3254
version-and-tag:
33-
needs: [ get-configs, validate ]
55+
needs: [ get-configs, resolve-ref, validate ]
3456
runs-on: ubuntu-latest
3557
permissions:
3658
contents: write
@@ -40,31 +62,15 @@ jobs:
4062
python-version: ${{ steps.validate-release.outputs.python-version }}
4163
env:
4264
GO_MODULE_TAG: src/bindings-go/go/v${{ inputs.tag }}
43-
RELEASE_SOURCE_REF: ${{ inputs.ref }}
4465
RELEASE_TAG: ${{ inputs.tag }}
4566
WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }}
4667
steps:
4768
- uses: actions/checkout@v6
4869
with:
49-
ref: ${{ inputs.ref }}
70+
ref: ${{ needs.resolve-ref.outputs.sha }}
5071
fetch-depth: 0
5172
fetch-tags: true
5273

53-
- name: Validate source ref
54-
run: |
55-
set -euo pipefail
56-
case "$RELEASE_SOURCE_REF" in
57-
main|refs/heads/main|hotfix/*|refs/heads/hotfix/*|refs/tags/*)
58-
;;
59-
*)
60-
if ! git show-ref --verify --quiet "refs/tags/$RELEASE_SOURCE_REF"; then
61-
echo "::error::Source ref must be main, an existing Git tag, or a hotfix/* branch; received $RELEASE_SOURCE_REF."
62-
exit 1
63-
fi
64-
;;
65-
esac
66-
echo "Validated release source ref, releasing from ref $RELEASE_SOURCE_REF at commit $(git rev-parse HEAD)."
67-
6874
- name: Get version from Cargo.toml
6975
id: get-version
7076
working-directory: ${{ env.WORKING_DIR }}
@@ -278,7 +284,7 @@ jobs:
278284
279285
- name: Configure AWS credentials for GitHub release signing
280286
if: steps.check-github-release.outputs.exists != 'true'
281-
uses: aws-actions/configure-aws-credentials@v6.2.0
287+
uses: aws-actions/configure-aws-credentials@v6.2.3
282288
with:
283289
role-to-assume: ${{ secrets.RELEASE_SIGNING_ROLE_ARN }}
284290
aws-region: ${{ secrets.AWS_REGION }}
@@ -377,7 +383,7 @@ jobs:
377383
378384
- name: Create GitHub Release
379385
if: steps.check-github-release.outputs.exists != 'true'
380-
uses: softprops/action-gh-release@v3
386+
uses: softprops/action-gh-release@v3.0.2
381387
with:
382388
tag_name: ${{ inputs.tag }}
383389
prerelease: ${{ env.RELEASE_KIND == 'beta' }}
@@ -435,7 +441,7 @@ jobs:
435441
echo "Committed jar carries all six platform natives plus compiled classes and sources."
436442
437443
- name: Configure AWS credentials for Maven publishing
438-
uses: aws-actions/configure-aws-credentials@v6.2.0
444+
uses: aws-actions/configure-aws-credentials@v6.2.3
439445
with:
440446
role-to-assume: ${{ secrets.MAVEN_PUBLISHING_ROLE_ARN }}
441447
aws-region: ${{ secrets.AWS_REGION }}

0 commit comments

Comments
 (0)