forked from evennia/evennia
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (126 loc) · 4.8 KB
/
github_action_test_suite.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
# This Evennia workflow will install Python dependencies, run tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: test-suite
on:
push:
branches: [ master, develop ]
paths-ignore:
- 'docs/**'
pull_request:
branches: [ master, develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
TESTING_DB: ['sqlite3', 'postgresql', 'mysql']
steps:
- uses: actions/checkout@v2
- name: Set up PostgreSQL server
uses: harmon758/postgresql-action@v1
if: ${{ matrix.TESTING_DB == 'postgresql' }}
with:
postgresql version: '10.7'
postgresql db: 'evennia'
postgresql user: 'evennia'
postgresql password: 'password'
- name: Set up MySQL server
uses: mirromutth/[email protected]
if: ${{ matrix.TESTING_DB == 'mysql'}}
with:
host port: 3306
character set server: 'utf8mb4'
collation server: 'utf8mb4_unicode_ci'
mysql database: 'evennia'
mysql user: 'evennia'
mysql password: 'password'
# wait for db to activate, get logs from their start
- name: Wait / sleep
uses: jakejarvis/[email protected]
if: ${{ matrix.TESTING_DB == 'postgresql' || matrix.TESTING_DB == 'mysql' }}
with:
time: '10s'
- name: Database container logs
uses: jwalton/[email protected]
- name: Check running containers
run: docker ps -a
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install package dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install psycopg2-binary==2.8.6 # fix issue for Django 2.2
pip install mysqlclient
pip install coveralls
pip install codacy-coverage
pip install -e .
- name: Install extra dependencies # Only develop branch right now
if: ${{ github.ref == 'refs/heads/develop' }}
run: pip install -r requirements_extra.txt
- name: Initialize evennia
run: |
evennia --init testing_mygame
cp .github/workflows/${{ matrix.TESTING_DB }}_settings.py testing_mygame/server/conf/settings.py
cd testing_mygame
evennia migrate
evennia collectstatic --noinput
- name: Run test suite
run: |
cd testing_mygame
coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia
coverage xml
# we only want to run coverall/codacy once, so we only do it for one of the matrix combinations
# it's also not critical if pushing to either service fails (happens for PRs since env is not
# available outside of the evennia org)
- name: Send data to Coveralls
if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }}
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
cd testing_mygame
coveralls
- name: Send data to Codacy
if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }}
continue-on-error: true
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./testing_mygame/coverage.xml
# docker setup and push
-
name: Set up QEMU
if: matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
if: matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push for master
if: matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 && github.ref == 'refs/heads/master'
id: docker_build_master
uses: docker/build-push-action@v2
with:
push: true
tags: evennia/evennia:latest
-
name: Build and push for develop
if: matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 && github.ref == 'refs/heads/develop'
id: docker_build_develop
uses: docker/build-push-action@v2
with:
push: true
tags: evennia/evennia:develop