|
8 | 8 | - 'LICENSE*'
|
9 | 9 | workflow_dispatch:
|
10 | 10 |
|
| 11 | +env: |
| 12 | + CARGO_BIN_NAME: objdiff |
| 13 | + CARGO_TARGET_DIR: target |
| 14 | + |
11 | 15 | jobs:
|
12 | 16 | check:
|
13 | 17 | name: Check
|
14 | 18 | runs-on: ubuntu-latest
|
15 |
| - strategy: |
16 |
| - matrix: |
17 |
| - toolchain: [ stable, 1.62.0, nightly ] |
18 |
| - fail-fast: false |
19 | 19 | env:
|
20 | 20 | RUSTFLAGS: -D warnings
|
21 | 21 | steps:
|
22 | 22 | - name: Install dependencies
|
23 |
| - run: | |
24 |
| - sudo apt install libgtk-3-dev |
25 |
| - - uses: actions/checkout@v2 |
26 |
| - - uses: actions-rs/toolchain@v1 |
| 23 | + run: sudo apt-get -y install libgtk-3-dev |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v3 |
| 26 | + - name: Setup Rust toolchain |
| 27 | + uses: dtolnay/rust-toolchain@stable |
27 | 28 | with:
|
28 |
| - profile: minimal |
29 |
| - toolchain: ${{ matrix.toolchain }} |
30 |
| - override: true |
31 | 29 | components: rustfmt, clippy
|
| 30 | + - name: Cargo check |
| 31 | + run: cargo check --all-features |
| 32 | + - name: Cargo clippy |
| 33 | + run: cargo clippy --all-features |
| 34 | + |
| 35 | + deny: |
| 36 | + name: Deny |
| 37 | + runs-on: ubuntu-latest |
| 38 | + strategy: |
| 39 | + matrix: |
| 40 | + checks: |
| 41 | + - advisories |
| 42 | + - bans licenses sources |
| 43 | + # Prevent new advisories from failing CI |
| 44 | + continue-on-error: ${{ matrix.checks == 'advisories' }} |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v3 |
32 | 47 | - uses: EmbarkStudios/cargo-deny-action@v1
|
33 |
| - - uses: actions-rs/cargo@v1 |
34 |
| - with: |
35 |
| - command: check |
36 |
| - args: --all-features |
37 |
| - - uses: actions-rs/cargo@v1 |
38 | 48 | with:
|
39 |
| - command: clippy |
40 |
| - args: --all-features |
| 49 | + command: check ${{ matrix.checks }} |
| 50 | + |
| 51 | + test: |
| 52 | + name: Test |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + platform: [ ubuntu-latest, windows-latest, macos-latest ] |
| 56 | + fail-fast: false |
| 57 | + runs-on: ${{ matrix.platform }} |
| 58 | + steps: |
| 59 | + - name: Install dependencies |
| 60 | + if: matrix.platform == 'ubuntu-latest' |
| 61 | + run: sudo apt-get -y install libgtk-3-dev |
| 62 | + - name: Checkout |
| 63 | + uses: actions/checkout@v3 |
| 64 | + - name: Setup Rust toolchain |
| 65 | + uses: dtolnay/rust-toolchain@stable |
| 66 | + - name: Cargo test |
| 67 | + run: cargo test --release --all-features |
41 | 68 |
|
42 | 69 | build:
|
43 | 70 | name: Build
|
44 | 71 | strategy:
|
45 | 72 | matrix:
|
46 |
| - platform: [ ubuntu-latest, macos-latest, windows-latest ] |
47 |
| - toolchain: [ stable, 1.62.0, nightly ] |
| 73 | + include: |
| 74 | + - platform: ubuntu-latest |
| 75 | + target: x86_64-unknown-linux-gnu |
| 76 | + name: linux-x86_64 |
| 77 | + packages: libgtk-3-dev |
| 78 | + - platform: windows-latest |
| 79 | + target: x86_64-pc-windows-msvc |
| 80 | + name: windows-x86_64 |
| 81 | + - platform: macos-latest |
| 82 | + target: x86_64-apple-darwin |
| 83 | + name: macos-x86_64 |
| 84 | + - platform: macos-latest |
| 85 | + target: aarch64-apple-darwin |
| 86 | + name: macos-arm64 |
48 | 87 | fail-fast: false
|
49 | 88 | runs-on: ${{ matrix.platform }}
|
50 | 89 | steps:
|
51 | 90 | - name: Install dependencies
|
52 |
| - if: matrix.platform == 'ubuntu-latest' |
53 |
| - run: | |
54 |
| - sudo apt install libgtk-3-dev |
55 |
| - - uses: actions/checkout@v2 |
56 |
| - - uses: actions-rs/toolchain@v1 |
| 91 | + if: matrix.packages != '' |
| 92 | + run: sudo apt-get -y install ${{ matrix.packages }} |
| 93 | + - name: Checkout |
| 94 | + uses: actions/checkout@v3 |
| 95 | + - name: Setup Rust toolchain |
| 96 | + uses: dtolnay/rust-toolchain@stable |
57 | 97 | with:
|
58 |
| - profile: minimal |
59 |
| - toolchain: ${{ matrix.toolchain }} |
60 |
| - override: true |
61 |
| - - uses: actions-rs/cargo@v1 |
| 98 | + targets: ${{ matrix.target }} |
| 99 | + - name: Cargo build |
| 100 | + run: cargo build --release --all-features --target ${{ matrix.target }} --bin ${{ env.CARGO_BIN_NAME }} |
| 101 | + - name: Upload artifacts |
| 102 | + uses: actions/upload-artifact@v3 |
62 | 103 | with:
|
63 |
| - command: test |
64 |
| - args: --release --all-features |
65 |
| - - uses: actions-rs/cargo@v1 |
| 104 | + name: ${{ matrix.name }} |
| 105 | + path: | |
| 106 | + ${{ env.CARGO_TARGET_DIR }}/release/${{ env.CARGO_BIN_NAME }} |
| 107 | + ${{ env.CARGO_TARGET_DIR }}/release/${{ env.CARGO_BIN_NAME }}.exe |
| 108 | + ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/release/${{ env.CARGO_BIN_NAME }} |
| 109 | + ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/release/${{ env.CARGO_BIN_NAME }}.exe |
| 110 | + if-no-files-found: error |
| 111 | + |
| 112 | + release: |
| 113 | + name: Release |
| 114 | + if: startsWith(github.ref, 'refs/tags/') |
| 115 | + runs-on: ubuntu-latest |
| 116 | + needs: [ build ] |
| 117 | + steps: |
| 118 | + - name: Download artifacts |
| 119 | + uses: actions/download-artifact@v3 |
66 | 120 | with:
|
67 |
| - command: build |
68 |
| - args: --release --all-features |
69 |
| - - uses: actions/upload-artifact@v2 |
| 121 | + path: artifacts |
| 122 | + - name: Rename artifacts |
| 123 | + working-directory: artifacts |
| 124 | + run: | |
| 125 | + mkdir ../out |
| 126 | + for i in */*/release/$CARGO_BIN_NAME*; do |
| 127 | + mv "$i" "../out/$(sed -E "s/([^/]+)\/[^/]+\/release\/($CARGO_BIN_NAME)/\2-\1/" <<< "$i")" |
| 128 | + done |
| 129 | + ls -R ../out |
| 130 | + - name: Release |
| 131 | + uses: softprops/action-gh-release@v1 |
70 | 132 | with:
|
71 |
| - name: ${{ matrix.platform }}-${{ matrix.toolchain }} |
72 |
| - path: | |
73 |
| - target/release/objdiff |
74 |
| - target/release/objdiff.exe |
| 133 | + files: out/* |
0 commit comments