Skip to content

Commit

Permalink
Merge branch 'main' into isabellec/arcadev2output
Browse files Browse the repository at this point in the history
  • Loading branch information
Isabelle-C committed Sep 25, 2023
2 parents 5968462 + 04eaa4d commit f7f53e3
Show file tree
Hide file tree
Showing 39 changed files with 4,100 additions and 1,942 deletions.
99 changes: 89 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:

strategy:
matrix:
python-version: [3.9]
python-version: ["3.9", "3.10"]

steps:

- name: Checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -28,7 +28,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -45,11 +45,90 @@ jobs:
- name: Test with pytest
run: |
source .venv/bin/activate
pytest --cov-report xml --cov=src/ tests/
pytest --cov-report html --cov=src/ tests/
rm htmlcov/.gitignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
- name: Publish coverage report
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
verbose: true
branch: gh-pages
folder: htmlcov
target-folder: _coverage

- name: Extract coverage percent
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
run: |
echo "COVERAGE=$(grep -oP 'pc_cov">\K([0-9]+)' htmlcov/index.html)" >> $GITHUB_ENV
- name: Generate coverage badge
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
uses: knightdave/[email protected]
with:
file: docs/_badges/coverage.svg
label: coverage
value: ${{ env.COVERAGE }}
value_format: "%d%%"
anybadge_args: 50=red 60=orange 80=yellow 100=green
template: docs/_badges/template.svg
overwrite: true

- name: Publish badge
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false

result:
if: ${{ always() }}

runs-on: ubuntu-latest

needs: [build]

steps:

- name: Checkout the repo
uses: actions/checkout@v3

- name: Get build result
run: |
if [[ ${{ needs.build.result }} == "success" || ${{ needs.build.result }} == "skipped" ]]; then
exit 0
else
exit 1
fi
- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/build.svg
label: build
value: passing
color: green
template: docs/_badges/template.svg
overwrite: true

- name: Generate failing badge
if: failure()
uses: knightdave/[email protected]
with:
file: docs/_badges/build.svg
label: build
value: failing
color: red
template: docs/_badges/template.svg
overwrite: true

- name: Publish badge
if: success() || failure()
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false
88 changes: 82 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,101 @@ jobs:
steps:

- name: Checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Install library
run: |
python -m pip install --upgrade pip
pip install Sphinx sphinx-rtd-theme sphinx-mdinclude
poetry install --no-interaction
- name: Generate documentation with Sphinx
run: |
source .venv/bin/activate
make docs
touch docs/_build/html/.nojekyll
- name: Publish docs
uses: JamesIves/[email protected]
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html
clean-exclude: |
_badges
_coverage
- name: Generate style badge
uses: knightdave/[email protected]
with:
file: docs/_badges/style.svg
label: code style
value: black
color: black
template: docs/_badges/template.svg
overwrite: true

- name: Extract license
run: |
echo "LICENSE=$(grep -oP 'license = "\K([A-z-0-9]+)(?=")' pyproject.toml)" >> $GITHUB_ENV
- name: Generate license badge
uses: knightdave/[email protected]
with:
file: docs/_badges/license.svg
label: license
value: ${{ env.LICENSE }}
color: yellowgreen
template: docs/_badges/template.svg
overwrite: true

- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/documentation.svg
label: docs
value: passing
color: green
template: docs/_badges/template.svg
overwrite: true

- name: Generate failing badge
if: failure()
uses: knightdave/[email protected]
with:
file: docs/_badges/documentation.svg
label: docs
value: failing
color: red
template: docs/_badges/template.svg
overwrite: true

- name: Publish badge
if: success() || failure()
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html/
folder: docs/_badges
target-folder: _badges
clean: false
44 changes: 40 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
steps:

- name: Checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -24,7 +24,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -44,7 +44,43 @@ jobs:
source .venv/bin/activate
black -l 100 --check src/ tests/
- name: Check with isort
run: |
source .venv/bin/activate
isort -l 100 --check src/ tests/
- name: Check with mypy
run: |
source .venv/bin/activate
mypy --config-file mypy.ini src
mypy src
- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/lint.svg
label: lint
value: passing
color: green
template: docs/_badges/template.svg
overwrite: true

- name: Generate failing badge
if: failure()
uses: knightdave/[email protected]
with:
file: docs/_badges/lint.svg
label: lint
value: failing
color: red
template: docs/_badges/template.svg
overwrite: true

- name: Publish badge
if: success() || failure()
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false
36 changes: 31 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ on:
- closed

jobs:
release:
publish:
if: ${{ (startsWith(github.event.pull_request.head.ref, 'release/')) && (github.event.pull_request.merged == true) }}

runs-on: ubuntu-latest

permissions:
id-token: write
contents: write
pull-requests: read

steps:

- name: Checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Extract version from branch name
run: |
Expand Down Expand Up @@ -46,6 +51,10 @@ jobs:
{
"title": "## 📓 Documentation",
"labels": ["type: docs"]
},
{
"title": "## 📁 Admin",
"labels": ["type: admin"]
}
],
"template": "#{{CHANGELOG}}---\n\n**Full Changelog**: https://github.com/${{ github.repository }}/compare/#{{FROM_TAG}}...${{ env.RELEASE_VERSION }}\n",
Expand All @@ -61,10 +70,9 @@ jobs:
tag: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
body: ${{ steps.build_changelog.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -80,5 +88,23 @@ jobs:
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

- name: Generate version badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/version.svg
label: version
value: ${{ env.RELEASE_VERSION }}
color: teal
template: docs/_badges/template.svg
overwrite: true

- name: Publish badge
if: success()
uses: JamesIves/github-pages-deploy-action@v4
with:
password: ${{ secrets.PYPI_TOKEN }}
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false
Loading

0 comments on commit f7f53e3

Please sign in to comment.