Skip to content

Commit 8baeb85

Browse files
authored
ci: add tests to publish build workflow
1 parent 65d4c99 commit 8baeb85

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,62 @@ on:
1313
type: boolean
1414

1515
jobs:
16+
tests:
17+
name: Run Tests
18+
runs-on: ubuntu-latest
19+
container: ghcr.io/ietf-tools/datatracker-test-base:latest
20+
21+
services:
22+
db:
23+
image: ghcr.io/ietf-tools/datatracker-db:latest
24+
volumes:
25+
- mariadb-data:/var/lib/mysql
26+
env:
27+
MYSQL_ROOT_PASSWORD: ietf
28+
MYSQL_DATABASE: ietf_utf8
29+
MYSQL_USER: django
30+
MYSQL_PASSWORD: RkTkDPFnKpko
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Prepare for tests
36+
run: |
37+
echo "Running containers:"
38+
docker ps -a
39+
echo "Fixing permissions..."
40+
chmod -R 777 ./
41+
echo "Copying config files..."
42+
cp ./docker/configs/settings_local.py ./ietf/settings_local.py
43+
echo "Installing NPM packages..."
44+
npm install --prefer-offline --no-audit
45+
echo "Building static assets..."
46+
npx parcel build
47+
echo "Creating data directories..."
48+
chmod +x ./docker/scripts/app-create-dirs.sh
49+
./docker/scripts/app-create-dirs.sh
50+
51+
- name: Ensure DB is ready
52+
run: |
53+
/usr/local/bin/wait-for db:3306 -- echo "DB ready"
54+
55+
- name: Run all tests
56+
run: |
57+
echo "Running checks..."
58+
./ietf/manage.py check
59+
echo "Running tests..."
60+
./ietf/manage.py test --settings=settings_sqlitetest --failfast
61+
mv latest-coverage.json coverage.json
62+
63+
- name: Upload a Coverage Results
64+
uses: actions/upload-artifact@v3.0.0
65+
with:
66+
name: coverage
67+
path: coverage.json
68+
1669
publish:
70+
needs:
71+
- tests
1772
runs-on: ubuntu-latest
1873

1974
steps:
@@ -80,6 +135,11 @@ jobs:
80135
with:
81136
python-version: '3.x'
82137

138+
- name: Download a Coverage Results
139+
uses: actions/download-artifact@v3.0.0
140+
with:
141+
name: coverage
142+
83143
- name: Make Release Build
84144
env:
85145
DEBIAN_FRONTEND: noninteractive
@@ -113,7 +173,7 @@ jobs:
113173
tag: ${{ env.PKG_VERSION }}
114174
name: ${{ env.PKG_VERSION }}
115175
body: ${{ steps.changelog.outputs.changes }}
116-
artifacts: "/home/runner/work/release/release.tar.gz"
176+
artifacts: "/home/runner/work/release/release.tar.gz,coverage.json"
117177
token: ${{ secrets.GITHUB_TOKEN }}
118178

119179
- name: Upload Build Artifacts

0 commit comments

Comments
 (0)