Skip to content

Test

Test #992

Workflow file for this run

---
name: "Test"
on:
workflow_dispatch:
inputs:
ss_version:
description: "Archivematica Storage Service ref (branch, tag or SHA to checkout)"
default: "qa/0.x"
required: true
type: "string"
pull_request:
push:
branches:
- "qa/**"
- "stable/**"
jobs:
integration:
name: "Integration ${{ matrix.ubuntu-version }} with ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
ubuntu-version: [
"22.04",
]
python-version: [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
]
steps:
- name: "Check out repository"
if: "${{ github.event_name != 'workflow_dispatch' }}"
uses: "actions/checkout@v4"
- name: "Check out repository (manually triggered)"
if: "${{ github.event_name == 'workflow_dispatch' }}"
uses: "actions/checkout@v4"
with:
ref: "${{ inputs.ss_version || 'qa/0.x' }}"
- name: "Save user id"
id: user_id
run: |
echo "user_id=$(id -u)" >> $GITHUB_OUTPUT
- name: "Save group id"
id: group_id
run: |
echo "group_id=$(id -g)" >> $GITHUB_OUTPUT
- name: "Set up buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Build the archivematica-storage-service-tests image"
uses: "docker/build-push-action@v6"
with:
target: "archivematica-storage-service-tests"
build-args: |
USER_ID=${{ steps.user_id.outputs.user_id }}
GROUP_ID=${{ steps.group_id.outputs.group_id }}
UBUNTU_VERSION=${{ matrix.ubuntu-version }}
PYTHON_VERSION=${{ matrix.python-version }}
tags: "archivematica-storage-service-tests:latest"
push: false
load: true
cache-from: "type=gha,scope=archivematica-storage-service-tests-${{ matrix.ubuntu-version }}-${{ matrix.python-version }}"
cache-to: "type=gha,scope=archivematica-storage-service-tests-${{ matrix.ubuntu-version }}-${{ matrix.python-version }},mode=max"
- name: "Run tests"
run: |
./run.sh
shell: "bash"
working-directory: "tests/integration"
env:
USER_ID: ${{ steps.user_id.outputs.user_id }}
GROUP_ID: ${{ steps.group_id.outputs.group_id }}
UBUNTU_VERSION: ${{ matrix.ubuntu-version }}
PYTHON_VERSION: ${{ matrix.python-version }}
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
PYTEST_ADDOPTS: -vv --cov --cov-config=pyproject.toml --cov-report xml:coverage.xml
- name: "Upload coverage report"
if: github.repository == 'artefactual/archivematica-storage-service'
uses: "codecov/codecov-action@v4"
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
tox:
name: "Tox ${{ matrix.toxenv }}"
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
toxenv: [
"linting",
"migrations",
]
steps:
- name: "Check out repository"
if: "${{ github.event_name != 'workflow_dispatch' }}"
uses: "actions/checkout@v4"
- name: "Check out repository (manually triggered)"
if: "${{ github.event_name == 'workflow_dispatch' }}"
uses: "actions/checkout@v4"
with:
ref: "${{ inputs.ss_version || 'qa/0.x' }}"
- name: "Set up Python 3.9"
uses: "actions/setup-python@v5"
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: |
requirements-dev.txt
- name: "Install OS packages"
run: |
sudo apt-get --quiet update
sudo apt-get install --quiet --yes build-essential \
libmysqlclient-dev libsasl2-dev libldap2-dev libssl-dev
- name: "Install tox"
run: |
python -m pip install --upgrade pip
pip install tox
- name: "Run tox"
run: |
tox -e ${{ matrix.toxenv }}