Merge pull request #727 from SUSE/tw_postgres #1159
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
jobs: | |
format: | |
name: Ensure code is properly formatted | |
runs-on: ubuntu-latest | |
container: ghcr.io/dcermak/bci-ci:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: poetry-${{ hashFiles('poetry.lock') }} | |
- name: Run black and reorder-python-imports | |
run: | | |
poetry install | |
poetry run bash ./format.sh --check | |
ci: | |
name: Run the unit tests | |
runs-on: ubuntu-latest | |
container: ghcr.io/dcermak/bci-ci:latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.tox | |
key: tox-${{ matrix.python_version }}-${{ hashFiles('poetry.lock') }} | |
- run: | | |
poetry install | |
poetry run pytest -vv | |
- run: | | |
mkdir -p pkg_dest | |
for pkg in $(poetry run package --help|grep '{'|head -1|sed -e 's|{||' -e 's|}||' -e 's|,| |g' -e 's|\s+||'); do | |
poetry run package $pkg pkg_dest | |
done | |
documentation: | |
name: Build the documentation | |
runs-on: ubuntu-latest | |
container: ghcr.io/dcermak/bci-ci:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install dependencies | |
run: poetry install | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.tox | |
key: tox-${{ hashFiles('poetry.lock') }} | |
- name: build the documentation with sphinx | |
run: poetry run sphinx-build -M html source build -W | |
- name: upload the build directory | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: ./build/html | |
deploy: | |
name: deploy to the gh-pages branch | |
runs-on: ubuntu-latest | |
needs: documentation | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: ./build | |
- run: touch ./build/.nojekyll | |
- name: deploy to github pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: build |