|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - master |
| 11 | + release: |
| 12 | + types: [ created ] |
| 13 | + |
| 14 | +jobs: |
| 15 | + check: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout sources |
| 19 | + uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - name: Install stable toolchain |
| 22 | + uses: actions-rs/toolchain@v1 |
| 23 | + with: |
| 24 | + profile: minimal |
| 25 | + toolchain: stable |
| 26 | + override: true |
| 27 | + |
| 28 | + - name: Run cargo check |
| 29 | + uses: actions-rs/cargo@v1 |
| 30 | + with: |
| 31 | + command: check |
| 32 | + |
| 33 | + test: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Checkout sources |
| 37 | + uses: actions/checkout@v2 |
| 38 | + |
| 39 | + - name: Install stable toolchain |
| 40 | + uses: actions-rs/toolchain@v1 |
| 41 | + with: |
| 42 | + profile: minimal |
| 43 | + toolchain: stable |
| 44 | + override: true |
| 45 | + |
| 46 | + - name: Run cargo test |
| 47 | + uses: actions-rs/cargo@v1 |
| 48 | + with: |
| 49 | + command: test |
| 50 | + |
| 51 | + lints: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Checkout sources |
| 55 | + uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - name: Install stable toolchain |
| 58 | + uses: actions-rs/toolchain@v1 |
| 59 | + with: |
| 60 | + profile: minimal |
| 61 | + toolchain: stable |
| 62 | + override: true |
| 63 | + components: rustfmt, clippy |
| 64 | + |
| 65 | + - name: Run cargo fmt |
| 66 | + uses: actions-rs/cargo@v1 |
| 67 | + with: |
| 68 | + command: fmt |
| 69 | + args: --all -- --check |
| 70 | + |
| 71 | + - name: Run cargo clippy |
| 72 | + uses: actions-rs/cargo@v1 |
| 73 | + with: |
| 74 | + command: clippy |
| 75 | + |
| 76 | + release: |
| 77 | + needs: [check, test, lints] |
| 78 | + if: github.event_name == 'release' |
| 79 | + runs-on: ubuntu-latest |
| 80 | + strategy: |
| 81 | + fail-fast: false |
| 82 | + matrix: |
| 83 | + target: [ x86_64-pc-windows-gnu, x86_64-unknown-linux-musl ] |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@v2 |
| 87 | + - name: Compile and release |
| 88 | + uses: rust-build/rust-build.action@v1.2.1 |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + RUSTTARGET: ${{ matrix.target }} |
| 92 | + EXTRA_FILES: "README.md LICENSE" |
0 commit comments