Skip to content

Commit aa567c6

Browse files
authored
Merge pull request #1 from esloch/add-ci-workflow
feat(ci): Create initial workflow configuration
2 parents a79176c + 20986ad commit aa567c6

File tree

7 files changed

+293
-152
lines changed

7 files changed

+293
-152
lines changed

.env.tpl

Whitespace-only changes.

.github/workflows/main.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
push:
8+
branches: ["master", "main"]
9+
10+
jobs:
11+
check-branch:
12+
if: ${{ github.event_name == 'pull_request' }}
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
concurrency:
16+
group: check-pr-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Check if the PR's branch is updated
25+
uses: osl-incubator/[email protected]
26+
with:
27+
remote_branch: origin/main
28+
pr_sha: ${{ github.event.pull_request.head.sha }}
29+
linter:
30+
runs-on: ubuntu-latest
31+
32+
concurrency:
33+
group: ci-linter-${{ github.ref }}
34+
cancel-in-progress: true
35+
36+
defaults:
37+
run:
38+
shell: bash -l {0}
39+
40+
steps:
41+
- name: Checkout Code Repository
42+
uses: actions/checkout@v4
43+
44+
- name: Create environment variables files
45+
run: |
46+
envsubst < .env.tpl > .env
47+
48+
- uses: conda-incubator/setup-miniconda@v3
49+
with:
50+
miniconda-version: "latest"
51+
environment-file: conda/dev.yaml
52+
channels: conda-forge,nodefaults
53+
activate-environment: pydantic-to-django-model
54+
auto-update-conda: true
55+
conda-solver: libmamba
56+
57+
- name: Install dependencies
58+
run: |
59+
poetry check
60+
poetry config virtualenvs.create false
61+
poetry install
62+
63+
- name: Linter
64+
run: |
65+
pre-commit install
66+
pre-commit run --all-files

.github/workflows/release.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
check-branch:
11+
if: ${{ github.event_name == 'pull_request' }}
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
concurrency:
15+
group: check-pr-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
defaults:
19+
run:
20+
shell: bash -el {0}
21+
22+
steps:
23+
- name: Checkout Code Repository
24+
uses: actions/checkout@v4
25+
26+
- uses: conda-incubator/setup-miniconda@v3
27+
with:
28+
miniconda-version: "latest"dev
29+
environment-file: conda/release.yaml
30+
channels: conda-forge,nodefaults
31+
activate-environment: pydantic-to-django-model-release
32+
auto-update-conda: true
33+
conda-solver: libmamba
34+
35+
- name: Create file with environment variables
36+
run: touch .env
37+
38+
- name: Install dependencies
39+
run: poetry install
40+
41+
- name: Update npm
42+
run: npm -g update npm
43+
44+
- name: Run semantic release (for tests)
45+
if: ${{ github.event_name != 'workflow_dispatch' }}
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: makim release.dry
49+
50+
- name: Release command
51+
if: ${{ github.event_name == 'workflow_dispatch' }}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
55+
run: |
56+
makim release.ci
57+
58+
- name: Generate documentation with changes from semantic-release
59+
run: makim docs.build
60+
61+
- name: GitHub Pages action
62+
if: ${{ github.event_name == 'workflow_dispatch' }}
63+
uses: peaceiris/[email protected]
64+
with:
65+
github_token: ${{ secrets.GITHUB_TOKEN }}
66+
publish_dir: ./build

.pre-commit-config.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: "^docs/|/migrations/|devcontainer.json"
22
default_stages: [pre-commit]
33

44
default_language_version:
5-
python: python3.10
5+
python: python3.12
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -25,14 +25,12 @@ repos:
2525
- id: djlint-reformat-django
2626
files: "\\.html"
2727
types_or: ['html']
28-
# it is necessary to exclude src/literev/templates/tags because of the
2928
# following issue:
3029
# - https://github.com/Riverside-Healthcare/djLint/issues/703
3130
exclude: ".git"
3231
- id: djlint-django
3332
files: "\\.html"
3433
types_or: ['html']
35-
# it is necessary to exclude src/literev/templates/tags because of the
3634
# following issue:
3735
# - https://github.com/Riverside-Healthcare/djLint/issues/703
3836
exclude: ".git"
@@ -52,7 +50,7 @@ repos:
5250
name: ruff-linter
5351
entry: ruff check
5452
language: system
55-
exclude: "docs/|migrations/.*|literev/urls.py"
53+
exclude: "docs/|migrations/.*"
5654
pass_filenames: true
5755
types:
5856
- python

conda/release.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pydantic-to-django-model-release
2+
channels:
3+
- nodefaults
4+
- conda-forge
5+
dependencies:
6+
- nodejs >=18
7+
- python 3.12.*
8+
- poetry >=1.5
9+
- pip:
10+
- makim==1.10.0
11+
# fix issues with distlib
12+
- paginate
13+
# fix issues with distlib
14+
- jsbeautifier

0 commit comments

Comments
 (0)