Skip to content

Add type hints to the characterize_file script #1784

Add type hints to the characterize_file script

Add type hints to the characterize_file script #1784

Workflow file for this run

---
name: "Test"
on:
workflow_dispatch:
inputs:
am_version:
description: "Archivematica ref (branch, tag or SHA to checkout)"
default: "qa/1.x"
required: true
type: "string"
pull_request:
push:
branches:
- "qa/**"
- "stable/**"
jobs:
test:
name: "Test ${{ matrix.rule }} on ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
rule: [
"mcp-server",
"mcp-client",
"dashboard",
"archivematica-common",
]
ubuntu-version: [
"22.04",
]
python-version: [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12"
]
include:
- rule: "storage-service"
ubuntu-version: "22.04"
python-version: "3.9"
- rule: "migrations"
ubuntu-version: "22.04"
python-version: "3.9"
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.am_version || 'qa/1.x' }}"
- name: "Check out the archivematica-storage-service submodule"
run: |
git submodule update --init hack/submodules/archivematica-storage-service/
- 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 archivematica-tests image"
uses: "docker/build-push-action@v6"
with:
context: .
file: ./hack/Dockerfile
target: archivematica-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-tests:latest
push: false
load: true
cache-from: "type=gha,scope=archivematica-tests-${{ matrix.ubuntu-version }}-${{ matrix.python-version }}-${{ matrix.rule }}"
cache-to: "type=gha,scope=archivematica-tests-${{ matrix.ubuntu-version }}-${{ matrix.python-version }}-${{ matrix.rule }},mode=max"
- name: "Create external volumes"
run: |
make -C hack/ create-volumes
- name: "Run make rule"
run: |
docker buildx install
make -C hack/ test-${{ matrix.rule }}
env:
TOXARGS: -vv
PYTEST_ADDOPTS: -vv --cov --cov-config=/src/pyproject.toml --cov-report xml:/src/coverage.xml
PYTHON_VERSION: ${{ matrix.python-version }}
- name: "Upload coverage report"
if: matrix.rule != 'storage-service' && matrix.rule != 'migrations' && github.repository == 'artefactual/archivematica'
uses: "codecov/codecov-action@v4"
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
name: ${{ matrix.rule }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
frontend:
name: "Test frontend"
runs-on: "ubuntu-22.04"
defaults:
run:
working-directory: "./src/dashboard/frontend/"
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.am_version || 'qa/1.x' }}"
- name: "Set up Node JS"
uses: "actions/setup-node@v4"
with:
node-version: "20"
cache: "npm"
cache-dependency-path: |
**/package-lock.json
- name: "Install frontend dependencies"
run: |
npm install
- name: "Run tests"
run: |
npm run "test-single-run"
linting:
name: "Lint"
runs-on: "ubuntu-22.04"
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.am_version || 'qa/1.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 tox"
run: |
python -m pip install --upgrade pip
pip install tox
- name: "Run tox"
run: |
tox -e linting