forked from linkml/linkml
-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (68 loc) · 2.13 KB
/
main.yaml
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
name: Build
on:
push:
branches: [ main ]
jobs:
unittests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Test with unittest
run: |
pipenv run python -m unittest discover -p 'test_*.py'
commits:
needs: unittests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Update requirements
run: |
python -m pip install --upgrade pip
pip install pipenv-to-requirements
pipenv_to_requirements
git add requirements*.txt
if [[ ! -z $(git status -s requirements*.txt) ]]
then
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'Automatically generated requirements.txt and requirements-dev.txt' requirements*.txt
git push
fi
- name: Check in test outputs
run: |
pip install pipenv
pipenv install --dev
pipenv run python -m unittest discover -p 'test_*.py'
find tests -name output -exec git add --force {} \;
if [[ ! -z $(git status -s tests) ]]
then
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'Automated adding outputs from tests' tests
git push
fi
- name: Check in test updated notebooks
run: |
if [[ ! -z $(git status -s notebooks) ]]
then
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'Automated adding updated notebooks' notebooks
git push
fi