|
| 1 | +name: "Archivematica Acceptance Tests" |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + am_version: |
| 6 | + description: "Archivematica ref (branch, tag or SHA to checkout)" |
| 7 | + default: "qa/1.x" |
| 8 | + required: true |
| 9 | + type: "string" |
| 10 | + ss_version: |
| 11 | + description: "Archivematica Storage Service ref (branch, tag or SHA to checkout)" |
| 12 | + default: "qa/0.x" |
| 13 | + required: true |
| 14 | + type: "string" |
| 15 | + amauats_version: |
| 16 | + description: "Archivematica Acceptance Test ref (branch, tag or SHA to checkout)" |
| 17 | + default: "qa/1.x" |
| 18 | + required: true |
| 19 | + type: "string" |
| 20 | +jobs: |
| 21 | + test: |
| 22 | + name: "${{ matrix.vagrant-box.label }} / ${{ matrix.feature }}" |
| 23 | + runs-on: "ubuntu-latest" |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + vagrant-box: |
| 28 | + - id: "rockylinux/9" |
| 29 | + label: "rocky9" |
| 30 | + - id: "ubuntu/jammy64" |
| 31 | + label: "jammy" |
| 32 | + feature: |
| 33 | + - "aip-encryption-mirror" |
| 34 | + - "aip-encryption" |
| 35 | + - "checksum" |
| 36 | + - "create-aip" |
| 37 | + - "description-rights" |
| 38 | + - "extract-package" |
| 39 | + - "ingest-mkv-conformance" |
| 40 | + - "ingest-policy-check" |
| 41 | + - "metadata-xml" |
| 42 | + - "reingest-aip" |
| 43 | + - "transfer-microservices" |
| 44 | + - "transfer-mkv-conformance" |
| 45 | + - "transfer-policy-check" |
| 46 | + - "uuids-for-directories" |
| 47 | + - "virus" |
| 48 | + browser: |
| 49 | + - "Chrome" |
| 50 | + steps: |
| 51 | + - name: "Check out code" |
| 52 | + uses: "actions/checkout@v4" |
| 53 | + - name: "Check out AM code" |
| 54 | + uses: "actions/checkout@v4" |
| 55 | + with: |
| 56 | + repository: "artefactual/archivematica" |
| 57 | + ref: "${{ inputs.am_version }}" |
| 58 | + path: "${{ github.workspace }}/AM" |
| 59 | + - name: "Check out SS code" |
| 60 | + uses: "actions/checkout@v4" |
| 61 | + with: |
| 62 | + repository: "artefactual/archivematica-storage-service" |
| 63 | + ref: "${{ inputs.ss_version }}" |
| 64 | + path: "${{ github.workspace }}/SS" |
| 65 | + - name: "Check out AMAUATs code" |
| 66 | + uses: "actions/checkout@v4" |
| 67 | + with: |
| 68 | + repository: "artefactual-labs/archivematica-acceptance-tests" |
| 69 | + ref: "${{ inputs.amauats_version }}" |
| 70 | + path: "${{ github.workspace }}/AMAUATs" |
| 71 | + - name: "Install Python" |
| 72 | + uses: "actions/setup-python@v5" |
| 73 | + with: |
| 74 | + python-version: "3.9" |
| 75 | + - name: "Install Vagrant" |
| 76 | + run: | |
| 77 | + wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg |
| 78 | + 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 |
| 79 | + sudo apt update && sudo apt install vagrant |
| 80 | + - name: "Install VirtualBox" |
| 81 | + run: | |
| 82 | + wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor |
| 83 | + 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 |
| 84 | + sudo apt update && sudo apt install virtualbox-7.0 |
| 85 | + - name: "Install the vagrant-vbguest plugin" |
| 86 | + run: | |
| 87 | + vagrant plugin install vagrant-vbguest |
| 88 | + - name: "Update vbox networks" |
| 89 | + run: | |
| 90 | + sudo mkdir -p /etc/vbox/ |
| 91 | + echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf |
| 92 | + - name: "Start VM" |
| 93 | + working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" |
| 94 | + env: |
| 95 | + VAGRANT_BOX: "${{ matrix.vagrant-box.id }}" |
| 96 | + run: | |
| 97 | + vagrant up |
| 98 | + - name: "Resize root partition in Rocky 9" |
| 99 | + if: matrix.vagrant-box.id == 'rockylinux/9' |
| 100 | + working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" |
| 101 | + run: | |
| 102 | + vagrant ssh -c 'echo "- +" | sudo sfdisk --no-reread -N 5 /dev/sda' |
| 103 | + vagrant reload |
| 104 | + vagrant ssh -c 'sudo xfs_growfs /dev/sda5' |
| 105 | + - name: "Install Archivematica" |
| 106 | + working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" |
| 107 | + env: |
| 108 | + ANSIBLE_HOST_KEY_CHECKING: "False" |
| 109 | + run: | |
| 110 | + ansible-galaxy install -f -p roles/ -r requirements.yml |
| 111 | + ansible-playbook -i 192.168.33.2, playbook.yml \ |
| 112 | + -u vagrant \ |
| 113 | + --private-key ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \ |
| 114 | + -e "archivematica_src_am_version=${{ inputs.am_version }} archivematica_src_ss_version=${{ inputs.ss_version }}" |
| 115 | + -v |
| 116 | + - name: "Prepare VM for running AMAUATs" |
| 117 | + working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" |
| 118 | + run: | |
| 119 | + vagrant ssh -c 'sudo usermod -a -G archivematica vagrant' |
| 120 | + vagrant ssh -c 'sudo ln -s /home/vagrant /home/archivematica' |
| 121 | + - name: "Set up AMAUATs" |
| 122 | + working-directory: "${{ github.workspace }}/AMAUATs" |
| 123 | + run: | |
| 124 | + python3 -m venv .venv |
| 125 | + .venv/bin/python3 -m pip install -r requirements.txt |
| 126 | + - name: "Run AMAUATs" |
| 127 | + id: "amauat-run" |
| 128 | + working-directory: "${{ github.workspace }}/AMAUATs" |
| 129 | + env: |
| 130 | + HEADLESS: 1 |
| 131 | + run: | |
| 132 | + .venv/bin/behave -i ${{ matrix.feature }}.feature \ |
| 133 | + -v \ |
| 134 | + --no-capture \ |
| 135 | + --no-capture-stderr \ |
| 136 | + --no-logcapture \ |
| 137 | + --no-skipped \ |
| 138 | + -D am_version=1.9 \ |
| 139 | + -D driver_name=${{ matrix.browser }} \ |
| 140 | + -D am_username=admin \ |
| 141 | + -D am_password=archivematica \ |
| 142 | + -D am_url=http://192.168.33.2/ \ |
| 143 | + -D am_api_key="this_is_the_am_api_key" \ |
| 144 | + -D ss_username=admin \ |
| 145 | + -D ss_password=archivematica \ |
| 146 | + -D ss_api_key="this_is_the_ss_api_key" \ |
| 147 | + -D ss_url=http://192.168.33.2:8000/ \ |
| 148 | + -D home=vagrant \ |
| 149 | + -D server_user=vagrant \ |
| 150 | + -D transfer_source_path=/home/vagrant/archivematica-sampledata/TestTransfers/acceptance-tests \ |
| 151 | + -D ssh_identity_file=${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key |
| 152 | + - name: "Save logs on failure" |
| 153 | + if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" |
| 154 | + working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" |
| 155 | + run: | |
| 156 | + mkdir /tmp/logs |
| 157 | + vagrant ssh -c 'mkdir -p /tmp/logs/journalctl' |
| 158 | + vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysql,elasticsearch,gearman-job-server,clamav,nginx} /tmp/logs' |
| 159 | + vagrant ssh -c 'sudo journalctl -u archivematica-mcp-client --no-pager > /tmp/logs/journalctl/archivematica-mcp-client' |
| 160 | + vagrant ssh -c 'sudo chown -R vagrant /tmp/logs' |
| 161 | + scp \ |
| 162 | + -i ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \ |
| 163 | + -o "StrictHostKeyChecking=no" \ |
| 164 | + -r \ |
| 165 | + [email protected]:/tmp/logs /tmp/logs |
| 166 | + - name: "Upload logs on failure" |
| 167 | + if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" |
| 168 | + uses: "actions/upload-artifact@v4" |
| 169 | + with: |
| 170 | + name: "logs-${{ matrix.vagrant-box.label }}-${{ matrix.feature }}" |
| 171 | + path: "/tmp/logs" |
0 commit comments