Merge pull request #143 from ANSSI-FR/extract-keep-fd #389
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 & test | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
build: [linux, macos, windows] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
- build: macos | |
os: macos-latest | |
- build: windows | |
os: windows-latest | |
extension: .exe | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Build | |
env: | |
RUSTFLAGS: -D warnings | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --all --exclude mla-fuzz-afl --verbose | |
- name: Run tests | |
run: cargo test --all --exclude mla-fuzz-afl --release --verbose | |
- name: Upload resulting 'mlar' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.build }} | |
path: ./target/release/mlar${{ matrix.extension }} | |
long-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run long tests | |
run: cd mla && cargo test --release -- --ignored | |
all-features: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run long tests | |
run: cargo test --all-features --all --exclude mla-fuzz-afl --exclude mla-bindings-c --release | |
test-bindings-c-cpp-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run C bindings tests on Linux | |
working-directory: bindings/C/tests/linux-gcc-g++/ | |
run: make CC=gcc | |
- name: Run C bindings tests on Linux | |
working-directory: bindings/C/tests/linux-gcc-g++/ | |
run: make CC=g++ | |
test-bindings-c-cpp-windows: | |
strategy: | |
matrix: | |
version: [Debug-c, Release-c, Debug-cpp, Release-cpp] | |
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] | |
include: | |
- version: Debug-c | |
cargo_arg: "" | |
- version: Release-c | |
cargo_arg: --release | |
- version: Debug-cpp | |
cargo_arg: "" | |
- version: Release-cpp | |
cargo_arg: --release | |
- target: i686-pc-windows-msvc | |
msvc_platform: Win32 | |
- target: x86_64-pc-windows-msvc | |
msvc_platform: x64 | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
# Avoid a regression of Cargo, breaking at link time | |
toolchain: 1.69 | |
default: true | |
target: ${{ matrix.target }} | |
- uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Compile C/CPP bindings test program for Windows | |
working-directory: bindings/C/tests/windows-msvc/ | |
run: msbuild mla-bindings-test.sln /p:Platform=${{ matrix.msvc_platform }} /p:Configuration=${{ matrix.version }} | |
- name: Run C/CPP bindings test program on Windows | |
working-directory: bindings/C/tests/windows-msvc/ | |
run: ./${{ matrix.msvc_platform }}/${{ matrix.version }}/mla-bindings-test.exe | |
afl-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install dependencies | |
run: sudo apt-get install llvm | |
- name: Install cargo-afl binary crate | |
uses: actions-rs/install@v0.1 | |
with: | |
crate: cargo-afl | |
version: latest | |
use-tool-cache: true | |
- name: Test AFL build | |
env: | |
RUSTFLAGS: -D warnings | |
run: cargo afl build | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Check format | |
run: cargo fmt --all -- --check | |
audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Security audit | |
uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Install dependencies | |
run: sudo apt-get install llvm | |
- name: Install cargo-afl binary crate | |
uses: actions-rs/install@v0.1 | |
with: | |
crate: cargo-afl | |
version: latest | |
use-tool-cache: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets -- -D warnings |