Skip to content

Commit

Permalink
[#13] Refactor after open-api-workflow d6a9fe1ff6c9ac6487839cda5907de…
Browse files Browse the repository at this point in the history
…6049d8aaec
  • Loading branch information
SonnyBA committed Sep 16, 2024
1 parent daab0e7 commit b99aba4
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 136 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ env:
jobs:
# determine changed files to decide if certain jobs can be skipped or not
changed-files:
runs-on: ubuntu-latest # windows-latest | macos-latest
runs-on: ubuntu-latest
name: Determine changed files
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Get changed PY files
id: changed-py-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v45
with:
files: |
^src/.+\.py
files: src/{,**/}*.py

- name: Get changed requirements files
id: changed-requirements
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v45
with:
files: ^requirements/.+\.txt$
files: requirements/*.txt

outputs:
changed-py-files: ${{ steps.changed-py-files.outputs.any_changed }}
Expand Down Expand Up @@ -68,19 +68,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Set up backend environment
uses: maykinmedia/[email protected]
with:
python-version: '3.11'
- uses: actions/setup-node@v4
with:
node-version: '18'
setup-node: true

- name: Install dependencies
run: pip install -r requirements/dev.txt codecov
- name: Build frontend
run: |
npm ci
npm run build
- name: Run tests
run: |
python src/manage.py collectstatic --noinput --link
Expand All @@ -103,7 +96,7 @@ jobs:
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Install dependencies
run: pip install -r requirements/ci.txt pytest
run: pip install -r requirements/ci.txt
- name: Generate environment variable documentation using OAf and check if it was updated
run: |
bin/generate_envvar_docs.sh
Expand All @@ -119,7 +112,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
image-name: ${{ steps.image-name.outputs.image-name }}
sphinx-ssl-conf: ${{ steps.sphinx-ssl-conf.outputs.sphinx-ssl-conf }}

steps:
- run: echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT
Expand All @@ -136,3 +128,6 @@ jobs:
python-version: '3.11'
docker-image-name: ${{ needs.store-reusable-workflow-vars.outputs.image-name }}
repository-owner: 'maykinmedia'
secrets:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-token: ${{ secrets.DOCKER_TOKEN }}
4 changes: 0 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@ jobs:
node-version: '18'
postgres-version: 'latest'

isort-src-pattern: 'src'
black-src-pattern: 'src docs'
flake8-src-pattern: 'src'

django-settings-module: 'openklant.conf.ci'
django-secret-key: dummy
7 changes: 7 additions & 0 deletions .github/workflows/generate-postman-collection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ on:
jobs:
open-api-workflow-generate-postman-collection:
uses: maykinmedia/open-api-workflows/.github/workflows/generate-postman-collection.yml@initial-setup
strategy:
matrix:
component:
- contactgevens
- klantinteracties
with:
schema-path: 'src/openklant/components/${{ matrix.component }}/openapi.yaml'
7 changes: 7 additions & 0 deletions .github/workflows/generate-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ on:
jobs:
open-api-workflow-generate-sdks:
uses: maykinmedia/open-api-workflows/.github/workflows/generate-sdks.yml@initial-setup
strategy:
matrix:
component:
- contactgevens
- klantinteracties
with:
schema-path: 'src/openklant/components/${{ matrix.component }}/openapi.yaml'
7 changes: 7 additions & 0 deletions .github/workflows/lint-oas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ on:
jobs:
open-api-workflow-lint-oas:
uses: maykinmedia/open-api-workflows/.github/workflows/lint-oas.yml@initial-setup
strategy:
matrix:
component:
- contactgevens
- klantinteracties
with:
schema-path: 'src/openklant/components/${{ matrix.component }}/openapi.yaml'
25 changes: 25 additions & 0 deletions .github/workflows/oas-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: check-oas

on:
push:
paths:
- "src/openklant/components/*/openapi.yaml"
- .github/workflows/oas-check.yml
branches:
- '**'
workflow_dispatch:

jobs:
open-api-workflow-check-oas:
uses: maykinmedia/open-api-workflows/.github/workflows/oas-check.yml@initial-setup
strategy:
matrix:
component:
- contactgegevens
- klantinteracties
with:
schema-path: 'src/openklant/components/${{ matrix.component }}/openapi.yaml'
schema-command: 'spectacular_for_component'
schema-options: "--component ${{ matrix.component }}"
python-version: '3.11'
django-settings-module: 'openklant.conf.ci'
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
30 changes: 0 additions & 30 deletions bin/check_schema.sh

This file was deleted.

9 changes: 6 additions & 3 deletions bin/compile_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export CUSTOM_COMPILE_COMMAND="./bin/compile_dependencies.sh"
# Base (& prod) deps
pip-compile \
--no-emit-index-url \
--output-file requirements/base.txt \
--output-file requirements/production.txt \
"$@" \
requirements/base.in

Expand All @@ -33,12 +35,13 @@ pip-compile \
"$@" \
requirements/base.txt \
requirements/test-tools.in \
requirements/docs.in
requirements/ci.in

# Dev depedencies - exact same set as CI + some extra tooling
pip-compile \
--no-emit-index-url \
--output-file requirements/dev.txt \
"$@" \
requirements/ci.txt \
requirements/dev.in
requirements/base.txt \
requirements/test-tools.in \
requirements/dev.in
22 changes: 0 additions & 22 deletions bin/generate_postman_collection.sh

This file was deleted.

42 changes: 0 additions & 42 deletions bin/generate_sdks.sh

This file was deleted.

16 changes: 0 additions & 16 deletions bin/lint_oas_files.sh

This file was deleted.

1 change: 1 addition & 0 deletions requirements/ci.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
codecov
pytest
7 changes: 7 additions & 0 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ inflection==0.5.1
# -r requirements/base.txt
# drf-spectacular
# drf-yasg
iniconfig==2.0.0
# via pytest
iso-639==0.4.5
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -439,6 +441,7 @@ packaging==24.1
# -r requirements/base.txt
# black
# drf-yasg
# pytest
# sphinx
pathspec==0.12.1
# via black
Expand All @@ -452,6 +455,8 @@ platformdirs==4.2.2
# via
# black
# pylint
pluggy==1.5.0
# via pytest
prometheus-client==0.20.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -495,6 +500,8 @@ pypng==0.20220715.0
# qrcode
pyquery==2.0.0
# via -r requirements/test-tools.in
pytest==8.3.3
# via -r requirements/ci.in
python-dateutil==2.9.0.post0
# via
# -r requirements/base.txt
Expand Down

0 comments on commit b99aba4

Please sign in to comment.