|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + - cron: "14 04 * * *" # Daily at 9:14 PM PDT, 8:14 PM PST. |
| 9 | + |
| 10 | +jobs: |
| 11 | + pre_job: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 15 | + steps: |
| 16 | + - id: skip_check |
| 17 | + |
| 18 | + with: |
| 19 | + cancel_others: "true" |
| 20 | + |
| 21 | + test: |
| 22 | + name: Test |
| 23 | + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} |
| 24 | + timeout-minutes: 10 |
| 25 | + needs: pre_job |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout sources |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Install nightly toolchain |
| 33 | + uses: actions-rs/toolchain@v1 |
| 34 | + with: |
| 35 | + profile: minimal |
| 36 | + toolchain: nightly |
| 37 | + components: rustfmt, clippy |
| 38 | + |
| 39 | + - name: Install Action cargo-generate |
| 40 | + uses: cargo-generate/[email protected] |
| 41 | + with: |
| 42 | + name: generated |
| 43 | + - name: Move generated project |
| 44 | + run: | |
| 45 | + mv generated ${{ runner.temp }}/ |
| 46 | +
|
| 47 | + - name: Run cargo check |
| 48 | + uses: actions-rs/cargo@v1 |
| 49 | + with: |
| 50 | + command: check |
| 51 | + args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all-targets |
| 52 | + |
| 53 | + - name: Run cargo fmt |
| 54 | + uses: actions-rs/cargo@v1 |
| 55 | + with: |
| 56 | + command: fmt |
| 57 | + args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all -- --check |
| 58 | + |
| 59 | + - name: Run cargo clippy |
| 60 | + uses: actions-rs/cargo@v1 |
| 61 | + with: |
| 62 | + command: clippy |
| 63 | + args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all --all-targets -- -D warnings |
| 64 | + |
| 65 | + - name: Run cargo test |
| 66 | + uses: actions-rs/cargo@v1 |
| 67 | + with: |
| 68 | + command: test |
| 69 | + args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all-targets --no-fail-fast |
| 70 | + |
| 71 | + - name: Run cargo build |
| 72 | + uses: actions-rs/cargo@v1 |
| 73 | + with: |
| 74 | + command: build |
| 75 | + args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all-targets |
0 commit comments