Skip to content

Commit 6dc031d

Browse files
committed
Build debug and release in different jobs
Debug and release build artifacts shouldn't be mixed in one cache. Build them in different jobs.
1 parent 1b91a9c commit 6dc031d

12 files changed

+257
-139
lines changed

.github/workflows/linux-builds-on-master.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20+
mode:
21+
- dev
22+
- release
2023
target:
2124
- x86_64-unknown-linux-gnu
2225
- armv7-unknown-linux-gnueabihf
@@ -55,9 +58,9 @@ jobs:
5558
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
5659
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
5760
- name: Skip tests
61+
if: matrix.run_tests == '' || matrix.mode == 'release'
5862
run: |
5963
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
60-
if: matrix.run_tests == ''
6164
- name: Cache cargo registry and git trees
6265
uses: actions/cache@v3
6366
with:
@@ -74,8 +77,8 @@ jobs:
7477
uses: actions/cache@v3
7578
with:
7679
path: target
77-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
78-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
80+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
81+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
7982
- name: Install Rustup using ./rustup-init.sh
8083
run: |
8184
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -103,51 +106,55 @@ jobs:
103106
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" .
104107
fi
105108
- name: Run the build within the docker image
109+
env:
110+
BUILD_PROFILE: ${{ matrix.mode }}
106111
run: |
107112
mkdir -p "${PWD}/target"
108113
chown -R "$(id -u)":"$(id -g)" "${PWD}/target"
109114
docker run \
110115
--entrypoint sh \
111-
--user "$(id -u)":"$(id -g)" \
112-
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
113-
--volume "${PWD}":/checkout:ro \
114-
--volume "${PWD}"/target:/checkout/target \
115-
--workdir /checkout \
116-
--env TARGET="${TARGET}" \
117-
--env SKIP_TESTS="${SKIP_TESTS}" \
118-
--volume "${HOME}/.cargo:/cargo" \
116+
--env BUILD_PROFILE="${BUILD_PROFILE}" \
119117
--env CARGO_HOME=/cargo \
120118
--env CARGO_TARGET_DIR=/checkout/target \
121119
--env LIBZ_SYS_STATIC=1 \
122-
--tty \
120+
--env SKIP_TESTS="${SKIP_TESTS}" \
121+
--env TARGET="${TARGET}" \
123122
--init \
124123
--rm \
124+
--tty \
125+
--user "$(id -u)":"$(id -g)" \
126+
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
127+
--volume "${HOME}/.cargo:/cargo" \
128+
--volume "${PWD}":/checkout:ro \
129+
--volume "${PWD}"/target:/checkout/target \
130+
--workdir /checkout \
125131
"${DOCKER}" \
126132
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
127133
- name: Upload the built artifact
128134
uses: actions/upload-artifact@v3
135+
if: matrix.mode == 'release'
129136
with:
130137
name: rustup-init-${{ matrix.target }}
131138
path: |
132139
target/${{ matrix.target }}/release/rustup-init
133140
retention-days: 7
134141
- name: Acquire the AWS tooling
142+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
135143
run: |
136144
pip3 install -U setuptools
137145
pip3 install awscli
138-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
139146
- name: Prepare the dist
147+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
140148
run: |
141149
bash ci/prepare-deploy.bash
142-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
143150
- name: Deploy build to dev-static dist tree for release team
151+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
144152
run: |
145153
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
146154
env:
147155
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
148156
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
149157
AWS_DEFAULT_REGION: us-west-1
150-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
151158
- name: Clear the cargo caches
152159
run: |
153160
cargo install cargo-cache --no-default-features --features ci-autoclean

