Skip to content

Support no_std

Support no_std #142

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, beta, nightly]
feature: [openssl, pure, xchacha20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
target: wasm32-unknown-unknown
components: rustfmt, clippy
# cargo
- uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
# install openssl on Windows
- run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
if: matrix.os == 'windows-latest'
- run: New-Item -ItemType "directory" -Path "C:\vcpkg\downloads" -Force
if: matrix.os == 'windows-latest'
- run: Invoke-WebRequest -URI "$env:BASE_URL/$env:FILE_NAME" -OutFile "C:\vcpkg\downloads\$env:FILE_NAME"
env:
BASE_URL: https://github.com/microsoft/vcpkg/files/12073957
FILE_NAME: nasm-2.16.01-win64.zip
if: matrix.os == 'windows-latest'
- run: vcpkg install openssl:x64-windows-static-md
if: matrix.os == 'windows-latest'
- name: Check and run lint
run: cargo check && cargo fmt && cargo clippy
- name: Run tests
run: cargo test --no-default-features --features ${{ matrix.feature }}
- name: Run tests with std
run: cargo test --no-default-features --features ${{ matrix.feature }},std
- name: Run tests with 12 bytes nonce
run: cargo test --no-default-features --features ${{ matrix.feature }},aes-12bytes-nonce
if: matrix.feature != 'xchacha20'
- name: Run tests with std and 12 bytes nonce
run: cargo test --no-default-features --features ${{ matrix.feature }},std,aes-12bytes-nonce
if: matrix.feature != 'xchacha20'
- name: Install wasm dep
run: cargo install wasm-bindgen-cli || true
- name: Run tests on wasm target
run: cargo test --no-default-features --features ${{ matrix.feature }} --target=wasm32-unknown-unknown
if: matrix.feature != 'openssl'
- name: Check cargo package
run: cargo publish --dry-run
if: matrix.os != 'windows-latest'