Workflow tests #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Workflow tests | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
actions: write | |
on: | |
workflow_dispatch: | |
inputs: | |
container-tag: | |
description: 'Container tag' | |
required: true | |
default: 'dev' | |
keep-workdirs: | |
description: 'Keep working directories for debugging' | |
required: false | |
default: 'false' | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
schedule: | |
# 01:00 every day | |
- cron: "0 1 * * *" | |
jobs: | |
pre_job: | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
paths_result: ${{ steps.skip_check.outputs.paths_result }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
concurrent_skipping: "same_content_newer" | |
skip_after_successful_duplicate: "true" | |
do_not_skip: '["workflow_dispatch"]' | |
paths_filter: | | |
pixelator: | |
paths: | |
- 'src/pixelator/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- 'poetry.lock' | |
paths_ignore: | |
- 'tests/**/*.md' | |
setup: | |
runs-on: ubuntu-latest | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip == '{}' || !fromJSON(needs.pre_job.outputs.paths_result).pixelator.should_skip | |
outputs: | |
docker_username: ${{ steps.login-ecr.outputs.docker_username_890888997283_dkr_ecr_eu_north_1_amazonaws_com }} | |
docker_password: ${{ steps.login-ecr.outputs.docker_password_890888997283_dkr_ecr_eu_north_1_amazonaws_com }} | |
steps: | |
- name: Configure AWS credentials | |
id: configure-aws-credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-north-1 | |
role-to-assume: arn:aws:iam::890888997283:role/GithubActionsRole | |
role-session-name: GitHubActions | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
mask-password: 'false' | |
test: | |
# runs-on: [ "self-hosted", "linux", "x64", "ubuntu-latest" ] | |
runs-on: ubuntu-latest | |
needs: [setup] | |
container: | |
image: 890888997283.dkr.ecr.eu-north-1.amazonaws.com/pixelator:${{ github.event.inputs.container-tag || 'dev' }} | |
credentials: | |
username: ${{ needs.setup.outputs.docker_username }} | |
password: ${{ needs.setup.outputs.docker_password }} | |
volumes: | |
- /mnt/github-actions-data:/data | |
strategy: | |
fail-fast: false | |
matrix: | |
test: [ "small" ] | |
# test: [ "small", "single-cell", "tissue" ] | |
steps: | |
- name: Install dev dependencies | |
working-directory: /pixelator | |
run: | | |
poetry export -f requirements.txt --output requirements_only_dev.txt --only dev | |
pip install -r requirements_only_dev.txt | |
- name: Prepare test case string | |
uses: actions/github-script@v6 | |
id: test_case_file | |
with: | |
script: | | |
const test_name = "${{ matrix.test }}" | |
const test_file_name = `test_${test_name.replace(/-/g, '_')}.py` | |
core.setOutput('filename', test_file_name) | |
- name: Test pixelator | |
run: | | |
CMD="pytest /pixelator/tests/integration/${{ steps.test_case_file.outputs.filename }} --log-cli-level=DEBUG" | |
if [[ "${{ github.event.inputs.keep-workdirs }}" == "true" ]]; then | |
CMD="$CMD --keep-workdirs" | |
fi | |
$CMD -m "workflow_test" |