-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (113 loc) · 4.31 KB
/
continuous-integration-pip.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
# See https://docs.github.com/en/actions/guides/building-and-testing-python
# 2020-02-20 slg - For Dreamhost, we are now using Python 3.9 and Ubuntu-18.04
# There is no way to generate a random password that can be used in the services section, so that will need to be moved to a repository secret of RANDOM_PASSWORD
name: CI (pip)
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
os: ['ubuntu-latest'] # with MySQL service, we now only run on ubuntu
python-version: [3.11] # installed version on Dreamhost
runs-on: ${{ matrix.os }}
services:
# https://stackoverflow.com/questions/72294279/how-to-connect-to-mysql-databas-using-github-actions
mysql:
image: mysql:8.0
env:
# The MySQL docker container requires these environment variables to be set
# so we can create and migrate the test database.
# See: https://hub.docker.com/_/mysql
MYSQL_DATABASE: testdb
MYSQL_ROOT_PASSWORD: testrootpass
ports:
# Opens port 3306 on service container and host
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers
- 3306:3306
# Before continuing, verify the mysql container is reachable from the ubuntu host
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Configure ubuntu with ffmpeg"
if: startsWith(matrix.os, 'ubuntu')
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
- name: "Configure ubuntu"
if: startsWith(matrix.os, 'ubuntu')
run: |
make install-ubuntu
- name: "Configure MacOS"
if: startsWith(matrix.os, 'macos')
run: |
make install-macos
- name: "Configure Windows"
if: startsWith(matrix.os, 'windows')
run: |
make install-windows
- name: "Install Chrome"
id: setup-chrome
uses: browser-actions/[email protected]
with:
chrome-version: stable
- name: "Show Chrome info"
run: |
echo Installed Chrome to ${{ steps.setup-chrome.outputs.chrome-path }}
${{ steps.setup-chrome.outputs.chrome-path }} --version
- name: Install chromedriver
uses: nanasess/[email protected]
- name: Update GITHUB_PATH and install Python dependencies
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
make install-python-dependencies
- name: Lint with pylint
run: |
make pylint
- name: JavaScript and HTML eslint
run: |
make eslint
- name: Create local MySQL database
if: startsWith(matrix.os, 'ubuntu')
env:
MYSQL_ROOT_PASSWORD: testrootpass
PLANTTRACER_CREDENTIALS: etc/credentials.ini
run: |
echo the following assumes that the root configuration is in etc/github_actions_mysql_rootconfig.ini
make create_localdb
- name: Validate app framework
env:
PLANTTRACER_CREDENTIALS: etc/credentials.ini
run: |
make pytest-app-framework
- name: Run coverage test
if: startsWith(matrix.os, 'ubuntu')
env:
SKIP_ENDPOINT_TEST: ${{ vars.SKIP_ENDPOINT_TEST }}
PLANTTRACER_CREDENTIALS: etc/credentials.ini
run: |
CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }} make coverage
- name: Run JavaScript tests and coverage
env:
PLANTTRACER_CREDENTIALS: etc/credentials.ini
run: |
make jscoverage
- name: Upload to codecov.io
if: startsWith(matrix.os, 'ubuntu')
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
files: ./coverage.xml,./coverage/coverage-final.json
- name: Show files in directory
env:
PLANTTRACER_CREDENTIALS: etc/credentials.ini
run: |
make coverage
ls -l