-
Notifications
You must be signed in to change notification settings - Fork 12
191 lines (191 loc) · 8.89 KB
/
archivematica-acceptance-tests.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: "Archivematica Acceptance Tests"
on:
workflow_dispatch:
inputs:
am_version:
description: "Archivematica ref (branch, tag or SHA to checkout)"
default: "qa/1.x"
required: true
type: "string"
ss_version:
description: "Archivematica Storage Service ref (branch, tag or SHA to checkout)"
default: "qa/0.x"
required: true
type: "string"
at_version:
description: "Archivematica Acceptance Test ref (branch, tag or SHA to checkout)"
default: "qa/1.x"
required: true
type: "string"
jobs:
test:
name: "${{ matrix.feature }} / ${{ matrix.vagrant_box.label }}"
runs-on: "ubuntu-latest"
env:
am_version: "${{ inputs.am_version }}"
ss_version: "${{ inputs.ss_version }}"
at_version: "${{ inputs.at_version }}"
strategy:
fail-fast: false
matrix:
vagrant_box:
- id: "rockylinux/9"
label: "rocky9"
- id: "rockylinux/8"
label: "rocky8"
- id: "almalinux/9"
label: "alma9"
- id: "ubuntu/jammy64"
label: "jammy"
feature:
- "aip-encryption-mirror"
- "aip-encryption"
- "checksum"
- "create-aip"
- "description-rights"
- "extract-package"
- "ingest-mkv-conformance"
- "ingest-policy-check"
- "metadata-xml"
- "reingest-aip"
- "transfer-microservices"
- "transfer-mkv-conformance"
- "transfer-policy-check"
- "uuids-for-directories"
- "virus"
browser:
- "Chrome"
steps:
- name: "Check out code"
uses: "actions/checkout@v4"
- name: "Check out AM code"
uses: "actions/checkout@v4"
with:
repository: "artefactual/archivematica"
ref: "${{ env.am_version }}"
path: "${{ github.workspace }}/AM"
- name: "Check out SS code"
uses: "actions/checkout@v4"
with:
repository: "artefactual/archivematica-storage-service"
ref: "${{ env.ss_version }}"
path: "${{ github.workspace }}/SS"
- name: "Check out AMAUATs code"
uses: "actions/checkout@v4"
with:
repository: "artefactual-labs/archivematica-acceptance-tests"
ref: "${{ env.at_version }}"
path: "${{ github.workspace }}/AMAUATs"
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.9"
- name: "Install Vagrant"
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant
- name: "Install VirtualBox"
run: |
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update && sudo apt install virtualbox-7.0
- name: "Downgrade VirtualBox"
run: |
sudo apt-get purge virtualbox-7.0
wget -O /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb -L https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
sudo dpkg -i /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
- name: "Install the vagrant-vbguest plugin"
run: |
vagrant plugin install vagrant-vbguest
- name: "Update the VirtualBox networks file"
run: |
sudo mkdir -p /etc/vbox/
echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf
- name: "Start the VM"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
env:
VAGRANT_BOX: "${{ matrix.vagrant_box.id }}"
run: |
vagrant up
- name: "Install Archivematica"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
env:
ANSIBLE_HOST_KEY_CHECKING: "False"
run: |
ansible-galaxy install -f -p roles/ -r requirements.yml
ansible-playbook -i 192.168.33.2, playbook.yml \
-u vagrant \
--private-key ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \
-e "archivematica_src_am_version=${{ env.am_version }} archivematica_src_ss_version=${{ env.ss_version }}" \
-v
- name: "Prepare the VM for running the AMAUATs"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
run: |
vagrant ssh -c 'sudo usermod -a -G archivematica vagrant'
vagrant ssh -c 'sudo ln -s /home/vagrant /home/archivematica'
- name: "Set up AMAUATs"
working-directory: "${{ github.workspace }}/AMAUATs"
run: |
python3 -m venv .venv
.venv/bin/python3 -m pip install -r requirements.txt
- name: "Run AMAUATs"
id: "amauat-run"
working-directory: "${{ github.workspace }}/AMAUATs"
env:
HEADLESS: 1
run: |
.venv/bin/behave -i ${{ matrix.feature }}.feature \
-v \
--no-capture \
--no-capture-stderr \
--no-logcapture \
--no-skipped \
-D am_version=1.9 \
-D driver_name=${{ matrix.browser }} \
-D am_username=admin \
-D am_password=archivematica \
-D am_url=http://192.168.33.2/ \
-D am_api_key="this_is_the_am_api_key" \
-D ss_username=admin \
-D ss_password=archivematica \
-D ss_api_key="this_is_the_ss_api_key" \
-D ss_url=http://192.168.33.2:8000/ \
-D home=vagrant \
-D server_user=vagrant \
-D transfer_source_path=/home/vagrant/archivematica-sampledata/TestTransfers/acceptance-tests \
-D ssh_identity_file=${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key
- name: "Save common logs on failure"
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
run: |
mkdir /tmp/logs
vagrant ssh -c 'mkdir -p /tmp/logs/journalctl'
vagrant ssh -c 'sudo journalctl -u archivematica-mcp-client --no-pager > /tmp/logs/journalctl/archivematica-mcp-client'
- name: "Save logs on failure"
if: "${{ startsWith(matrix.vagrant_box.id, 'ubuntu/') && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
run: |
vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysql,elasticsearch,gearman-job-server,clamav,nginx} /tmp/logs'
- name: "Save logs on failure"
if: "${{ (startsWith(matrix.vagrant_box.id, 'rockylinux/') || startsWith(matrix.vagrant_box.id, 'almalinux/')) && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
run: |
vagrant ssh -c 'sudo journalctl -u clamd@scan --no-pager > /tmp/logs/journalctl/clamd'
vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysqld.log,elasticsearch,nginx} /tmp/logs'
- name: "Copy logs from VM"
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}"
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests"
run: |
vagrant ssh -c 'sudo chown -R vagrant /tmp/logs'
scp \
-i ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \
-o "StrictHostKeyChecking=no" \
-r \
[email protected]:/tmp/logs /tmp/logs
- name: "Upload logs on failure"
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}"
uses: "actions/upload-artifact@v4"
with:
name: "logs-${{ matrix.vagrant_box.label }}-${{ matrix.feature }}"
path: "/tmp/logs"