|
1 | | -name: scry pipeline |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: master |
| 1 | +on: [push, pull_request] |
6 | 2 |
|
7 | | -env: |
8 | | - CARGO_TERM_COLOR: always |
| 3 | +name: scry pipeline |
9 | 4 |
|
10 | 5 | jobs: |
11 | | - build: |
| 6 | + check: |
| 7 | + name: Check |
12 | 8 | runs-on: ubuntu-latest |
13 | | - |
14 | 9 | steps: |
15 | | - |
16 | 10 | - uses: actions/checkout@v2 |
17 | | - |
18 | | - - uses: actions/cache@v2 |
| 11 | + - uses: actions-rs/toolchain@v1 |
| 12 | + with: |
| 13 | + profile: minimal |
| 14 | + toolchain: stable |
| 15 | + override: true |
| 16 | + - uses: actions-rs/cargo@v1 |
19 | 17 | with: |
20 | | - path: | |
21 | | - ~/.cargo/registry |
22 | | - ~/.cargo/git |
23 | | - target |
24 | | - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 18 | + command: check |
25 | 19 |
|
| 20 | + test: |
| 21 | + name: Test Suite |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v2 |
26 | 25 | - uses: actions-rs/toolchain@v1 |
27 | 26 | with: |
| 27 | + profile: minimal |
28 | 28 | toolchain: stable |
| 29 | + override: true |
| 30 | + - uses: actions-rs/cargo@v1 |
| 31 | + with: |
| 32 | + command: test |
29 | 33 |
|
30 | | - - name: Check style |
31 | | - run: cargo fmt --all -- --check |
| 34 | + fmt: |
| 35 | + name: Rustfmt |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + - uses: actions-rs/toolchain@v1 |
| 40 | + with: |
| 41 | + profile: minimal |
| 42 | + toolchain: stable |
| 43 | + override: true |
| 44 | + - run: rustup component add rustfmt |
| 45 | + - uses: actions-rs/cargo@v1 |
| 46 | + with: |
| 47 | + command: fmt |
| 48 | + args: --all -- --check |
32 | 49 |
|
33 | | - - name: Lint |
34 | | - run: cargo clippy --all-targets -- -D clippy::all |
| 50 | + clippy: |
| 51 | + name: Clippy |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + - uses: actions-rs/toolchain@v1 |
| 56 | + with: |
| 57 | + profile: minimal |
| 58 | + toolchain: stable |
| 59 | + override: true |
| 60 | + - run: rustup component add clippy |
| 61 | + - uses: actions-rs/cargo@v1 |
| 62 | + with: |
| 63 | + command: clippy |
| 64 | + args: -- -D warnings |
35 | 65 |
|
36 | | - - name: Run tests |
37 | | - run: cargo test |
38 | 66 |
|
39 | | - - name: Build |
40 | | - run: cargo build --release |
| 67 | + release-linux: |
| 68 | + if: startsWith(github.ref, 'refs/tags/') |
| 69 | + needs: [check, test, fmt, clippy] |
| 70 | + name: Release Build |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v2 |
| 74 | + - uses: actions-rs/toolchain@v1 |
| 75 | + with: |
| 76 | + profile: minimal |
| 77 | + toolchain: stable |
| 78 | + override: true |
| 79 | + - uses: actions-rs/cargo@v1 |
| 80 | + with: |
| 81 | + command: test |
| 82 | + args: --release |
| 83 | + - uses: actions-rs/cargo@v1 |
| 84 | + with: |
| 85 | + command: build |
| 86 | + args: --all --release |
| 87 | + - run: strip target/release/scry && mv target/release/scry target/release/scry_amd64 |
| 88 | + - uses: softprops/action-gh-release@v1 |
| 89 | + with: |
| 90 | + files: | |
| 91 | + target/release/scry_amd64 |
| 92 | + env: |
| 93 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments