-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (98 loc) · 2.96 KB
/
ci.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
name: ci
on: [push, pull_request]
jobs:
build_image:
runs-on: ubuntu-20.04
outputs:
imageid: ${{ steps.build.outputs.imageid }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and export
id: build
uses: docker/build-push-action@v2
with:
tags: cblessing24/compenv:latest
outputs: type=oci,dest=/tmp/image.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v3
with:
name: image
path: /tmp/image.tar
lint:
needs: build_image
runs-on: ubuntu-20.04
strategy:
matrix:
linter: ["black", "isort", "mypy", "flake8", "pylint"]
steps:
- name: Load image
uses: cblessing24/load-docker-image@v1
with:
name: image
path: /tmp
tag: cblessing24/compenv:latest
- name: Check out code
uses: actions/checkout@v2
- name: Lint code
run: touch .env && docker-compose run ${{ matrix.linter }}
test:
needs: build_image
runs-on: ubuntu-20.04
steps:
- name: Load image
uses: cblessing24/load-docker-image@v1
with:
name: image
path: /tmp
tag: cblessing24/compenv:latest
- name: Check out code
uses: actions/checkout@v2
- name: Test code
run: touch .env && docker-compose run pytest_github
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
push_image:
needs: [build_image, lint, test]
runs-on: ubuntu-20.04
steps:
- name: Load image
uses: cblessing24/load-docker-image@v1
with:
name: image
path: /tmp
tag: cblessing24/compenv:latest
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: |
docker tag cblessing24/compenv:latest cblessing24/compenv:${{ github.sha }}
docker push cblessing24/compenv:latest
docker push cblessing24/compenv:${{ github.sha }}
publish_package:
if: startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'sinzlab'
needs: [build_image, lint, test]
runs-on: ubuntu-20.04
steps:
- name: Load image
uses: cblessing24/load-docker-image@v1
with:
name: image
path: /tmp
tag: cblessing24/compenv:latest
- name: Check out code
uses: actions/checkout@v2
- name: Build distribution artifacts
run: touch .env && docker-compose run build
- name: Upload distribution packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}