Skip to content

Archivematica RPM Packages Test #177

Archivematica RPM Packages Test

Archivematica RPM Packages Test #177

Workflow file for this run

name: Archivematica RPM Packages Test
on:
workflow_dispatch:
inputs:
build_packages:
description: "Build local packages"
required: true
default: true
type: "boolean"
pull_request:
paths:
- "rpms/EL9/archivematica/**"
- "rpms/EL9/archivematica-storage-service/**"
- "tests/archivematica/**"
- "!tests/archivematica/README.md"
- "!tests/archivematica/jammy/**"
push:
branches:
- "stable/**"
- "qa/**"
paths:
- "rpms/EL9/archivematica/**"
- "rpms/EL9/archivematica-storage-service/**"
- "tests/archivematica/**"
- "!tests/archivematica/README.md"
- "!tests/archivematica/jammy/**"
schedule:
- cron: "0 2 * * *"
jobs:
build-am-packages:
name: Build Archivematica packages
runs-on: ubuntu-latest
if: "${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.build_packages) }}"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build
run: |
make -C ${{ github.workspace }}/rpms/EL9/archivematica
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: archivematica-packages
path: |
${{ github.workspace }}/rpms/EL9/archivematica/*.rpm
build-ss-packages:
name: Build Storage Service packages
runs-on: ubuntu-latest
if: "${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.build_packages) }}"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build
run: |
make -C ${{ github.workspace }}/rpms/EL9/archivematica-storage-service
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: archivematica-storage-service-packages
path: |
${{ github.workspace }}/rpms/EL9/archivematica-storage-service/*.rpm
create-package-repo:
name: Create package repository
runs-on: ubuntu-latest
if: "${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.build_packages) }}"
needs:
- build-am-packages
- build-ss-packages
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Restore Archivematica packages
uses: actions/download-artifact@v4
with:
name: archivematica-packages
path: |
${{ github.workspace }}/rpms/EL9/archivematica/
- name: Restore Storage Service packages
uses: actions/download-artifact@v4
with:
name: archivematica-storage-service-packages
path: |
${{ github.workspace }}/rpms/EL9/archivematica-storage-service
- name: Create repository
run: |
make -C ${{ github.workspace }}/rpms/EL9 createrepo
- name: Save package repository
uses: actions/upload-artifact@v4
with:
name: package-repository
path: |
${{ github.workspace }}/rpms/EL9/_yum_repository
test:
name: Test packages
needs: create-package-repo
runs-on: ubuntu-22.04
if: "${{ always() }}"
env:
build_packages: "${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.build_packages) }}"
steps:
- name: Check if the repository creation job failed
if: "${{ needs.create-package-repo.result != 'skipped' && ! env.build_packages }}"
run: |
exit 1
- name: Check out code
uses: actions/checkout@v4
- name: Restore package repository
if: needs.create-package-repo.result == 'success'
uses: actions/download-artifact@v4
with:
name: package-repository
path: ${{ github.workspace }}/rpms/EL9/_yum_repository
- 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: "3.10"
cache: "pip"
cache-dependency-path: |
tests/archivematica/requirements.txt
- name: "Cache the virtual environment"
id: "venv-cache"
uses: "actions/cache@v4"
with:
path: |
tests/archivematica/.venv/
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('tests/archivematica/requirements.txt') }}"
- name: "Set up the virtual environment"
if: "steps.venv-cache.outputs.cache-hit == false"
working-directory: "${{ github.workspace }}/tests/archivematica"
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"
run:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: "Start the Compose environment"
working-directory: "${{ github.workspace }}/tests/archivematica"
env:
DOCKER_IMAGE_NAME: "rockylinux"
DOCKER_IMAGE_TAG: "9"
run: |
podman-compose up --detach
- name: Install packages
working-directory: ${{ github.workspace }}/tests/archivematica
run: |
podman-compose exec --env LOCAL_REPOSITORY="${{ env.build_packages }}" --user ubuntu archivematica /am-packbuild/tests/archivematica/EL9/install.sh
- name: Test AM API - Get processing configurations
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://localhost:8000/api/processing-configuration/' \
| jq -r '.processing_configurations == ["automated", "default"]' \
) == true
- name: Test SS API - Get pipeline count
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://localhost:8001/api/v2/pipeline/' \
| jq -r '.meta.total_count == 1' \
) == true