ci(rust): fix cache thrashing that forced cold compiles every run (#1… #2258
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/ci-rust.yaml" | |
| - ".github/actions/rust-setup/**" | |
| - "Cargo.*" | |
| - "crates/**" | |
| - "extra/**" | |
| - "modules/meteroid/**" | |
| - "modules/metering/**" | |
| - "modules/adapters/**" | |
| pull_request: | |
| types: [ opened, reopened, synchronize ] | |
| paths: | |
| - ".github/workflows/ci-rust.yaml" | |
| - ".github/actions/rust-setup/**" | |
| - "Cargo.*" | |
| - "crates/**" | |
| - "extra/**" | |
| - "modules/meteroid/**" | |
| - "modules/metering/**" | |
| - "modules/adapters/**" | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| # Trim debug info in CI only (local dev profiles are untouched): smaller | |
| # target dir, faster codegen/linking, and a lighter cache to store/restore. | |
| CARGO_PROFILE_DEV_DEBUG: line-tables-only | |
| CARGO_PROFILE_TEST_DEBUG: line-tables-only | |
| jobs: | |
| check: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| services: | |
| postgres: | |
| image: ghcr.io/meteroid-oss/meteroid-postgres:18.3-standard | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| METEROID_TEST_PG_URL: postgres://postgres:postgres@127.0.0.1:5432/postgres | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Free disk space | |
| run: | | |
| df -h | |
| sudo apt-get remove -y '^llvm-.*' | |
| sudo apt-get remove -y 'php.*' | |
| sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel || true | |
| sudo apt-get autoremove -y | |
| sudo apt-get clean | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache | |
| sudo rm -rf /usr/lib/jvm | |
| sudo rm -rf /usr/local/julia* | |
| sudo rm -rf /usr/local/share/chromium | |
| sudo rm -rf /opt/microsoft /opt/google | |
| sudo rm -rf /opt/az | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo docker image prune -a -f | |
| sudo docker builder prune -a | |
| df -h | |
| - uses: ./.github/actions/rust-setup | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Test | |
| run: cargo nextest run --locked | |
| - name: Final disk space | |
| run: df -h | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/rust-setup | |
| with: | |
| components: rustfmt | |
| install-deps: 'false' | |
| mold: 'false' | |
| - name: Rustfmt Check | |
| uses: actions-rust-lang/rustfmt@v1 | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/rust-setup | |
| with: | |
| components: clippy | |
| - name: Linting | |
| run: cargo clippy --locked -- -D warnings |