-
Notifications
You must be signed in to change notification settings - Fork 12
148 lines (148 loc) · 6.13 KB
/
archivematica-upgrade.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
name: "Archivematica Upgrade Test"
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
pull_request:
paths:
- "playbooks/archivematica-jammy/**"
- "tests/archivematica-upgrade/**"
- "!tests/archivematica-upgrade/README.md"
push:
branches:
- "master"
paths:
- "playbooks/archivematica-jammy/**"
- "tests/archivematica-upgrade/**"
- "!tests/archivematica-upgrade/README.md"
jobs:
test:
name: "Archivematica upgrade test"
runs-on: "ubuntu-22.04"
env:
python_version: "3.12"
steps:
- name: "Check out the code"
uses: "actions/checkout@v4"
- name: "Upgrade crun (supports Ubuntu's systemd in the Dockerfile)"
run: |
wget https://github.com/containers/crun/releases/download/1.15/crun-1.15-linux-amd64
sudo install crun-1.15-linux-amd64 /usr/bin/crun
rm crun-1.15-linux-amd64
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.python_version }}"
cache: "pip"
cache-dependency-path: |
tests/archivematica-upgrade/requirements.txt
- name: "Cache the virtual environment"
id: "venv-cache"
uses: "actions/cache@v4"
with:
path: |
tests/archivematica-upgrade/.venv/
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('tests/archivematica-upgrade/requirements.txt') }}"
- name: "Set up the virtual environment"
if: "steps.venv-cache.outputs.cache-hit == false"
working-directory: "${{ github.workspace }}/tests/archivematica-upgrade"
run: |
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
- name: "Add virtual environment to PATH"
working-directory: "${{ github.workspace }}/tests/archivematica-upgrade"
run:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: "Generate an SSH key and copy it next to the Dockerfile"
run: |
mkdir $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -N ""
cp $HOME/.ssh/id_rsa.pub ${{ github.workspace }}/tests/archivematica-upgrade/ssh_pub_key
- name: "Start the Compose environment"
working-directory: "${{ github.workspace }}/tests/archivematica-upgrade"
run: |
podman-compose up --detach
- name: "Install the stable version of Archivematica"
working-directory: "${{ github.workspace }}/tests/archivematica-upgrade"
env:
ANSIBLE_HOST_KEY_CHECKING: "False"
ANSIBLE_REMOTE_PORT: 2222
run: |
ansible-galaxy install -f -p roles/ -r ../../playbooks/archivematica-jammy/requirements.yml
ansible-playbook -i localhost, playbook.yml \
-u ubuntu \
-e "am_version=1.17" \
-e "archivematica_src_configure_am_site_url=http://archivematica" \
-e "archivematica_src_configure_ss_url=http://archivematica:8000" \
-v
- name: "Get the Archivematica version"
run: |
curl \
--silent \
--dump-header - \
--header 'Authorization: ApiKey admin:this_is_the_am_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8000/api/processing-configuration/' | grep X-Archivematica-Version
- name: "Call an Archivematica API endpoint"
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:this_is_the_am_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8000/api/processing-configuration/' \
| jq -r '.processing_configurations == ["automated", "default"]' \
) == true
- name: "Call a Storage Service API endpoint"
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:this_is_the_ss_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8001/api/v2/pipeline/' \
| jq -r '.meta.total_count == 1' \
) == true
- name: "Upgrade to the QA version of Archivematica"
working-directory: "${{ github.workspace }}/tests/archivematica-upgrade"
env:
ANSIBLE_HOST_KEY_CHECKING: "False"
ANSIBLE_REMOTE_PORT: 2222
run: |
rm -rf roles
ansible-galaxy install -f -p roles/ -r ../../playbooks/archivematica-jammy/requirements-qa.yml
ansible-playbook -i localhost, playbook.yml \
-u ubuntu \
-e "am_version=qa" \
-e "archivematica_src_configure_am_site_url=http://archivematica" \
-e "archivematica_src_configure_ss_url=http://archivematica:8000" \
-t "archivematica-src" \
-v
- name: "Get the Archivematica version"
run: |
curl \
--silent \
--dump-header - \
--header 'Authorization: ApiKey admin:this_is_the_am_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8000/api/processing-configuration/' | grep X-Archivematica-Version
- name: "Call an Archivematica API endpoint"
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:this_is_the_am_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8000/api/processing-configuration/' \
| jq -r '.processing_configurations == ["automated", "default"]' \
) == true
- name: "Call a Storage Service API endpoint"
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:this_is_the_ss_api_key' \
--header 'Content-Type: application/json' \
'http://localhost:8001/api/v2/pipeline/' \
| jq -r '.meta.total_count == 1' \
) == true