updates #367
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
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '**.rs' | |
| - '**.rs.gen' | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .github/workflows/cargo-test.yml | |
| - 'rust-toolchain' | |
| - 'rust-toolchain.toml' | |
| pull_request: | |
| paths: | |
| - '**.rs' | |
| - '**.rs.gen' | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .github/workflows/cargo-build.yml | |
| - 'rust-toolchain' | |
| - 'rust-toolchain.toml' | |
| workflow_dispatch: | |
| permissions: read-all | |
| name: cargo test | |
| jobs: | |
| cargotest: | |
| name: cargo test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@master | |
| - name: Cleanup unused space | |
| shell: bash | |
| run: | | |
| set -x | |
| df -h / | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/microsoft | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf /usr/lib/jvm | |
| sudo rm -rf /usr/local/graalvm | |
| sudo rm -rf /usr/local/share/powershell | |
| sudo rm -rf /usr/share/swift | |
| df -h / | |
| - name: Set Swap Space | |
| uses: pierotofy/set-swap-space@master | |
| with: | |
| swap-size-gb: 10 | |
| - name: Install latest rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| components: rustfmt, clippy | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4.2.0 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4.2.0 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4.2.0 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| - name: cargo test | |
| shell: bash | |
| run: | | |
| cargo test --all | |
| env: | |
| RUST_BACKTRACE: 1 | |
| FRONT_API_TOKEN: ${{secrets.FRONT_API_TOKEN}} | |
| REMOTE_API_TOKEN: ${{secrets.REMOTE_API_TOKEN_DEV_CI}} | |
| # TODO: turn back on coverage. | |
| #- name: Run cargo-tarpaulin | |
| #uses: actions-rs/tarpaulin@v0.1 | |
| #with: | |
| #version: '0.15.0' | |
| #args: '--exclude-files schema.rs --timeout 2000 --all' | |
| #env: | |
| #RUST_BACKTRACE: 1 | |
| #- name: Upload to codecov.io | |
| #uses: codecov/codecov-action@v3 | |
| #with: | |
| #token: ${{secrets.CODECOV_TOKEN}} | |
| #fail_ci_if_error: true | |
| #flags: unittests | |
| #verbose: true |