-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (78 loc) · 2.37 KB
/
simple_run_test.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
name: test-different-python-versions
on: [push, pull_request]
jobs:
formatter:
name: runner black code formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: rickstaa/action-black@v1
with:
black_args: ". --check"
run-job-generator:
runs-on: ubuntu-latest
needs: formatter
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
name: Check job generator example with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install package
run: python setup.py install
- name: run unit tests
run: cd tests && python -m unittest && cd ..
- name: run integration test
run: python example/example.py --verify 3.0 && cat jobs.yml
check-version:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
name: checks if the version.txt is different compare to the main branch
needs: run-job-generator
steps:
- uses: actions/checkout@v3
with:
path: pr
- uses: actions/checkout@v3
with:
ref: main
path: main
- name: check version.txt
run: |
if ! diff pr/version.txt main/version.txt >> /dev/null ; then
echo "the versions are different"
exit 0
else
echo "the same version as in the main branch"
exit 1
fi
build-package:
runs-on: ubuntu-latest
name: Build pip package and upload it
needs: run-job-generator
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
architecture: x64
- name: install requirements
run: |
python -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade twine
- name: Build pip package
run: python3 -m build
- run: ls dist
- name: publish a package to pypi.org
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}