i #9
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: | |
env: | |
CACHE_VERSION: 1 | |
POETRY_HOME: /opt/poetry | |
POETRY_CACHE: /opt/poetry_cache | |
jobs: | |
lint_and_test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Cache deps install | |
id: cache-deps | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.POETRY_HOME }} | |
${{ env.POETRY_CACHE }} | |
key: cachepoetry-${{ hashFiles('poetry.lock') }}-${{ env.CACHE_VERSION }} | |
- name: Install poetry | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
python3 -m venv $POETRY_HOME | |
$POETRY_HOME/bin/pip install poetry | |
- name: Fix github path | |
run: | | |
echo "$POETRY_HOME/bin" >> "$GITHUB_PATH" | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project false | |
poetry config cache-dir $POETRY_CACHE | |
poetry config virtualenvs.path $POETRY_CACHE/venv | |
- name: Install requirements | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
poetry install --no-root | |
- name: Install | |
run: | | |
poetry install | |
- name: Run lint | |
run: | | |
poetry run make LINT_FIX=0 lint | |
- name: Run test | |
run: | | |
poetry run make COVERAGE=1 test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Make apidocs | |
run: | | |
poetry run make apidoc | |
- name: Upload API doc as an artifact | |
uses: actions/upload-artifact@v3 | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
with: | |
name: apidoc | |
path: apihtml/ | |
githubpages: | |
runs-on: ubuntu-latest | |
needs: lint_and_test | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- name: Download API doc artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: apidoc | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |