Skip to content

Commit 8bfd46e

Browse files
Setup GitHub actions (#1)
* Setup GitHub actions * Improve CI workflow and add documentation build one --------- Co-authored-by: Piotr Gródek <grodekpiotr+gh@gmail.com>
1 parent 4d6bfc4 commit 8bfd46e

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

.github/workflows/ci.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lints:
11+
name: Run linters
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Cache pre-commit
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.cache/pre-commit
24+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
25+
26+
- name: Install pre-commit
27+
run: pip3 install pre-commit
28+
29+
- name: Run pre-commit checks
30+
run: pre-commit run --all-files --show-diff-on-failure --color always
31+
32+
- name: Run Trivy vulnerability scanner
33+
uses: aquasecurity/trivy-action@0.12.0
34+
with:
35+
scan-type: "fs"
36+
ignore-unfixed: true
37+
format: "table"
38+
severity: "CRITICAL,HIGH"
39+
40+
- name: Create venv
41+
run: . ./setup_dev_env.sh
42+
43+
- name: Check licenses
44+
run: ./check_licenses.sh
45+
46+
tests:
47+
name: Run tests
48+
runs-on: ubuntu-latest
49+
container: python:3.11
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
54+
- name: Cache Dependencies
55+
uses: actions/cache@v2
56+
with:
57+
path: ~/.cache/pip
58+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
59+
restore-keys: |
60+
${{ runner.os }}-pip-
61+
62+
- name: Install Dependencies
63+
run: pip install -r requirements-dev.txt
64+
65+
- name: Run Tests
66+
run: pytest -v -p no:warnings --junitxml=report.xml tests/
67+
68+
- name: Publish Test Report
69+
uses: actions/upload-artifact@v2
70+
with:
71+
name: Test Report
72+
path: report.xml
73+
retention-days: 10

.github/workflows/doumentation.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
pages:
9+
runs-on: ubuntu-latest
10+
container: python:3.11
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Cache Dependencies
16+
uses: actions/cache@v2
17+
with:
18+
path: ~/.cache/pip
19+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
20+
restore-keys: |
21+
${{ runner.os }}-pip-
22+
23+
- name: Install Dependencies
24+
run: pip install -r requirements.txt
25+
26+
- name: Build docs
27+
run: ./build_docs.sh
28+
29+
- name: Deploy
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./public

0 commit comments

Comments
 (0)