-
Notifications
You must be signed in to change notification settings - Fork 5
117 lines (103 loc) · 3.65 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
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, dynamic, i686, minimal]
db: [jsondb, sqlitedb, nssdb] # FIXME: Add "memorydb" when it will be persistent
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 sqlite-devel
if [ "${{ matrix.name }}" = "i686" ]; then
dnf -y install rust-std-static.i686 openssl-devel.i686 \
sqlite-devel.i686
fi
- name: Checkout Repository
uses: actions/checkout@v4
- 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
id: cache
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 & test
run: |
FEATURES="${{ matrix.db }}"
OPTS=""
if [ "${{ matrix.name }}" = "fips" ]; then
FEATURES="${FEATURES},fips"
elif [ "${{ matrix.name }}" = "ossl3" ]; then
FEATURES="${FEATURES},standard"
elif [ "${{ matrix.name }}" = "release" ]; then
FEATURES="${FEATURES},standard"
OPTS="--release"
elif [ "${{ matrix.name }}" = "dynamic" ]; then
FEATURES="${FEATURES},standard,dynamic"
OPTS="--release"
elif [ "${{ matrix.name }}" = "i686" ]; then
FEATURES="${FEATURES},standard,dynamic"
OPTS="--target i686-unknown-linux-gnu"
elif [ "${{ matrix.name }}" = "minimal" ]; then
OPTS="--no-default-features"
fi
cargo build -vv $OPTS --features "$FEATURES"
cargo test -vv $OPTS --features "$FEATURES"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Build logs ${{ matrix.name }}
path: |
target/debug/build/*/output
- if: ${{ matrix.name == 'fips' && steps.cache.outputs.cache-hit != 'true' }}
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') }}