.github/workflows/linux-builds-on-pr.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19+
mode:
20+
- dev
21+
- release
1922
target:
2023
- x86_64-unknown-linux-gnu
2124
- armv7-unknown-linux-gnueabihf
@@ -49,9 +52,9 @@ jobs:
4952
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
5053
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
5154
- name: Skip tests
55+
if: matrix.run_tests == '' || matrix.mode == 'release'
5256
run: |
5357
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
54-
if: matrix.run_tests == ''
5558
- name: Cache cargo registry and git trees
5659
uses: actions/cache@v3
5760
with:
@@ -68,8 +71,8 @@ jobs:
6871
uses: actions/cache@v3
6972
with:
7073
path: target
71-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
72-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
74+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
75+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
7376
- name: Install Rustup using ./rustup-init.sh
7477
run: |
7578
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -97,51 +100,55 @@ jobs:
97100
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" .
98101
fi
99102
- name: Run the build within the docker image
103+
env:
104+
BUILD_PROFILE: ${{ matrix.mode }}
100105
run: |
101106
mkdir -p "${PWD}/target"
102107
chown -R "$(id -u)":"$(id -g)" "${PWD}/target"
103108
docker run \
104109
--entrypoint sh \
105-
--user "$(id -u)":"$(id -g)" \
106-
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
107-
--volume "${PWD}":/checkout:ro \
108-
--volume "${PWD}"/target:/checkout/target \
109-
--workdir /checkout \
110-
--env TARGET="${TARGET}" \
111-
--env SKIP_TESTS="${SKIP_TESTS}" \
112-
--volume "${HOME}/.cargo:/cargo" \
110+
--env BUILD_PROFILE="${BUILD_PROFILE}" \
113111
--env CARGO_HOME=/cargo \
114112
--env CARGO_TARGET_DIR=/checkout/target \
115113
--env LIBZ_SYS_STATIC=1 \
116-
--tty \
114+
--env SKIP_TESTS="${SKIP_TESTS}" \
115+
--env TARGET="${TARGET}" \
117116
--init \
118117
--rm \
118+
--tty \
119+
--user "$(id -u)":"$(id -g)" \
120+
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
121+
--volume "${HOME}/.cargo:/cargo" \
122+
--volume "${PWD}":/checkout:ro \
123+
--volume "${PWD}"/target:/checkout/target \
124+
--workdir /checkout \
119125
"${DOCKER}" \
120126
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
121127
- name: Upload the built artifact
122128
uses: actions/upload-artifact@v3
129+
if: matrix.mode == 'release'
123130
with:
124131
name: rustup-init-${{ matrix.target }}
125132
path: |
126133
target/${{ matrix.target }}/release/rustup-init
127134
retention-days: 7
128135
- name: Acquire the AWS tooling
136+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
129137
run: |
130138
pip3 install -U setuptools
131139
pip3 install awscli
132-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
133140
- name: Prepare the dist
141+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
134142
run: |
135143
bash ci/prepare-deploy.bash
136-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
137144
- name: Deploy build to dev-static dist tree for release team
145+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
138146
run: |
139147
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
140148
env:
141149
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
142150
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
143151
AWS_DEFAULT_REGION: us-west-1
144-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
145152
- name: Clear the cargo caches
146153
run: |
147154
cargo install cargo-cache --no-default-features --features ci-autoclean

.github/workflows/linux-builds-on-stable.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18+
mode:
19+
- dev
20+
- release
1821
target:
1922
- x86_64-unknown-linux-gnu
2023
- armv7-unknown-linux-gnueabihf
@@ -78,9 +81,9 @@ jobs:
7881
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
7982
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
8083
- name: Skip tests
84+
if: matrix.run_tests == '' || matrix.mode == 'release'
8185
run: |
8286
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
83-
if: matrix.run_tests == ''
8487
- name: Cache cargo registry and git trees
8588
uses: actions/cache@v3
8689
with:
@@ -97,8 +100,8 @@ jobs:
97100
uses: actions/cache@v3
98101
with:
99102
path: target
100-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
101-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
103+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
104+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
102105
- name: Install Rustup using ./rustup-init.sh
103106
run: |
104107
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -126,51 +129,55 @@ jobs:
126129
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" .
127130
fi
128131
- name: Run the build within the docker image
132+
env:
133+
BUILD_PROFILE: ${{ matrix.mode }}
129134
run: |
130135
mkdir -p "${PWD}/target"
131136
chown -R "$(id -u)":"$(id -g)" "${PWD}/target"
132137
docker run \
133138
--entrypoint sh \
134-
--user "$(id -u)":"$(id -g)" \
135-
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
136-
--volume "${PWD}":/checkout:ro \
137-
--volume "${PWD}"/target:/checkout/target \
138-
--workdir /checkout \
139-
--env TARGET="${TARGET}" \
140-
--env SKIP_TESTS="${SKIP_TESTS}" \
141-
--volume "${HOME}/.cargo:/cargo" \
139+
--env BUILD_PROFILE="${BUILD_PROFILE}" \
142140
--env CARGO_HOME=/cargo \
143141
--env CARGO_TARGET_DIR=/checkout/target \
144142
--env LIBZ_SYS_STATIC=1 \
145-
--tty \
143+
--env SKIP_TESTS="${SKIP_TESTS}" \
144+
--env TARGET="${TARGET}" \
146145
--init \
147146
--rm \
147+
--tty \
148+
--user "$(id -u)":"$(id -g)" \
149+
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
150+
--volume "${HOME}/.cargo:/cargo" \
151+
--volume "${PWD}":/checkout:ro \
152+
--volume "${PWD}"/target:/checkout/target \
153+
--workdir /checkout \
148154
"${DOCKER}" \
149155
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
150156
- name: Upload the built artifact
151157
uses: actions/upload-artifact@v3
158+
if: matrix.mode == 'release'
152159
with:
153160
name: rustup-init-${{ matrix.target }}
154161
path: |
155162
target/${{ matrix.target }}/release/rustup-init
156163
retention-days: 7
157164
- name: Acquire the AWS tooling
165+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
158166
run: |
159167
pip3 install -U setuptools
160168
pip3 install awscli
161-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
162169
- name: Prepare the dist
170+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
163171
run: |
164172
bash ci/prepare-deploy.bash
165-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
166173
- name: Deploy build to dev-static dist tree for release team
174+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
167175
run: |
168176
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
169177
env:
170178
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
171179
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
172180
AWS_DEFAULT_REGION: us-west-1
173-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
174181
- name: Clear the cargo caches
175182
run: |
176183
cargo install cargo-cache --no-default-features --features ci-autoclean

