Skip to content

Commit

Permalink
Update CI and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
MrThearMan committed Jan 29, 2023
1 parent ad7d2ff commit 0aad70d
Show file tree
Hide file tree
Showing 5 changed files with 465 additions and 450 deletions.
41 changes: 3 additions & 38 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,8 @@ on:
- "docs/**"
- "mkdocs.yml"
- ".github/workflows/docs.yml"

env:
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_NO_INTERACTION: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
workflow_dispatch:

jobs:
submit-docs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up poetry
uses: abatilo/actions-poetry@v2.2.0
with:
poetry-version: "1.3.1"

- name: Load cached venv
id: cache-venv
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-docs-v1

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install --no-root

- name: Install project
run: poetry install

- name: Deploy docs
run: poetry run mkdocs gh-deploy --force --strict --verbose
docs:
uses: MrThearMan/CI/.github/workflows/docs.yml@v0.2.2
41 changes: 4 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,8 @@ on:
types:
- created

env:
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_NO_INTERACTION: 1
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up poetry
uses: abatilo/actions-poetry@v2.2.0
with:
poetry-version: "1.3.1"

- name: Load cached venv
id: cache
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-release-v1

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install --no-dev --no-root

- name: Install project
run: poetry install

- name: Publish on PyPi
run: poetry publish --build
release:
uses: MrThearMan/CI/.github/workflows/release.yml@v0.2.2
secrets:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
96 changes: 4 additions & 92 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,98 +9,10 @@ on:
- "pyproject.toml"
- "poetry.lock"
- ".github/workflows/test.yml"

env:
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_NO_INTERACTION: 1
DJANGO_SETTINGS_MODULE: tests.django.settings
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
workflow_dispatch:

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: ["3.8", "3.9", "3.10", "3.11"]
# Sqlite3 not working properly for this version
exclude:
- os: windows-latest
python-version: "3.8"

env:
COVERALLS_FLAG_NAME: python${{ matrix.python-version }}-${{ matrix.os }}

steps:
- name: Check out repository
uses: actions/checkout@v3

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

- name: Set up poetry
uses: abatilo/actions-poetry@v2.2.0
with:
poetry-version: "1.3.1"

- name: Load cached venv
id: cache-venv
uses: actions/cache@v3
with:
path: |
.venv
.tox
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-tox-v1

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install --no-root -E drf

- name: Install project
run: poetry install -E drf

- name: Run tox
run: poetry run tox

- name: Submit coverage
run: poetry run coveralls --service=github

submit-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up poetry
uses: abatilo/actions-poetry@v2.2.0
with:
poetry-version: "1.3.1"

- name: Load cached venv
id: cache-venv
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-cov-v1

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install --no-root

- name: Install project
run: poetry install

- name: Finnish coverage report
run: poetry run coveralls --service=github --finish
uses: MrThearMan/CI/.github/workflows/test.yml@v0.2.2
with:
env: '["py38", "py39", "py310", "py311"]'
Loading

0 comments on commit 0aad70d

Please sign in to comment.