forked from agblox/github-reusable-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 2.34 KB
/
pytest.yml
File metadata and controls
84 lines (82 loc) · 2.34 KB
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
name: pytest
on:
workflow_call:
inputs:
node-version:
default: '18.16.0'
description: Node runtime version
required: false
type: string
python-version:
default: '3.10'
description: Python runtime version
required: false
type: string
run-unit:
default: true
description: Run unit tests if true
required: false
type: boolean
run-integration:
default: false
description: Run integration tests if true
required: false
type: boolean
ecr-registry:
description: Docker image registry
required: false
type: string
ecr-repo:
description: Docker image name
required: false
type: string
secrets:
ssh-key:
description: Machine user GitHub SSH key
required: false
jobs:
pytest:
runs-on: ubuntu-latest
name: Run tests
steps:
- name: Set up Node ${{ inputs.node-version }}
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ inputs.node-version }}
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4.6.0
with:
python-version: ${{ inputs.python-version }}
- uses: actions/checkout@v3.5.2
- name: Install poetry
run: pip install poetry
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true
- name: Set up poetry cache
uses: actions/cache@v3.3.1
id: cache
with:
path: |
.venv
key: poetry-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install machine user SSH key
env:
SSH_KEY: ${{ secrets.ssh-key }}
if: env.SSH_KEY != null
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: |
${{ secrets.ssh-key }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make bootstrap
- name: Run unit tests
if: inputs.run-unit
run: make test
- name: Run integration tests
if: ${{ inputs.run-integration == true}}
env:
ECR_REGISTRY: ${{ inputs.ecr-registry }}
ECR_REPO: ${{ inputs.ecr-repo }}
run: make test-integration