generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (92 loc) · 2.77 KB
/
ci.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
name: "CI unit and integration tests"
on:
pull_request:
branches:
- main
permissions:
contents: read
id-token: write
jobs:
python-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module:
- notify_slack/lambda
- rds_activity_stream/lambda
- schedule_shutdown/lambda
- sentinel_forwarder/wrapper
- waf_ip_blocklist/lambda
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
module:
- '${{ matrix.module }}/**'
- name: Setup Python
if: steps.changes.outputs.module == 'true'
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.11"
- name: Python tests
if: steps.changes.outputs.module == 'true'
working-directory: ${{ matrix.module }}
run: |
make install
make ARGS=--check fmt
make lint
make test
terraform-test:
runs-on: ubuntu-latest
env:
AWS_REGION: ca-central-1
TERRAFORM_VERSION: 1.7.0
CONFTEST_VERSION: 0.27.0
strategy:
fail-fast: false
matrix:
module:
- athena_access_logs
- client_vpn
- ecs
- gh_oidc_role
- notify_slack
- S3_scan_object
- schedule_shutdown
- rds
- rds_activity_stream
- resolver_dns
- S3
- S3_log_bucket
- sentinel_forwarder
- vpc
- waf_ip_blocklist
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
module:
- '${{ matrix.module }}/**/*.tf'
- '${{ matrix.module }}/tests/**'
- name: Configure AWS credentials using OIDC
if: steps.changes.outputs.module == 'true'
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: arn:aws:iam::124044056575:role/terraform-modules-test
role-session-name: TFTest
aws-region: ${{ env.AWS_REGION }}
- name: Setup Terraform tools
if: steps.changes.outputs.module == 'true'
uses: cds-snc/terraform-tools-setup@v1
- name: Terraform tests
if: steps.changes.outputs.module == 'true'
working-directory: ${{ matrix.module }}
run: |
make test