.github/workflows/macos-builds-on-all.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ jobs:
2323
target:
2424
- x86_64-apple-darwin
2525
- aarch64-apple-darwin
26+
mode:
27+
- dev
28+
- release
29+
include:
30+
- target: x86_64-apple-darwin
31+
run_tests: YES
2632
steps:
2733
- uses: actions/checkout@v3
2834
with:
@@ -44,6 +50,10 @@ jobs:
4450
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
4551
echo "SKIP_TESTS=" >> $GITHUB_ENV
4652
echo "LZMA_API_STATIC=1" >> $GITHUB_ENV
53+
- name: Skip tests
54+
if: matrix.run_tests == '' || matrix.mode == 'release'
55+
run: |
56+
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
4757
- name: Cache cargo registry and git trees
4858
uses: actions/cache@v3
4959
with:
@@ -60,8 +70,8 @@ jobs:
6070
uses: actions/cache@v3
6171
with:
6272
path: target
63-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
64-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
73+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
74+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
6575
- name: Install Rustup using ./rustup-init.sh
6676
run: |
6777
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -76,45 +86,46 @@ jobs:
7686
# Use nightly for now
7787
rustup toolchain install --profile=minimal nightly
7888
rustup default nightly
79-
80-
# Can't run tests: cross-compiling
81-
echo "SKIP_TESTS=yes" >> $GITHUB_ENV
8289
if: matrix.target == 'aarch64-apple-darwin'
8390
- name: Ensure we have our goal target installed
8491
run: |
8592
rustup target install "$TARGET"
8693
- name: Run a full build and test
94+
env:
95+
BUILD_PROFILE: ${{ matrix.mode }}
8796
run: bash ci/run.bash
8897
- name: Dump dynamic link targets
98+
if: matrix.mode == 'release'
8999
run: |
90100
otool -L target/${TARGET}/release/rustup-init
91101
if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then
92102
echo >&2 "Unfortunately there are /usr/local things in the link. Fail."
93103
exit 1
94104
fi
95105
- name: Upload the built artifact
106+
if: matrix.mode == 'release'
96107
uses: actions/upload-artifact@v3
97108
with:
98109
name: rustup-init-${{ matrix.target }}
99110
path: |
100111
target/${{ matrix.target }}/release/rustup-init
101112
retention-days: 7
102113
- name: Acquire the AWS tooling
114+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
103115
run: |
104116
pip3 install awscli
105-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
106117
- name: Prepare the dist
118+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
107119
run: |
108120
bash ci/prepare-deploy.bash
109-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
110121
- name: Deploy build to dev-static dist tree for release team
122+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release'
111123
run: |
112124
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
113125
env:
114126
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
115127
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
116128
AWS_DEFAULT_REGION: us-west-1
117-
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
118129
- name: Clear the cargo caches
119130
run: |
120131
cargo install cargo-cache --no-default-features --features ci-autoclean

0 commit comments

Comments
 (0)