Skip to content

Commit a1d84c2

Browse files
committed
Add simple tests
1 parent e3569ea commit a1d84c2

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/workflows/tests.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build & test
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
permissions:
8+
contents: read # to fetch code (actions/checkout)
9+
10+
jobs:
11+
build:
12+
name: CI with software token
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
name: [fedora, centos10] #, debian, ubuntu
18+
include:
19+
- name: fedora
20+
container: fedora:latest
21+
#- name: ubuntu
22+
# container: ubuntu:latest
23+
#- name: debian
24+
# container: debian:sid
25+
- name: centos10
26+
container: quay.io/centos/centos:stream10
27+
container: ${{ matrix.container }}
28+
steps:
29+
- name: Install Dependencies
30+
run: |
31+
if [ "${{ matrix.name }}" = "centos10" ]; then
32+
dnf_opts="--enablerepo=crb"
33+
fi
34+
if [ -f /etc/redhat-release ]; then
35+
yes | dnf copr enable jjelen/vsmartcard
36+
dnf -y install $dnf_opts \
37+
git gcc pcsc-lite-devel autoconf automake libtool libcacard-devel \
38+
opensc softhsm gnutls-utils nss-tools virtualsmartcard libcacard
39+
elif [ -f /etc/debian_version ]; then
40+
apt-get -q update
41+
apt-get -yq install git gcc build-essential \
42+
softhsm2 opensc gnutls-bin libnss3-tools
43+
fi
44+
45+
- name: Checkout Repository
46+
uses: actions/checkout@v4
47+
48+
- name: Build and install
49+
run: |
50+
./autogen.sh
51+
./configure
52+
make
53+
make install
54+
55+
- name: Test
56+
run: ./tests.sh
57+
58+
59+

tests.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -ex -o xtrace
4+
5+
mkdir t1
6+
pushd t1
7+
./../setup-softhsm2.sh
8+
export SOFTHSM2_CONF=$PWD/softhsm2.conf
9+
virt_cacard 2>&1 | sed -e 's/^/virt_cacard1: /;' &
10+
PID1=$!
11+
popd
12+
13+
mkdir t2
14+
pushd t2
15+
./../setup-softhsm2.sh
16+
export SOFTHSM2_CONF=$PWD/softhsm2.conf
17+
virt_cacard 2>&1 | sed -e 's/^/virt_cacard2: /;' &
18+
PID2=$!
19+
popd
20+
21+
# run the tests
22+
pkcs11-tool -L
23+
24+
kill -9 $PID1
25+
kill -9 $PID2
26+

0 commit comments

Comments
 (0)