|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ '*' ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 18 | + rust: [nightly, stable, '1.70'] |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + continue-on-error: ${{ matrix.rust == 'nightly' }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Restore cargo cache |
| 26 | + uses: actions/cache@v2 |
| 27 | + env: |
| 28 | + cache-name: ci |
| 29 | + with: |
| 30 | + path: | |
| 31 | + ~/.cargo/registry |
| 32 | + ~/.cargo/git |
| 33 | + ~/.cargo/bin |
| 34 | + target |
| 35 | + key: ${{ matrix.os }}-${{ env.cache-name }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }} |
| 36 | + |
| 37 | + - name: MacOS Workaround |
| 38 | + if: matrix.os == 'macos-latest' |
| 39 | + run: cargo clean -p serde_derive -p thiserror |
| 40 | + |
| 41 | + - name: Install Rust |
| 42 | + uses: actions-rs/toolchain@v1 |
| 43 | + with: |
| 44 | + toolchain: ${{ matrix.rust }} |
| 45 | + default: true |
| 46 | + override: true |
| 47 | + profile: minimal |
| 48 | + components: clippy |
| 49 | + |
| 50 | + - name: Build Debug |
| 51 | + run: | |
| 52 | + cargo build |
| 53 | +
|
| 54 | + - name: Run tests |
| 55 | + run: cargo test |
| 56 | + |
| 57 | + - name: Run clippy |
| 58 | + run: | |
| 59 | + cargo clippy --workspace --all-features |
| 60 | +
|
| 61 | + - name: Build Release |
| 62 | + run: cargo build --release |
| 63 | + |
| 64 | + - name: Test Install |
| 65 | + run: cargo install --path "." --force |
| 66 | + |
| 67 | + - name: Binary Size (unix) |
| 68 | + if: matrix.os != 'windows-latest' |
| 69 | + run: | |
| 70 | + ls -l ./target/release/leetui |
| 71 | +
|
| 72 | + - name: Binary Size (win) |
| 73 | + if: matrix.os == 'windows-latest' |
| 74 | + run: | |
| 75 | + ls -l ./target/release/leetui.exe |
| 76 | +
|
| 77 | + - name: Binary dependencies (mac) |
| 78 | + if: matrix.os == 'macos-latest' |
| 79 | + run: | |
| 80 | + otool -L ./target/release/leetui |
| 81 | +
|
| 82 | + - name: Build MSI (windows) |
| 83 | + if: matrix.os == 'windows-latest' |
| 84 | + run: | |
| 85 | + cargo install cargo-wix --version 0.3.3 |
| 86 | + cargo wix --version |
| 87 | + cargo wix -p leetui --no-build --nocapture --output ./target/wix/leetui.msi |
| 88 | + ls -l ./target/wix/leetui.msi |
| 89 | +
|
| 90 | + build-linux-musl: |
| 91 | + runs-on: ubuntu-latest |
| 92 | + strategy: |
| 93 | + fail-fast: false |
| 94 | + matrix: |
| 95 | + rust: [nightly, stable, '1.70'] |
| 96 | + continue-on-error: ${{ matrix.rust == 'nightly' }} |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@master |
| 99 | + - name: Install Rust |
| 100 | + uses: actions-rs/toolchain@v1 |
| 101 | + with: |
| 102 | + toolchain: ${{ matrix.rust }} |
| 103 | + profile: minimal |
| 104 | + default: true |
| 105 | + override: true |
| 106 | + target: x86_64-unknown-linux-musl |
| 107 | + |
| 108 | + - name: Setup MUSL |
| 109 | + run: | |
| 110 | + sudo apt-get -qq install musl-tools && sudo apt-get -y install libssl-dev && sudo apt-get -y install pkg-config |
| 111 | + - name: Build Debug |
| 112 | + run: | |
| 113 | + cargo build --target=x86_64-unknown-linux-musl |
| 114 | + ./target/x86_64-unknown-linux-musl/debug/leetui --version |
| 115 | + - name: Build Release |
| 116 | + run: | |
| 117 | + cargo build --release --target=x86_64-unknown-linux-musl |
| 118 | + ./target/x86_64-unknown-linux-musl/release/leetui --version |
| 119 | + ls -l ./target/x86_64-unknown-linux-musl/release/leetui |
| 120 | + - name: Test |
| 121 | + run: | |
| 122 | + cargo test --workspace --target=x86_64-unknown-linux-musl |
| 123 | + - name: Test Install |
| 124 | + run: cargo install --path "." --force |
| 125 | + |
| 126 | + linting: |
| 127 | + name: Lints |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@master |
| 131 | + - name: Install Rust |
| 132 | + uses: actions-rs/toolchain@v1 |
| 133 | + with: |
| 134 | + toolchain: stable |
| 135 | + override: true |
| 136 | + components: rustfmt |
| 137 | + |
| 138 | + - run: cargo fmt -- --check |
| 139 | + |
| 140 | + - name: cargo-sort |
| 141 | + run: | |
| 142 | + cargo install cargo-sort --force |
| 143 | + cargo sort -c -w |
| 144 | +
|
| 145 | + - name: cargo-deny install |
| 146 | + run: | |
| 147 | + cargo install --locked cargo-deny |
| 148 | +
|
| 149 | + # - name: cargo-deny licenses |
| 150 | + # run: | |
| 151 | + # cargo deny check licenses |
| 152 | + |
| 153 | + - name: cargo-deny bans |
| 154 | + run: | |
| 155 | + cargo deny check bans |
| 156 | +
|
| 157 | + udeps: |
| 158 | + name: udeps |
| 159 | + runs-on: ubuntu-latest |
| 160 | + steps: |
| 161 | + - uses: actions/checkout@master |
| 162 | + - name: Install Rust |
| 163 | + uses: actions-rs/toolchain@v1 |
| 164 | + with: |
| 165 | + toolchain: nightly |
| 166 | + override: true |
| 167 | + |
| 168 | + - name: cargo-udeps |
| 169 | + run: | |
| 170 | + # cargo install --locked cargo-udeps |
| 171 | + cargo install --git https://github.com/est31/cargo-udeps --locked |
| 172 | + cargo +nightly udeps --all-targets |
| 173 | +
|
| 174 | +
|
| 175 | + # sec: |
| 176 | + # name: Security audit |
| 177 | + # runs-on: ubuntu-latest |
| 178 | + # steps: |
| 179 | + # - uses: actions/checkout@v2 |
| 180 | + # - uses: actions-rs/audit-check@v1 |
| 181 | + # with: |
| 182 | + # token: ${{ secrets.GITHUB_TOKEN }} |
| 183 | + |
| 184 | + # log-test: |
| 185 | + # name: Changelog Test |
| 186 | + # runs-on: ubuntu-latest |
| 187 | + # steps: |
| 188 | + # - uses: actions/checkout@master |
| 189 | + # - name: Extract release notes |
| 190 | + # id: extract_release_notes |
| 191 | + # uses: ffurrer2/extract-release-notes@v1 |
| 192 | + # with: |
| 193 | + # release_notes_file: ./release-notes.txt |
| 194 | + # - uses: actions/upload-artifact@v1 |
| 195 | + # with: |
| 196 | + # name: release-notes.txt |
| 197 | + # path: ./release-notes.txt |
0 commit comments