Upload build artifacts for each PR #582
Workflow file for this run
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: Rust CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
check-formatting-linting: | |
permissions: | |
contents: read | |
checks: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Fetch dependencies | |
run: cargo fetch --locked | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --frozen --all-targets -p nethsm_pkcs11 -- -D warnings --no-deps | |
check-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable-x86_64-pc-windows-msvc | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build project | |
run: cargo build --release | |
- name: Archive Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nethsm-pkcs11-x86_64-windows.dll | |
path: target/release/nethsm_pkcs11.dll | |
if-no-files-found: error | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable-x86_64-apple-darwin | |
target: aarch64-apple-darwin | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build project for MacOs x86_64 | |
run: cargo build | |
- name: Build project MacOs aaarch64 | |
run: cargo build --target aarch64-apple-darwin | |
- name: Archive Artifact x86_64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nethsm-pkcs11-x86_64-apple.dylib | |
path: target/release/libnethsm_pkcs11.dylib | |
if-no-files-found: error | |
- name: Archive Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nethsm-pkcs11-aarch64-apple.dylib | |
path: target/aarch64-apple-darwin/release/libnethsm_pkcs11.dylib | |
if-no-files-found: error | |
tests: | |
runs-on: ubuntu-latest | |
container: debian:12 | |
env: | |
RUST_BACKTRACE: full | |
RUST_LOG: trace | |
services: | |
nethsm: | |
image: nitrokey/nethsm:testing | |
ports: | |
- 8443:8443 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install opensc and dependencies | |
run: apt-get update && apt-get install -y curl opensc openssl gcc xxd jq gnutls-bin make | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy, llvm-tools-preview | |
- uses: Swatinem/rust-cache@v2 | |
- name: install demangler | |
run: cargo install rustfilt | |
- name: Build with profiling | |
run: ./tools/build_profiling.sh | |
- name: repalce localhost with nethsm | |
run: sed -i 's/localhost/nethsm/g' ./tools/*.sh ./tools/tests/*.sh ./p11nethsm.conf ./tools/*.conf | |
- name: setup NetHSM | |
run: ./tools/ci_setup.sh | |
- name: cargo test | |
run: ./tools/test_profiling.sh | |
- name: Run integration tests | |
run: ./tools/ci_integration_tests.sh | |
- name: get coverage | |
run: ./tools/get_coverage.sh | |
- name: upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.txt | |
verbose: true | |
- name: build release | |
run: cargo build --release | |
- name: run fork tests | |
run: cd fork-tests && make | |
- name: Archive Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nethsm-pkcs11-x86_64-linux-gnu.so | |
path: target/release/libnethsm_pkcs11.so | |
if-no-files-found: error | |
test_network: | |
runs-on: ubuntu-latest | |
env: | |
RUST_BACKTRACE: full | |
RUST_LOG: trace | |
USE_SUDO_IPTABLES: true | |
services: | |
nethsm: | |
image: nitrokey/nethsm:testing | |
ports: | |
- 8443:8443 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install opensc and dependencies | |
run: sudo apt-get update && sudo apt-get install -y curl opensc openssl gcc xxd jq gnutls-bin make | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy, llvm-tools-preview | |
- name: pull docker image | |
run: docker pull nitrokey/nethsm:testing | |
- uses: Swatinem/rust-cache@v2 | |
- name: build release | |
run: cargo build --release | |
- name: run network tests | |
run: cargo t --features pkcs11-full-tests -p nethsm_pkcs11 --test basic -- --nocapture |