-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·68 lines (58 loc) · 1.71 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/${{ github.repository }}-devcontainer
CONNECTIONS_FILE: ./config/connections.json
jobs:
test:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
CI: true
steps:
- uses: actions/checkout@v3
- name: Load Airflow connections
env:
AIRFLOW_CONNECTIONS: ${{ secrets.AIRFLOW_CONNECTIONS }}
run: |
echo "$AIRFLOW_CONNECTIONS" > ${{ env.CONNECTIONS_FILE }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ${{ env.IMAGE_NAME }}
cacheFrom: ${{ env.IMAGE_NAME }}
push: always
- name: Build container and run pre-commit format and lint
uses: devcontainers/[email protected]
continue-on-error: true
with:
imageName: ${{ env.IMAGE_NAME }}
cacheFrom: ${{ env.IMAGE_NAME }}
# Run pre-commit checks
runCmd: |
pre-commit run --all-files --verbose --show-diff-on-failure
- name: Build container and run unit tests
uses: devcontainers/[email protected]
with:
imageName: ${{ env.IMAGE_NAME }}
cacheFrom: ${{ env.IMAGE_NAME }}
# Run unit tests
runCmd: |
script/test
- name: Cleanup Files
if: always()
run: |
rm -f ${{ env.CONNECTIONS_FILE }}