Skip to content

Commit d4d457f

Browse files
authored
🌩️ Use cloud caching (#14)
No need to use GitHub's action cache. The credentials used here are intended to be used by third parties. That is, they're safe to have in this workflow and may be copy-pasted into any projects that would like to use NativeLink as remote cache.
1 parent 7870459 commit d4d457f

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

.github/workflows/test-stdlib.yaml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ name: 🔥 Test Mojo Standard library
77
pull_request:
88
branches: [main]
99

10-
permissions: read-all
1110

1211
jobs:
1312
stdlib-tests:
@@ -18,8 +17,21 @@ jobs:
1817
os: [ubuntu-24.04]
1918
runs-on: ${{ matrix.os }}
2019
timeout-minutes: 60
20+
permissions:
21+
id-token: write
2122
steps:
2223

24+
- name: Get Web Identity Token via Cognito Identity Pool
25+
id: web_id_token
26+
# See: https://github.com/catnekaise/cognito-idpool-auth/issues/6
27+
uses: >- # alpha
28+
catnekaise/cognito-idpool-basic-auth@287d4dabb527d8b78d3df6e0436d46e3abd209d3
29+
with:
30+
# yamllint disable rule:line-length
31+
cognito-identity-pool-id: "us-east-2:7edef192-7c1c-4e55-8ab4-6035b9c2288f"
32+
aws-account-id: "471112781046"
33+
aws-region: "us-east-2"
34+
audience: "sts.amazonaws.com"
2335
- name: Checkout
2436
uses: >- #v4.1.6
2537
actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
@@ -31,25 +43,24 @@ jobs:
3143
- name: Cache Nix derivations
3244
uses: >- # v6
3345
DeterminateSystems/magic-nix-cache-action@87e8236f46702ab0ce5a058b605a173ec88d618e
34-
- name: Mount bazel cache
35-
uses: >- # v4.0.2
36-
actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
37-
with:
38-
path: |
39-
~/.cache/bazel
40-
key: >-
41-
${{ runner.os }}-bazel-${{ hashFiles(
42-
'.bazelversion',
43-
'.bazelrc',
44-
'MODULE.bazel',
45-
'MODULE.bazel.lock',
46-
'**/*.nix',
47-
'flake.lock'
48-
) }}
49-
restore-keys: |
50-
${{ runner.os }}-bazel-
46+
47+
# - name: Create secret from token
48+
# uses: actions/github-script@v6
49+
# with:
50+
# # yamllint disable rule:line-length
51+
# script: >-
52+
# core.setSecret('NATIVELINK_TOKEN',
53+
# '${{ steps.web_id_token.outputs.cognito_identity_oidc_access_token }}')
5154

5255
- name: Invoke Bazel build in Nix shell
56+
env:
57+
NATIVELINK_TOKEN: ${{ env.NATIVELINK_TOKEN }}
5358
run: |
5459
nix develop --impure --command \
55-
bash -c "bazel test --jobs=4 @mojo//... --verbose_failures"
60+
bash -c "bazel test \
61+
--jobs=4 \
62+
--verbose_failures \
63+
--experimental_remote_cache_async \
64+
--remote_header=x-nativelink-api-key=$NATIVELINK_TOKEN \
65+
--remote_cache=grpcs://cas-gha-ci.build-faster.nativelink.net:443 \
66+
@mojo//..."

0 commit comments

Comments
 (0)