-
Notifications
You must be signed in to change notification settings - Fork 25
169 lines (168 loc) · 8.1 KB
/
github-action.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
on:
push:
branches-ignore:
- maint
- stable
# All of the jobs below have identical steps EXCEPT FOR the "Build test
# environment" step and the "Post results to Slack" step.
#
# The "Build test environment" step builds our supporting Docker image
# (tagged `rtir`) with the specific RT configuration being tested by that
# job. It also starts any other Docker containers required to support that
# configuration (usually a database, in a container named `rtdb`). All these
# containers are created and talk to each other over the `rt` Docker network
# created in the first setup step.
#
# The "Post results to Slack" step has a different "Configuration" field
# value briefly describing the configuration that was used in the "Build
# test environment" step.
jobs:
rtir_test_sqlite:
runs-on: ubuntu-latest
steps:
- name: Set up for tests
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
docker network create rt
- name: Check out RTIR
uses: actions/checkout@v2
- name: Cache .prove state
id: cache-prove-state
uses: actions/cache@v3
with:
path: .prove
key: ${{ runner.os }}-sqlite
- name: Build test environment
run: |
docker build --build-arg RT_DB_TYPE=SQLite --tag rtir .
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make'
- name: Run RTIR tests
run: |
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && make test-parallel'
- name: Get run time
if: always()
run: |
RT_GA_END_TIME=$(date +%s)
RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
# Convert seconds to HH::MM::SS
RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
echo RT_GA_END_TIME "$RT_GA_END_TIME"
echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
- name: Post results to Slack
if: always()
uses: edge/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
with:
channel: '#github'
status: ${{ job.status }}
success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
fields: |
[{ "title": "Configuration", "value": "RTIR, SQLite", "short": true },
{ "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]
rtir_test_mariadb:
runs-on: ubuntu-latest
steps:
- name: Set up for tests
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
docker network create rt
- name: Check out RTIR
uses: actions/checkout@v2
- name: Cache .prove state
id: cache-prove-state
uses: actions/cache@v3
with:
path: .prove
key: ${{ runner.os }}-mariadb
- name: Build test environment
run: |
docker run --detach --name rtdb --network rt --env MYSQL_ROOT_PASSWORD=password mariadb:10.6
docker build --build-arg RT_DB_TYPE=mysql --build-arg RT_TEST_DB_HOST=rtdb --network rt --tag rtir .
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make'
- name: Run RTIR tests
run: |
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && make test-parallel'
- name: Get run time
if: always()
run: |
RT_GA_END_TIME=$(date +%s)
RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
# Convert seconds to HH::MM::SS
RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
echo RT_GA_END_TIME "$RT_GA_END_TIME"
echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
- name: Post results to Slack
if: always()
uses: edge/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
with:
channel: '#github'
status: ${{ job.status }}
success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
fields: |
[{ "title": "Configuration", "value": "RTIR, MariaDB 10.6", "short": true },
{ "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]
rtir_test_postgresql:
runs-on: ubuntu-latest
steps:
- name: Set up for tests
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
docker network create rt
- name: Check out RTIR
uses: actions/checkout@v2
- name: Cache .prove state
id: cache-prove-state
uses: actions/cache@v3
with:
path: .prove
key: ${{ runner.os }}-pg
- name: Build test environment
run: |
docker run --detach --name rtdb --network rt --mount type=tmpfs,destination=/var/lib/postgresql/data --env POSTGRES_PASSWORD=password postgres:12.8
docker build --build-arg RT_DB_TYPE=Pg --build-arg RT_DBA_USER=postgres --build-arg RT_TEST_DB_HOST=rtdb --network rt --tag rtir .
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make'
- name: Run RTIR tests
run: |
docker run --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && make test-parallel'
- name: Get run time
if: always()
run: |
RT_GA_END_TIME=$(date +%s)
RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
# Convert seconds to HH::MM::SS
RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
echo RT_GA_END_TIME "$RT_GA_END_TIME"
echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
- name: Post results to Slack
if: always()
uses: edge/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
with:
channel: '#github'
status: ${{ job.status }}
success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
fields: |
[{ "title": "Configuration", "value": "RTIR, PostgreSQL 12.8", "short": true },
{ "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]