-
-
Notifications
You must be signed in to change notification settings - Fork 42
144 lines (125 loc) · 3.91 KB
/
ci.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
name: CI
on:
# permit manual invocation of the workflow via the GitHub Actions web UI
workflow_dispatch:
# run the tests for any direct push to main
push:
branches: ['main']
paths-ignore:
- '.dockerignore'
- '.github/workflow/e2e.yml'
- '.github/workflow/pkg.yml'
- '.github/workflow/e2e test cache rebuild.yml'
- 'Changelog.md'
- 'Dockerfile'
- 'doc/**'
- 'docker/**'
- 'LICENSE'
- 'README.md'
- 'tests/e2e/**'
# run the tests on creation or update of any pull request
pull_request:
paths-ignore:
- '.dockerignore'
- '.github/workflow/e2e.yml'
- '.github/workflow/pkg.yml'
- '.github/workflow/e2e test cache rebuild.yml'
- 'Changelog.md'
- 'Dockerfile'
- 'doc/**'
- 'docker/**'
- 'LICENSE'
- 'README.md'
- 'tests/e2e/**'
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# Test against the oldest supported version.
# Test against beta Rust to get early warning of any problems that might occur with the upcoming Rust release.
# Order: oldest Rust to newest Rust.
rust: [1.65.0, stable, beta]
# Test with no features, default features ("") and all except UI tests.
# Order: fewest features to most features.
args: ["--no-default-features", "", "--features all"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- run: cargo build --verbose ${{ matrix.args }} --locked
- run: cargo test --verbose ${{ matrix.args }} -- --test-threads=1 2>&1
pykmip-test:
name: pykmip-test
runs-on: ubuntu-20.04
strategy:
matrix:
rust: [1.65.0, stable, beta]
features: ["hsm", "hsm,hsm-tests-kmip"]
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install PyKMIP
uses: BSFishy/pip-action@v1
with:
packages: pykmip
constraints: test-resources/pykmip/constraints.txt
- name: Compile the tests
run: |
cargo build --tests --no-default-features --features ${{ matrix.features }}
- name: Run the tests against the PyKMIP server
run: |
cd test-resources/pykmip
python run-server.py &
sleep 5s
openssl s_client -connect 127.0.0.1:5696 || true
cd -
cargo test --no-default-features --features ${{ matrix.features }} -- --test-threads=1 2>&1
- name: Dump the PyKMIP log
if: always()
working-directory: test-resources/pykmip
run: |
ls -la
cat server.log
softhsm2-test:
name: softhsm2-test
runs-on: ubuntu-20.04
strategy:
matrix:
rust: [1.65.0, stable, beta]
features: ["hsm,hsm-tests-pkcs11"]
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- name: Install SoftHSM2
run: |
sudo apt update
sudo apt install -y softhsm2
sudo usermod -aG softhsm $(whoami)
sg softhsm -c "softhsm2-util --init-token --slot 0 --label \"My token 1\" --pin 1234 --so-pin 1234"
- name: Compile the tests
run: |
cargo build --tests --no-default-features --features ${{ matrix.features }}
- name: Run the tests against SoftHSM2
run: |
sg softhsm -c "cargo test --no-default-features --features ${{ matrix.features }} -- --test-threads=1 2>&1"
- name: Dump the SoftHSM2 log
if: always()
run: |
cat /var/log/syslog