-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (67 loc) · 3.13 KB
/
on-pr-against-dev.yaml
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
# ===================================================================================== #
# GitHub Actions configuration file for an AWS Glue ETL application #
# #
# This workflow will: #
# 1. Install dependencies, run tests and style checks with a variety of Python #
# versions. #
# 2. Copy the Glue scripts to an appropriate S3 bucket. #
# ===================================================================================== #
name: on PR against [dev]
on:
pull_request:
branches: [dev]
paths-ignore:
- ".github/workflows/on-iac-*.yaml"
- "infrastructure/**"
jobs:
# ===================================================================================== #
# PYTHON TESTS AND STYLE CHECKS #
# ===================================================================================== #
python-test-and-style-check:
environment: quality-assurance
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
- name: Run unit tests with pytest
run: pytest
- name: Comment unit test coverage
uses: MishaKav/pytest-coverage-comment@v1.1.43
with:
junitxml-path: ./pytest-junit.xml
pytest-xml-coverage-path: ./coverage.xml
- name: Run isort to check Python import order
run: isort --check --profile black ./src ./tests
- name: Run Black to check the Python code style and quality
run: black --check ./src ./tests
- name: Run Flake8 to check the Python code style and quality
run: flake8 ./src ./tests
# ===================================================================================== #
# GLUE JOBS DEPLOYMENT #
# ===================================================================================== #
glue-jobs-deployment:
environment: quality-assurance
needs: python-test-and-style-check
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GlueCICDGitHubActionsServiceRole
aws-region: ${{ vars.AWS_REGION }}
- name: Copy Glue scripts to S3
run: aws s3 sync --delete ./src s3://${{ vars.GLUE_SCRIPTS_S3_BUCKET }}