Skip to content

Commit

Permalink
Revamp GitHub Actions cache keys
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Nov 2, 2022
1 parent 20bf592 commit fca1709
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: maturin-${{ runner.os }}
shared-key: maturin-build
- name: Cache test crates cargo build
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -235,6 +235,8 @@ jobs:
components: rust-src
targets: wasm32-unknown-emscripten
- uses: Swatinem/rust-cache@v2
with:
shared-key: maturin-build
- run: pip install nox
- name: Setup Pyodide
run: nox -s setup-pyodide
Expand Down Expand Up @@ -265,7 +267,7 @@ jobs:
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: maturin-${{ runner.os }}-alpine
shared-key: maturin-build
- name: Cache test crates cargo build
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -298,12 +300,12 @@ jobs:
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: maturin-${{ runner.os }}
shared-key: maturin-build
- name: Cache test crates cargo build
uses: actions/cache@v3
with:
path: test-crates/*/target
key: auditwheel-test-crates-${{ runner.os }}-${{ steps.rustup.outputs.cachekey }}-${{ hashFiles('test-crates/*/Cargo.lock') }}
path: test-crates/targets
key: test-crates-${{ runner.os }}-${{ steps.rustup.outputs.cachekey }}-auditwheel-${{ hashFiles('test-crates/*/Cargo.lock') }}
- name: Compliant Build
run: tests/manylinux_compliant.sh ${{ matrix.manylinux }}
- name: Incompliant Build
Expand Down Expand Up @@ -334,7 +336,7 @@ jobs:
with:
path: test-crates/*/target
# Dockerfile contains the rustc version
key: docker-test-crates-${{ hashFiles('Dockerfile', 'test-crates/*/Cargo.lock') }}
key: test-crates-docker-${{ hashFiles('Dockerfile', 'test-crates/*/Cargo.lock') }}
- name: Test the Docker container
run: ./test-dockerfile.sh
# Fix permissions from docker for caching
Expand Down Expand Up @@ -416,7 +418,7 @@ jobs:
if: steps.changes.outputs.changed == 'true'
uses: Swatinem/rust-cache@v2
with:
key: maturin-${{ runner.os }}-bootstrap
shared-key: maturin-build
- uses: actions/setup-python@v4
if: steps.changes.outputs.changed == 'true'
with:
Expand Down Expand Up @@ -450,7 +452,7 @@ jobs:
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
with:
key: maturin-${{ runner.os }}-msrv
key: msrv
- name: cargo build
run: cargo build --all

Expand Down
2 changes: 1 addition & 1 deletion tests/manylinux_compliant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -e
which cargo > /dev/null 2>&1 || curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal

for PYBIN in /opt/python/cp3[789]*/bin; do
cargo run -- build -m test-crates/pyo3-mixed/Cargo.toml -i "${PYBIN}/python" --manylinux $1 -o dist
cargo run -- build -m test-crates/pyo3-mixed/Cargo.toml --target-dir test-crates/targets -i "${PYBIN}/python" --manylinux $1 -o dist
done
4 changes: 2 additions & 2 deletions tests/manylinux_incompliant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ which cargo > /dev/null || curl -sSf https://sh.rustup.rs | sh -s -- -y --profil

# Fail because we're running in manylinux2014, which can't build for manylinux 2010
for PYBIN in /opt/python/cp3[9]*/bin; do
if cargo run -- build -m test-crates/pyo3-mixed/Cargo.toml -i "${PYBIN}/python" --manylinux 2010 -o dist; then
if cargo run -- build -m test-crates/pyo3-mixed/Cargo.toml --target-dir test-crates/targets -i "${PYBIN}/python" --manylinux 2010 -o dist; then
echo "maturin build unexpectedly succeeded"
exit 1
else
Expand All @@ -17,7 +17,7 @@ done
apt-get -v &> /dev/null && apt-get install -y zlib1g-dev || yum install -y zlib-devel

for PYBIN in /opt/python/cp3[9]*/bin; do
if cargo run -- build -m test-crates/lib_with_disallowed_lib/Cargo.toml -i "${PYBIN}/python" --manylinux 2014 -o dist; then
if cargo run -- build -m test-crates/lib_with_disallowed_lib/Cargo.toml --target-dir test-crates/targets -i "${PYBIN}/python" --manylinux 2014 -o dist; then
echo "maturin build unexpectedly succeeded"
exit 1
else
Expand Down

0 comments on commit fca1709

Please sign in to comment.