Add Swatinem/rust-cache@v2
#9067
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: Rust - Run Clippy to check lints | |
| on: | |
| pull_request: | |
| paths: | |
| - .github/workflows/clippy.yml | |
| - 'ci/cargo-ci.sh' | |
| - clippy.toml | |
| - '**/*.rs' | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| prepare-android: | |
| name: Prepare Android container | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use custom container image if specified | |
| if: ${{ github.event.inputs.override_container_image != '' }} | |
| run: echo "inner_container_image_android=${{ github.event.inputs.override_container_image }}" | |
| >> $GITHUB_ENV | |
| - name: Use default container image and resolve digest | |
| if: ${{ github.event.inputs.override_container_image == '' }} | |
| run: echo "inner_container_image_android=$(cat ./building/android-container-image.txt)" >> $GITHUB_ENV | |
| outputs: | |
| container_image_android: ${{ env.inner_container_image_android }} | |
| clippy-check-desktop: | |
| name: Clippy linting, desktop | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| # By default, the longest path a filename can have in git on Windows is 260 character. | |
| - name: Set git config for long paths | |
| if: runner.os == 'Windows' | |
| run: | | |
| git config --system core.longpaths true | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/mullvad-build-env | |
| with: | |
| rustup-components: clippy | |
| rust-cache-targets: ${{ runner.os == 'Windows' && 'true' || 'false' }} | |
| - name: Clippy check | |
| shell: bash | |
| run: | | |
| time ci/cargo-ci.sh clippy --workspace --all-targets --no-default-features | |
| time ci/cargo-ci.sh clippy --workspace --all-targets --all-features | |
| clippy-check-android: | |
| name: Clippy linting, Android | |
| needs: prepare-android | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ${{ needs.prepare-android.outputs.container_image_android }} | |
| steps: | |
| # Fix for HOME path overridden by GH runners when building in containers, see: | |
| # https://github.com/actions/runner/issues/863 | |
| - name: Fix HOME path | |
| run: echo "HOME=/root" >> $GITHUB_ENV | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Checkout wireguard-go submodule | |
| run: | | |
| git config --global --add safe.directory '*' | |
| git submodule update --init wireguard-go-rs/libwg/wireguard-go | |
| - name: Clippy check | |
| run: | | |
| ci/cargo-ci.sh clippy --all-targets --target x86_64-linux-android --package mullvad-jni --no-default-features | |
| ci/cargo-ci.sh clippy --all-targets --target x86_64-linux-android --package mullvad-jni --all-features |