-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (54 loc) · 1.61 KB
/
Copy pathpython-job.yml
File metadata and controls
55 lines (54 loc) · 1.61 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
name: Python Workflow
on:
workflow_call:
inputs:
python-version:
required: true
type: string
aws-default-region:
required: false
type: string
default: "eu-central-1"
working-directory:
required: false
type: string
default: "./"
test-directory:
required: false
type: string
default: "./"
pytest-continue-on-error:
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
AWS_DEFAULT_REGION: ${{ inputs.aws-default-region }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ruff pytest
- name: Analysing the code with ruff
continue-on-error: false
run: |
ruff check $(git ls-files '*.py')
- name: Test with pytest
continue-on-error: ${{ inputs.pytest-continue-on-error }}
# Note: pytest will only automatically discover and run tests in files
# that either start or end with "test" (or "tests"). Make sure your test
# files follow this naming convention. Same for test functions and methods.
run: |
pytest ${{ inputs.test-directory }} -v