-
Notifications
You must be signed in to change notification settings - Fork 57
145 lines (118 loc) · 4.86 KB
/
time-machine.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: time-machine
on:
push:
branches:
- main
- maxirmx-timemachine-2183
workflow_dispatch:
schedule:
- cron: "03 15 * * 6"
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
env:
RNP_LOG_CONSOLE: 1
jobs:
build:
name: ${{ matrix.image.name }} [CC ${{ matrix.env.CC }}; backend ${{ matrix.image.backend }}; date offset ${{ matrix.date-offset }}]
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
env:
- { CC: clang, CXX: clang++ }
# Pls refer to https://github.com/rnpgp/rnp-ci-containers#readme for image details
image:
- { name: 'Fedora 36', container: 'fedora-36-amd64', backend: 'Botan' }
- { name: 'Fedora 36', container: 'fedora-36-amd64', backend: 'OpenSSL' }
container: ghcr.io/rnpgp/ci-rnp-${{ matrix.image.container }}
env: ${{ matrix.env }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup environment
run: |
set -o errexit -o pipefail -o noclobber -o nounset
/opt/tools/tools.sh select_crypto_backend_for_gha ${{ matrix.image.backend }}
/opt/tools/tools.sh select_gpg_version_for_gha 'system'
/opt/tools/tools.sh select_botan_version_for_gha 'system'
echo CORES="$(nproc --all)" >> $GITHUB_ENV
useradd rnpuser
printf "\nrnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser
printf "\nrnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf
- name: Configure
run: |
cmake -B build \
-DBUILD_SHARED_LIBS=ON \
-DDOWNLOAD_GTEST=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCRYPTO_BACKEND=${{ matrix.image.backend }}
- name: Build
run: cmake --build build --parallel ${{ env.CORES }}
- name: Archive build files
run: tar -czvf build.tar.gz build
- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: 'build-${{ matrix.env.CC }}-${{ matrix.image.backend }}'
path: 'build.tar.gz'
retention-days: 5
test:
name: ${{ matrix.image.name }} [CC ${{ matrix.env.CC }}; backend ${{ matrix.image.backend }}; date offset ${{ matrix.date-offset }}]
runs-on: ubuntu-latest
needs: build
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
env:
- { CC: clang, CXX: clang++ }
# Pls refer to https://github.com/rnpgp/rnp-ci-containers#readme for image details
image:
- { name: 'Fedora 36', container: 'fedora-36-amd64', backend: 'Botan' }
- { name: 'Fedora 36', container: 'fedora-36-amd64', backend: 'OpenSSL' }
date-offset:
- '0 years'
- '1 year'
- '5 years'
container: ghcr.io/rnpgp/ci-rnp-${{ matrix.image.container }}
env: ${{ matrix.env }}
steps:
- name: Install tools
run: dnf -y install libfaketime
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup environment
run: |
set -o errexit -o pipefail -o noclobber -o nounset
/opt/tools/tools.sh select_crypto_backend_for_gha ${{ matrix.image.backend }}
/opt/tools/tools.sh select_gpg_version_for_gha 'system'
/opt/tools/tools.sh select_botan_version_for_gha 'system'
echo CORES="$(nproc --all)" >> $GITHUB_ENV
useradd rnpuser
printf "\nrnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser
printf "\nrnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf
- name: Download build files
uses: actions/download-artifact@v3
with:
name: 'build-${{ matrix.env.CC }}-${{ matrix.image.backend }}'
path: 'build.tar.gz'
- name: Extract build files
run: tar -xzvf build.tar.gz
- name: Test
run: |
set -o errexit -o pipefail -o noclobber -o nounset
adjusted_date=$(date -d '${{ matrix.date-offset }}' '+%Y-%m-%d')
export FAKETIME="@$adjusted_date 00:00:00"
test_adjusted_date=$(LD_PRELOAD=/usr/lib64/faketime/libfaketime.so.1 date '+%Y-%m-%d')
echo Running tests for "$test_adjusted_date"
mkdir -p "build/Testing/Temporary"
cp "cmake/CTestCostData.txt" "build/Testing/Temporary"
export PATH="$PWD/build/src/lib:$PATH"
chown -R rnpuser:rnpuser $PWD
exec su rnpuser -c "LD_PRELOAD=/usr/lib64/faketime/libfaketime.so.1 ctest --parallel ${{ env.CORES }} --test-dir build --output-on-failure"