-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (86 loc) · 2.95 KB
/
python-package.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
# This workflow will install Python dependencies, run tests and lint 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: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [opened, synchronize, review_requested]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
POSTGRES_HOST: postgres
POSTGRES_PORT: ${{ job.services.postgres.port[5432] }}
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install git+https://github.com/ohtu2021-kvantti/LibMark
- name: Run migrations
run: |
touch .env
echo DATABASE_NAME=github_actions >> .env
echo DATABASE_USER=postgres >> .env
echo DATABASE_PASSWORD=postgres >> .env
echo DATABASE_HOST=127.0.0.1 >> .env
echo DATABASE_PORT=5432 >> .env
echo SECRET_KEY=secret >> .env
python manage.py makemigrations WebCLI
python manage.py migrate
- name: Lint with flake8
run: flake8 . --show-source --statistics
- name: Lint with curlylint
run: curlylint templates/
- name: Test with Django
run: |
coverage erase
coverage run manage.py test
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
- name: Set up QEMU
if: ${{ github.event_name == 'push'}}
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: ${{ github.event_name == 'push'}}
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: ${{ github.event_name == 'push'}}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build WebMark and push
if: ${{ github.event_name == 'push'}}
uses: docker/build-push-action@v2
with:
push: true
tags: tapanih/quantmark_web:latest
build-args: LIBMARK_VERSION=main
- name: Build BenchMark and push
if: ${{ github.event_name == 'push'}}
uses: docker/build-push-action@v2
with:
push: true
context: BenchMark/
tags: tapanih/quantmark_benchmark:latest
build-args: LIBMARK_VERSION=main