This repository has been archived by the owner on Apr 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (53 loc) · 2 KB
/
pythonapp.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Poetry
uses: dschep/[email protected]
- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}
- name: Set Poetry config
run: |
poetry config --local virtualenvs.in-project false
poetry config --local virtualenvs.path ~/.virtualenvs
- name: Install Dependencies
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'
- name: Configure project
run: cp config.py.example config.py
- name: Code Quality
run: poetry run black . --check
- name: Check types statically
run: poetry run mypy . --strict
- name: Test with pytest
run: poetry run pytest
env:
MONGO_URI: ${{ secrets.MongoUri }}
FLASK_ENV: testing
- name: Log in to GitHub Packages
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
- name: Build the Docker image
if: success()
run: docker build . --file Dockerfile --tag docker.pkg.github.com/ito-org/api-download/api-download:latest
- name: Publish the Docker image on GitHub Packages
if: success()
run: docker push docker.pkg.github.com/ito-org/api-download/api-download:latest