64 lines (54 loc) · 1.5 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
name: CI
on:
push:
pull_request:
# schedule:
# - cron: '9 * * * *'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
name: Test code
steps:
- name: Checkout ladino-diksionaryo-code
uses: actions/checkout@v3
with:
repository: 'kantoniko/ladino-diksionaryo-code'
path: .
- name: Checkout ladino-diksionaryo-data
uses: actions/checkout@v3
with:
repository: 'kantoniko/ladino-diksionaryo-data'
path: ladino-diksionaryo-data
- name: Install dependencies
run: |
python -V
pip install -r requirements.txt
- name: Run tests
run: |
pytest -sv --random-order tests/
- name: Run check
env:
PYTHONPATH: .
run: python ladino/generate.py --dictionary ladino-diksionaryo-data
generate:
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
name: Generate HTML
needs: [test]
steps:
- name: Generate HTML
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token $PERSONAL_ACCESS_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/kantoniko/kantoniko.github.io/actions/workflows/ci.yml/dispatches \
-d '{"ref":"main"}' | tee out.txt
if [ -s out.txt ]
then
exit 1
else
exit 0
fi