Skip to content

Commit 2e87f16

Browse files
committed
ci: update runners for macOS-related workflows
1 parent d7688f8 commit 2e87f16

File tree

3 files changed

+129
-30
lines changed

3 files changed

+129
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 118 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -895,19 +895,15 @@ jobs:
895895
896896
# This is ci/actions-templates/macos-builds-template.yaml
897897
# Do not edit this file in .github/workflows
898-
build-macos: # job-name
899-
runs-on: macos-latest
898+
build-macos-x86_64: # job-name skip-aarch64
899+
runs-on: macos-13 # skip-aarch64
900900
strategy:
901901
matrix:
902902
target:
903-
- x86_64-apple-darwin
904-
- aarch64-apple-darwin
903+
- x86_64-apple-darwin # skip-aarch64
905904
mode:
906905
- dev
907906
- release
908-
include:
909-
- target: x86_64-apple-darwin
910-
run_tests: YES
911907
steps:
912908
- uses: actions/checkout@v4
913909
with:
@@ -930,7 +926,7 @@ jobs:
930926
echo "SKIP_TESTS=" >> $GITHUB_ENV
931927
echo "LZMA_API_STATIC=1" >> $GITHUB_ENV
932928
- name: Skip tests
933-
if: matrix.run_tests == '' || matrix.mode == 'release'
929+
if: matrix.mode == 'release'
934930
run: |
935931
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
936932
- name: Cache cargo registry and git trees
@@ -960,12 +956,119 @@ jobs:
960956
rustup toolchain uninstall stable
961957
fi
962958
rustup toolchain install --profile=minimal stable
963-
- name: aarch64-specific items
959+
- name: Ensure we have our goal target installed
960+
run: |
961+
rustup target install "$TARGET"
962+
- name: Run a full build and test
963+
env:
964+
BUILD_PROFILE: ${{ matrix.mode }}
965+
run: bash ci/run.bash
966+
- name: Dump dynamic link targets
967+
if: matrix.mode == 'release'
968+
run: |
969+
otool -L target/${TARGET}/release/rustup-init
970+
if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then
971+
echo >&2 "Unfortunately there are /usr/local things in the link. Fail."
972+
exit 1
973+
fi
974+
- name: Upload the built artifact
975+
if: matrix.mode == 'release'
976+
uses: actions/upload-artifact@v4
977+
with:
978+
name: rustup-init-${{ matrix.target }}
979+
path: |
980+
target/${{ matrix.target }}/release/rustup-init
981+
retention-days: 7
982+
- name: Acquire the AWS tooling
983+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
964984
run: |
965-
# Use nightly for now
966-
rustup toolchain install --profile=minimal nightly
967-
rustup default nightly
968-
if: matrix.target == 'aarch64-apple-darwin'
985+
pip3 install awscli
986+
- name: Prepare the dist
987+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
988+
run: |
989+
bash ci/prepare-deploy.bash
990+
- name: Deploy build to dev-static dist tree for release team
991+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
992+
run: |
993+
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
994+
env:
995+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
996+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
997+
AWS_DEFAULT_REGION: us-west-1
998+
- name: Clear the cargo caches
999+
run: |
1000+
cargo install cargo-cache --no-default-features --features ci-autoclean
1001+
cargo-cache
1002+
- name: Flush cache
1003+
# This is a workaround for a bug with GitHub Actions Cache that causes
1004+
# corrupt cache entries (particularly in the target directory). See
1005+
# https://github.com/actions/cache/issues/403 and
1006+
# https://github.com/rust-lang/cargo/issues/8603.
1007+
run: sudo /usr/sbin/purge
1008+
1009+
# This is ci/actions-templates/macos-builds-template.yaml
1010+
# Do not edit this file in .github/workflows
1011+
build-macos-aarch64: # job-name skip-x86_64
1012+
runs-on: macos-14 # skip-x86_64
1013+
strategy:
1014+
matrix:
1015+
target:
1016+
- aarch64-apple-darwin # skip-x86_64
1017+
mode:
1018+
- dev
1019+
- release
1020+
steps:
1021+
- uses: actions/checkout@v4
1022+
with:
1023+
# v2 defaults to a shallow checkout, but we need at least to the previous tag
1024+
fetch-depth: 0
1025+
- name: Acquire tags for the repo
1026+
run: |
1027+
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/*
1028+
- name: Display the current git status
1029+
run: |
1030+
git status
1031+
git describe
1032+
- name: Prep cargo dirs
1033+
run: |
1034+
mkdir -p ~/.cargo/{registry,git}
1035+
- name: Set environment variables appropriately for the build
1036+
run: |
1037+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
1038+
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
1039+
echo "SKIP_TESTS=" >> $GITHUB_ENV
1040+
echo "LZMA_API_STATIC=1" >> $GITHUB_ENV
1041+
- name: Skip tests
1042+
if: matrix.mode == 'release'
1043+
run: |
1044+
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
1045+
- name: Cache cargo registry and git trees
1046+
uses: actions/cache@v4
1047+
with:
1048+
path: |
1049+
~/.cargo/registry
1050+
~/.cargo/git
1051+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
1052+
- name: Get rustc commit hash
1053+
id: cargo-target-cache
1054+
run: |
1055+
echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT
1056+
shell: bash
1057+
- name: Cache cargo build
1058+
uses: actions/cache@v4
1059+
with:
1060+
path: target
1061+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
1062+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
1063+
- name: Install Rustup using ./rustup-init.sh
1064+
run: |
1065+
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
1066+
- name: Ensure Stable is up to date
1067+
run: |
1068+
if rustc +stable -vV >/dev/null 2>/dev/null; then
1069+
rustup toolchain uninstall stable
1070+
fi
1071+
rustup toolchain install --profile=minimal stable
9691072
- name: Ensure we have our goal target installed
9701073
run: |
9711074
rustup target install "$TARGET"
@@ -1218,7 +1321,8 @@ jobs:
12181321
- build-linux-pr
12191322
- build-linux-master
12201323
- build-linux-stable
1221-
- build-macos
1324+
- build-macos-aarch64
1325+
- build-macos-x86_64
12221326
- doc
12231327
- build-windows-pr
12241328
- build-windows-master

ci/actions-templates/gen-workflows.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ gen_job linux-builds pr
3737
gen_job linux-builds master
3838
gen_job linux-builds stable
3939

40+
gen_job macos-builds x86_64
41+
gen_job macos-builds aarch64
42+
4043
# The following targets only have a single job
41-
gen_job macos-builds all
4244
gen_job freebsd-builds all
4345
gen_job centos-fmt-clippy all
4446
gen_job all-features all

ci/actions-templates/macos-builds-template.yaml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
jobs: # skip-all
1+
jobs: # skip-x86_64 skip-aarch64
22

33
# This is ci/actions-templates/macos-builds-template.yaml
44
# Do not edit this file in .github/workflows
5-
build-macos: # job-name
6-
runs-on: macos-latest
5+
build-macos-aarch64: # job-name skip-x86_64
6+
runs-on: macos-14 # skip-x86_64
7+
build-macos-x86_64: # job-name skip-aarch64
8+
runs-on: macos-13 # skip-aarch64
79
strategy:
810
matrix:
911
target:
10-
- x86_64-apple-darwin
11-
- aarch64-apple-darwin
12+
- x86_64-apple-darwin # skip-aarch64
13+
- aarch64-apple-darwin # skip-x86_64
1214
mode:
1315
- dev
1416
- release
15-
include:
16-
- target: x86_64-apple-darwin
17-
run_tests: YES
1817
steps:
1918
- uses: actions/checkout@v4
2019
with:
@@ -37,7 +36,7 @@ jobs: # skip-all
3736
echo "SKIP_TESTS=" >> $GITHUB_ENV
3837
echo "LZMA_API_STATIC=1" >> $GITHUB_ENV
3938
- name: Skip tests
40-
if: matrix.run_tests == '' || matrix.mode == 'release'
39+
if: matrix.mode == 'release'
4140
run: |
4241
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
4342
- name: Cache cargo registry and git trees
@@ -67,12 +66,6 @@ jobs: # skip-all
6766
rustup toolchain uninstall stable
6867
fi
6968
rustup toolchain install --profile=minimal stable
70-
- name: aarch64-specific items
71-
run: |
72-
# Use nightly for now
73-
rustup toolchain install --profile=minimal nightly
74-
rustup default nightly
75-
if: matrix.target == 'aarch64-apple-darwin'
7669
- name: Ensure we have our goal target installed
7770
run: |
7871
rustup target install "$TARGET"

0 commit comments

Comments
 (0)