52 lines (49 loc) · 1.57 KB
/
python.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
name: Raise and nuture Kevin Malone
on:
pull_request:
branches:
- "master"
- "staging"
env:
APP_NAME: ${{ 'kevin-malone-test' }}
jobs:
# Run code tests before building the image, to ensure it is good to go
build:
name: Run code tests
runs-on: ubuntu-latest
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create env file
run: |
touch .env
echo API_TOKEN=FAKEAPITOKEN >> .env
echo CLIENT_ID=FAKECLIENTID >> .env
echo BOT_DEBUG=true >> .env
echo GOVRN_GUILD_ID=xxx >> .env
echo TASK_WAKEUP_PERIOD_MINUTES=xxx >> .env
echo WEEKLY_REPORT_MINIMUM_TIME_BETWEEN_LOOP_SECONDS=xxx >> .env
echo WEEKLY_REPORT_ENABLE=false >> .env
echo WEEKLY_REPORT_WEEKDAY=xxx >> .env
echo WEEKLY_REPORT_TIME=xxx >> .env
echo TEST_CHANNEL=xxx >> .env
cat .env
- name: Build docker image
run: docker build -t local .
- name: Run tests
run: docker run --env REDIS_URL=redis://redis --env IS_DEV=True local pytest .
- name: Check formatting with black
run: docker run local black . --check
- name: Lint with flake8
run: docker run local flake8 .