Skip to content

Cache DNF cache and build CI in master to register shared caches for branches and PR #22

Cache DNF cache and build CI in master to register shared caches for branches and PR

Cache DNF cache and build CI in master to register shared caches for branches and PR #22

Workflow file for this run

---
name: Build
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
build:
name: Build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
name: [ossl3, fips, release]
container: fedora:latest
steps:
- name: Get Date for DNF cache entry
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%V")" >> $GITHUB_OUTPUT
shell: bash
- name: Store DNF cache
uses: actions/cache@v4
with:
path: |
/var/cache/dnf
key: ${{ runner.os }}-dnf-${{ steps.get-date.outputs.date }}
- name: Install Dependencies
run: |
dnf -y install git cargo clang-devel openssl-devel \
'perl(FindBin)' 'perl(lib)' 'perl(File::Compare)' \
'perl(File::Copy)' 'perl(bigint)' 'perl(Time::HiRes)' \
'perl(IPC::Cmd)' 'perl(Pod::Html)' 'perl(Digest::SHA)' \
'perl(Module::Load::Conditional)' 'perl(File::Temp)' \
'perl(Test::Harness)' 'perl(Test::More)' 'perl(Math::BigInt)' \
zlib-devel sed
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup
run: |
git config --global --add safe.directory /__w/kryoptic/kryoptic
git submodule init
git submodule update
- name: Restore OpenSSL build
uses: actions/cache/restore@v4
with:
path: |
openssl/
key: ${{ runner.os }}-ossl-${{ hashFiles('.git/modules/openssl/HEAD') }}
- name: Generate lock file
run: cargo generate-lockfile
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: |
if [ "${{ matrix.name }}" = "fips" ]; then
cargo build -vv --features fips
fi
if [ "${{ matrix.name }}" = "ossl3" ]; then
cargo build -vv
fi
if [ "${{ matrix.name }}" = "release" ]; then
cargo build -vv --release
fi
- name: Test
run: |
if [ "${{ matrix.name }}" = "fips" ]; then
cargo test --features fips
fi
if [ "${{ matrix.name }}" = "ossl3" ]; then
cargo test
fi
if [ "${{ matrix.name }}" = "release" ]; then
cargo test --release
fi
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Build logs ${{ matrix.name }}
path: |
target/debug/build/*/output
- if: ${{ matrix.name == 'fips' }}
name: Cache OpenSSL FIPS build (usable also for default, not vice versa)
uses: actions/cache/save@v4
with:
path: |
openssl/
key: ${{ runner.os }}-ossl-${{ hashFiles('.git/modules/openssl/HEAD') }}