-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (100 loc) · 3.49 KB
/
workflow-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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'
schedule:
# 01:00 every day, using last commit on default branch
- 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" ]
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/pixelgen-github-actions-data:/mnt/pixelgen-github-actions-data
- /mnt/pixelgen-technologies-datasets:/mnt/pixelgen-technologies-datasets
strategy:
fail-fast: false
matrix:
test: [ "test_small_D21", "test_full_D21" ]
steps:
- name: Install poetry
run: |
python -m pip install --user pipx
python -m pipx ensurepath
pipx install poetry
poetry self add poetry-plugin-export
- name: Checkout code
uses: actions/checkout@v4
- name: Install dev dependencies
run: |
poetry export -f requirements.txt --output requirements_only_dev.txt --only dev
pip3 install -r requirements_only_dev.txt
- name: Test pixelator
run: |
CMD="pytest --log-cli-level=DEBUG"
if [[ "${{ github.event.inputs.keep-workdirs }}" == "true" ]]; then
CMD="$CMD --keep-workdirs"
fi
$CMD -m "workflow_test" -k "${{ matrix.test }}"