|
| 1 | +name: Check & Test |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' |
| 6 | + push: |
| 7 | + branches: [ '*' ] |
| 8 | + paths: |
| 9 | + - '.github/workflows/*.yml' |
| 10 | + - '**/*.rs' |
| 11 | + - '**/*.md' # Test examples in markdowns included as API doc |
| 12 | + - '**/Cargo.toml' |
| 13 | + - '**/Cargo.lock' |
| 14 | + pull_request: |
| 15 | + branches: [ '*' ] |
| 16 | + paths: |
| 17 | + - '.github/workflows/*.yml' |
| 18 | + - '**/*.rs' |
| 19 | + - '**/*.md' # Test examples in markdowns included as API doc |
| 20 | + - '**/Cargo.toml' |
| 21 | + - '**/Cargo.lock' |
| 22 | + # Allows you to run this workflow manually from the Actions tab |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +env: |
| 26 | + CARGO_TERM_COLOR: always |
| 27 | + |
| 28 | +jobs: |
| 29 | + test: |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 33 | + rust: [ stable, beta ] |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + timeout-minutes: 5 |
| 36 | + if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + - uses: actions-rs/toolchain@v1 |
| 40 | + with: |
| 41 | + toolchain: ${{ matrix.rust }} |
| 42 | + override: true |
| 43 | + - name: Check |
| 44 | + run: cargo check --verbose |
| 45 | + - name: Tests |
| 46 | + run: cargo test --verbose -- --show-output |
| 47 | + - name: Ignored tests |
| 48 | + run: cargo test --verbose -- --show-output --ignored |
| 49 | + lint: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 5 |
| 52 | + if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && !contains(github.ref, 'refs/tags/v') |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + - uses: actions-rs/toolchain@v1 |
| 56 | + with: |
| 57 | + toolchain: stable |
| 58 | + override: true |
| 59 | + components: rustfmt, clippy |
| 60 | + - uses: actions-rs/clippy-check@v1 |
| 61 | + with: |
| 62 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + args: --all-features |
| 64 | + - name: Run lint |
| 65 | + run: cargo clippy --verbose -- -D warnings |
| 66 | + - name: Run fmt |
| 67 | + run: cargo fmt --verbose --all -- --check |
| 68 | + nightly-test: |
| 69 | + strategy: |
| 70 | + matrix: |
| 71 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 72 | + rust: [ nightly ] |
| 73 | + runs-on: ${{ matrix.os }} |
| 74 | + timeout-minutes: 5 |
| 75 | + if: endsWith(github.ref, '-nightly') || github.event_name == 'schedule' |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v2 |
| 78 | + - uses: actions-rs/toolchain@v1 |
| 79 | + with: |
| 80 | + toolchain: ${{ matrix.rust }} |
| 81 | + override: true |
| 82 | + - name: Check |
| 83 | + run: cargo check --verbose |
| 84 | + - name: Tests |
| 85 | + run: cargo test --verbose -- --show-output |
| 86 | + - name: Ignored tests |
| 87 | + run: cargo test --verbose -- --show-output --ignored |
| 88 | + nightly-lint: |
| 89 | + runs-on: ubuntu-latest |
| 90 | + timeout-minutes: 5 |
| 91 | + if: endsWith(github.ref, '-nightly') || github.event_name != 'schedule' |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v2 |
| 94 | + - uses: actions-rs/toolchain@v1 |
| 95 | + with: |
| 96 | + toolchain: nightly |
| 97 | + override: true |
| 98 | + components: rustfmt, clippy |
| 99 | + - uses: actions-rs/clippy-check@v1 |
| 100 | + with: |
| 101 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + args: --all-features |
| 103 | + - name: Run lint |
| 104 | + run: cargo clippy --verbose -- -D warnings |
| 105 | + - name: Run fmt |
| 106 | + run: cargo fmt --verbose --all -- --check |
| 107 | + audit: |
| 108 | + runs-on: ubuntu-latest |
| 109 | + steps: |
| 110 | + - uses: actions/checkout@v2 |
| 111 | + - uses: actions-rs/audit-check@v1 |
| 112 | + with: |
| 113 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments