Skip to content

Commit

Permalink
Setup GitHub actions (#1)
Browse files Browse the repository at this point in the history
* Setup GitHub actions

* Improve CI workflow and add documentation build one

---------

Co-authored-by: Piotr Gródek <[email protected]>
  • Loading branch information
piotr-grodek-dsai and rAum authored Nov 3, 2023
1 parent 4d6bfc4 commit 8bfd46e
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lints:
name: Run linters
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit
run: pip3 install pre-commit

- name: Run pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure --color always

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: "fs"
ignore-unfixed: true
format: "table"
severity: "CRITICAL,HIGH"

- name: Create venv
run: . ./setup_dev_env.sh

- name: Check licenses
run: ./check_licenses.sh

tests:
name: Run tests
runs-on: ubuntu-latest
container: python:3.11

steps:
- uses: actions/checkout@v2

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: pip install -r requirements-dev.txt

- name: Run Tests
run: pytest -v -p no:warnings --junitxml=report.xml tests/

- name: Publish Test Report
uses: actions/upload-artifact@v2
with:
name: Test Report
path: report.xml
retention-days: 10
33 changes: 33 additions & 0 deletions .github/workflows/doumentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [main]

jobs:
pages:
runs-on: ubuntu-latest
container: python:3.11

steps:
- uses: actions/checkout@v2

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: pip install -r requirements.txt

- name: Build docs
run: ./build_docs.sh

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

0 comments on commit 8bfd46e

Please sign in to comment.