Skip to content

Commit 3a505da

Browse files
brianmichelcompnerd
authored andcommitted
Configure caching through env variables
If the env variables are present in the repo, it will configure the action for s3 caching. If not, it will fall back to disk caching. We also need to remove the env variable on the jobs since we control those values closer to the cache site.
1 parent 08c5d58 commit 3a505da

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ on:
146146
PASSPHRASE:
147147
required: true
148148

149-
env:
150-
SCCACHE_DIRECT: yes
151149

152150
jobs:
153151
context:
@@ -788,6 +786,9 @@ jobs:
788786
windows-build:
789787
needs: [context]
790788
name: Windows Swift Toolchains Build
789+
permissions:
790+
contents: read
791+
id-token: write
791792

792793
uses: ./.github/workflows/swift-toolchain.yml
793794
with:
@@ -866,6 +867,10 @@ jobs:
866867
if: false
867868
needs: [context]
868869
name: macOS Swift Toolchains Build
870+
permissions:
871+
contents: read
872+
id-token: write
873+
869874
uses: ./.github/workflows/swift-toolchain.yml
870875
with:
871876
build_os: Darwin

.github/workflows/swift-toolchain.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ on:
273273
required: true
274274

275275
env:
276-
SCCACHE_DIRECT: on
277-
278276
# Workaround for needing llvm-17 on macOS preventing us from using the 5.10 toolchain release.
279277
WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_BRANCH: swift-6.0.1-release
280278
WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG: 6.0.1-RELEASE
@@ -345,6 +343,9 @@ jobs:
345343
- name: Setup sccache
346344
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
347345
with:
346+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
347+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
348+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
348349
disk-max-size: 100M
349350
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-sqlite
350351

@@ -595,6 +596,9 @@ jobs:
595596
- name: Setup sccache
596597
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
597598
with:
599+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
600+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
601+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
598602
disk-max-size: 1M
599603
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-cmark-gfm
600604

@@ -683,6 +687,9 @@ jobs:
683687
- name: Setup sccache
684688
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
685689
with:
690+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
691+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
692+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
686693
disk-max-size: 100M
687694
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-build_tools
688695

@@ -1084,6 +1091,9 @@ jobs:
10841091
- name: Setup sccache
10851092
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
10861093
with:
1094+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
1095+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
1096+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
10871097
disk-max-size: 500M
10881098
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.variant }}-compilers
10891099

@@ -1363,6 +1373,9 @@ jobs:
13631373
- name: Setup sccache
13641374
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
13651375
with:
1376+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
1377+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
1378+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
13661379
disk-max-size: 100M
13671380
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-zlib
13681381

@@ -1462,6 +1475,9 @@ jobs:
14621475
- name: Setup sccache
14631476
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
14641477
with:
1478+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
1479+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
1480+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
14651481
disk-max-size: 100M
14661482
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-curl
14671483

@@ -1633,6 +1649,9 @@ jobs:
16331649
- name: Setup sccache
16341650
uses: ./SourceCache/swift-build/.github/actions/setup-sccache
16351651
with:
1652+
s3-bucket: ${{ vars.SCCACHE_S3_BUCKET }}
1653+
aws-region: ${{ vars.SCCACHE_AWS_REGION }}
1654+
aws-arn: ${{ vars.SCCACHE_AWS_ARN }}
16361655
disk-max-size: 100M
16371656
disk-cache-key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-libxml2
16381657

0 commit comments

Comments
 (0)