|
| 1 | +name: "Test Rust" |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash -l {0} |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + services: |
| 20 | + dynamo: |
| 21 | + image: amazon/dynamodb-local |
| 22 | + ports: |
| 23 | + - 8000:8000 |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + |
| 28 | + - uses: actions/cache@v3 |
| 29 | + with: |
| 30 | + path: | |
| 31 | + ~/.cargo/bin/ |
| 32 | + ~/.cargo/registry/index/ |
| 33 | + ~/.cargo/registry/cache/ |
| 34 | + ~/.cargo/git/db/ |
| 35 | + target/ |
| 36 | + key: rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}-test |
| 37 | + restore-keys: | |
| 38 | + rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}-test |
| 39 | + rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}- |
| 40 | + rust-cargo-v1- |
| 41 | +
|
| 42 | + - uses: actions-rs/cargo@v1 |
| 43 | + with: |
| 44 | + command: test |
| 45 | + env: |
| 46 | + CS_WORKSPACE_ID: ${{ secrets.CS_WORKSPACE_ID }} |
| 47 | + CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_CLIENT_ACCESS_KEY }} |
| 48 | + CS_CLIENT_ID: ${{ secrets.CS_CLIENT_ID }} |
| 49 | + CS_CLIENT_KEY: ${{ secrets.CS_CLIENT_KEY }} |
| 50 | + CS_VITUR_IDP_HOST: "https://ap-southeast-2.aws.auth.viturhosted.net" |
| 51 | + AWS_ACCESS_KEY_ID: cryptonamo |
| 52 | + AWS_SECRET_ACCESS_KEY: cryptonamo |
| 53 | + AWS_REGION: ap-southeast-2 |
| 54 | + RUST_BACKTRACE: full |
| 55 | + |
| 56 | + format: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + |
| 61 | + - uses: actions/cache@v3 |
| 62 | + with: |
| 63 | + path: | |
| 64 | + ~/.cargo/bin/ |
| 65 | + ~/.cargo/registry/index/ |
| 66 | + ~/.cargo/registry/cache/ |
| 67 | + ~/.cargo/git/db/ |
| 68 | + target/ |
| 69 | + key: format-rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }} |
| 70 | + restore-keys: | |
| 71 | + format-rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }} |
| 72 | + format-rust-cargo-v1- |
| 73 | +
|
| 74 | + - uses: actions-rs/cargo@v1 |
| 75 | + with: |
| 76 | + command: fmt |
| 77 | + args: --all -- --check |
| 78 | + |
| 79 | + clippy: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + |
| 84 | + - uses: actions/cache@v3 |
| 85 | + with: |
| 86 | + path: | |
| 87 | + ~/.cargo/bin/ |
| 88 | + ~/.cargo/registry/index/ |
| 89 | + ~/.cargo/registry/cache/ |
| 90 | + ~/.cargo/git/db/ |
| 91 | + target/ |
| 92 | + key: rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}-clippy |
| 93 | + restore-keys: | |
| 94 | + rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}-clippy |
| 95 | + rust-cargo-v1-${{ hashFiles('**/Cargo.lock') }}- |
| 96 | + rust-cargo-v1- |
| 97 | +
|
| 98 | + - uses: actions-rs/cargo@v1 |
| 99 | + with: |
| 100 | + command: clippy |
| 101 | + args: --all --no-deps --all-features --tests |
0 commit comments