|
| 1 | +name: Develop PR |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ "main" ] |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + |
| 10 | +jobs: |
| 11 | + style: |
| 12 | + name: Check Style |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v1 |
| 17 | + - name: Install rust |
| 18 | + uses: actions-rs/toolchain@v1 |
| 19 | + with: |
| 20 | + toolchain: stable |
| 21 | + components: rustfmt |
| 22 | + profile: minimal |
| 23 | + override: true |
| 24 | + - name: cargo fmt -- --check |
| 25 | + uses: actions-rs/cargo@v1 |
| 26 | + with: |
| 27 | + command: fmt |
| 28 | + args: --all -- --check |
| 29 | + |
| 30 | + |
| 31 | + test: |
| 32 | + name: Test |
| 33 | + if: always() |
| 34 | + runs-on: ubuntu-latest |
| 35 | + |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + build: [ stable, beta, nightly ] |
| 39 | + include: |
| 40 | + - build: beta |
| 41 | + rust: beta |
| 42 | + - build: nightly |
| 43 | + rust: nightly |
| 44 | + benches: true |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v1 |
| 49 | + |
| 50 | + - name: Install rust |
| 51 | + uses: actions-rs/toolchain@v1 |
| 52 | + with: |
| 53 | + toolchain: ${{ matrix.rust || 'stable' }} |
| 54 | + profile: minimal |
| 55 | + override: true |
| 56 | + |
| 57 | + - name: Build debug |
| 58 | + uses: actions-rs/cargo@v1 |
| 59 | + with: |
| 60 | + command: build |
| 61 | + args: ${{ matrix.features }} |
| 62 | + |
| 63 | + - name: Test |
| 64 | + uses: actions-rs/cargo@v1 |
| 65 | + with: |
| 66 | + command: test |
| 67 | + args: ${{ matrix.features }} |
| 68 | + |
| 69 | + - name: Test all benches |
| 70 | + if: matrix.benches |
| 71 | + uses: actions-rs/cargo@v1 |
| 72 | + with: |
| 73 | + command: test |
| 74 | + args: --benches ${{ matrix.features }} |
| 75 | + |
| 76 | + deploy_building: |
| 77 | + name: Deploy Building |
| 78 | + needs: [ test ] |
| 79 | + strategy: |
| 80 | + matrix: |
| 81 | + os: [ ubuntu-latest ] # Default os for build |
| 82 | + target: [ aarch64-unknown-linux-gnu, |
| 83 | + i686-pc-windows-gnu, x86_64-pc-windows-gnu, |
| 84 | + i686-unknown-linux-gnu, x86_64-unknown-linux-gnu ] |
| 85 | + |
| 86 | + include: # List of all targets to build for and the name for common people |
| 87 | + - target: aarch64-unknown-linux-gnu |
| 88 | + name: linux-arm64 |
| 89 | + - target: i686-pc-windows-gnu |
| 90 | + name: windows-i686 |
| 91 | + - target: x86_64-pc-windows-gnu |
| 92 | + name: windows-x86_64 |
| 93 | + - target: i686-unknown-linux-gnu |
| 94 | + name: linux-i686 |
| 95 | + - target: x86_64-unknown-linux-gnu |
| 96 | + name: linux-x86_64 |
| 97 | + |
| 98 | + runs-on: ${{ matrix.os }} |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Checkout |
| 102 | + uses: actions/checkout@v1 |
| 103 | + |
| 104 | + - name: Install rust |
| 105 | + uses: actions-rs/toolchain@v1 |
| 106 | + with: |
| 107 | + toolchain: stable |
| 108 | + profile: minimal |
| 109 | + override: true |
| 110 | + target: ${{ matrix.target }} |
| 111 | + |
| 112 | + - name: Build release |
| 113 | + run: | |
| 114 | + RUSTFLAGS="-Awarnings" cargo install cross --git https://github.com/cross-rs/cross --quiet |
| 115 | + cross build --release --target ${{ matrix.target }} |
0 commit comments