-
Notifications
You must be signed in to change notification settings - Fork 20
149 lines (130 loc) · 4.24 KB
/
tests.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: tests
on:
push:
branches:
- main
paths:
- src/**
- tests/functional/**
- config.nims
- "*.nimble"
# ignore docs not to waste CI minutes
- "!src/docs/**"
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- src/**
- tests/functional/**
- config.nims
- "*.nimble"
# ignore docs not to waste CI minutes
- "!src/docs/**"
workflow_dispatch:
permissions:
contents: read
packages: write
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
pytest:
runs-on: ubuntu-22.04
if: |
(
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.body, format('skip:{0}', github.workflow))
) || (
github.event_name == 'push' &&
endsWith(github.repository, 'chalk')
) || (
github.event_name == 'workflow_dispatch'
) || (
github.event_name == 'schedule'
)
concurrency:
# only allow one job per PR running
# older pending jobs will be cancelled not to waste CI minutes
# cannot use github.job here https://github.com/community/community/discussions/13496
group: ${{ github.workflow }}-pytest-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6
# for tests to checkout dummy private repo
- name: Get GitHub Token
id: org-token
uses: crashappsec/action-github-app-token@main
with:
app_id: ${{ secrets.CHALK_GITHUB_APP_ID }}
private_key: ${{ secrets.CHALK_GITHUB_APP_PRIVATE_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # 3.3.0
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Login to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_HUB_PUBLIC_READONLY_TOKEN }}
- name: Prep PWD
run: |
mkdir -p ../con4m
mkdir -p ../nimutils
- name: Bake Images
run: |
docker buildx bake chalk server tests --load
- name: Test pingttl
if: inputs.chalk_url == ''
run: |
make src/pingttl
- name: Compile Chalk
if: inputs.chalk_url == ''
run: |
make
- name: Download Chalk
if: inputs.chalk_url != ''
run: |
curl -L "${{ inputs.chalk_url }}" > chalk
chmod +x chalk
./chalk version
- name: Run tests (Fast)
# run fast tests by default on PRs when
# "tests:--slow" is missing in PR description
if: |
github.event_name == 'pull_request' && (
!contains(github.event.pull_request.body, 'tests:--slow')
)
env:
GITHUB_TOKEN: ${{ steps.org-token.outputs.token }}
REGISTRY_PROXY_USERNAME: ${{ github.repository_owner }}
REGISTRY_PROXY_PASSWORD: ${{ secrets.DOCKER_HUB_PUBLIC_READONLY_TOKEN }}
run: |
make tests_parallel args=""
- name: Run tests (Slow)
# run slow tests on non-PR builds and when
# PR description has "tests:--slow"
if: |
github.event_name != 'pull_request' || (
contains(github.event.pull_request.body, 'tests:--slow')
)
env:
GITHUB_TOKEN: ${{ steps.org-token.outputs.token }}
REGISTRY_PROXY_USERNAME: ${{ github.repository_owner }}
REGISTRY_PROXY_PASSWORD: ${{ secrets.DOCKER_HUB_PUBLIC_READONLY_TOKEN }}
run: |
make tests_parallel args="--slow"
- name: Show service logs
if: failure()
run: |
docker compose logs | grep -v health