Check dependency licenses in CIs #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
mode: [ debug , release ] | |
os: [ ubuntu, windows ] | |
include: | |
- mode: debug | |
mode_flag: "" | |
- mode: release | |
mode_flag: "--release" | |
- os: ubuntu | |
exe_suffix: "" | |
sng: /usr/bin/sng | |
- os: windows | |
exe_suffix: .exe | |
sng: C:\tools\cygwin\bin\sng.exe | |
env: | |
SNG: ${{ matrix.sng }} | |
runs-on: ${{ matrix.os }}-latest | |
name: ${{ matrix.os }}-${{ matrix.mode }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry/ | |
key: cargo-${{ matrix.os }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
cargo-${{ matrix.os }}- | |
- name: Build | |
run: cargo build --verbose ${{ matrix.mode_flag }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: png_inflate-${{ matrix.os }}-${{ matrix.mode }}${{ matrix.exe_suffix }} | |
path: target/${{ matrix.mode }}/png_inflate${{ matrix.exe_suffix }} | |
# | |
- name: Install test dependencies (ubuntu) | |
if: ${{ matrix.os == 'ubuntu' }} | |
run: sudo apt-get -yq install sng | |
- name: Install test dependencies (Windows) | |
if: ${{ matrix.os == 'windows' }} | |
shell: pwsh | |
run: | | |
& choco install Cygwin | |
& C:\tools\cygwin\cygwinsetup.exe --no-admin -q -P sng | |
- name: Run tests | |
run: cargo test --verbose ${{matrix.mode_flag}} | |
check_format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set filters | |
run: | | |
git config filter.rustfmt.clean rustfmt | |
git config filter.sort.clean 'LC_ALL=C sort' | |
- name: Apply the filters | |
run: 'git add --renormalize .' | |
- name: Check that the filters dont change the files | |
run: 'git diff --exit-code HEAD' | |
clippy_lint: | |
runs-on: ubuntu-latest | |
env: | |
SNG: 'arbitrary value' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry/ | |
key: cargo-ubuntu-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
cargo-ubuntu- | |
- name: cargo clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
check_licenses: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry/ | |
~/.cargo/bin/cargo-license | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
key: cargo-license-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
cargo-license- | |
cargo-ubuntu- | |
- name: Install cargo-license | |
run: 'cargo install cargo-license' | |
- name: Check licenses | |
run: > | |
cargo license --tsv | | |
awk -f .github/license-acceptable.awk |