-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (94 loc) · 2.63 KB
/
main.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
name: CI
on: [push]
jobs:
upload_progress_bar_to_wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: wiki
- run: |
cd wiki
printf '%s\n%s\n' "## Tests are running! Please wait!" "![](progress.gif)" > Home.md
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit --allow-empty -m "Add progress bar"
git push
run_tests:
needs: upload_progress_bar_to_wiki
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Install prerequisites
run: |
sudo apt install -y libgtest-dev
python -m pip install --upgrade pip pipenv
- name: Initialize workspace
run: >
pipenv install
- name: Lint with Black linter
run: >
pipenv run black homework_checker/**/*.py --check --diff
- name: Run unit tests
run: >
pipenv run python3 -m unittest discover -v homework_checker/core/tests/
- name: Upload result md file
uses: actions/upload-artifact@v2
with:
name: homework_result
path: results.md
upload_results_to_wiki:
needs: run_tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: wiki
- name: Download result md file
uses: actions/download-artifact@v2
with:
name: homework_result
- run: |
mv results.md wiki/Home.md
cd wiki
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit --allow-empty -m "Update results"
git push
publish_to_pypi:
needs: run_tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Install pypa/build
run: python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}