Skip to content

Commit 896484e

Browse files
committed
chore: Reformat GH actions code and add script for prerelease publishing.
1 parent 2cd8c2b commit 896484e

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

.github/workflows/merge-dev-to-main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ jobs:
3838
3939
steps:
4040
- uses: actions/checkout@v3
41+
4142
- name: Set up Python ${{ matrix.python-version }}
4243
uses: actions/setup-python@v4
4344
with:
4445
python-version: ${{ matrix.python-version }}
46+
4547
- name: Install Dependencies
4648
run: |
4749
python -m pip install --upgrade pip
4850
pip install -r requirements.txt
4951
pip install psycopg2 mysqlclient
52+
5053
- name: Run Tests With ${{ matrix.db }}
5154
env:
5255
DB: ${{ matrix.db }}
@@ -63,14 +66,18 @@ jobs:
6366
steps:
6467
- name: Checkout repository
6568
uses: actions/checkout@v2
69+
6670
- name: Install Node.js
6771
uses: actions/setup-node@v2
6872
with:
6973
node-version: '16'
74+
7075
- name: Install Antora
7176
run: npm i antora
77+
7278
- name: Generate Site
7379
run: npx antora docs/antora-playbook.yml
80+
7481
- name: Publish to GitHub Pages
7582
uses: peaceiris/actions-gh-pages@v3
7683
with:
@@ -83,6 +90,7 @@ jobs:
8390
runs-on: ubuntu-latest
8491
steps:
8592
- uses: actions/checkout@v3
93+
8694
- uses: everlytic/branch-merge@1.1.2
8795
with:
8896
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ jobs:
99
steps:
1010
- name: Checkout repository
1111
uses: actions/checkout@v4
12+
1213
- name: Install Node.js
1314
uses: actions/setup-node@v4
1415
with:
1516
node-version: '16'
17+
1618
- name: Install Antora
1719
run: npm i antora
20+
1821
- name: Generate Site
1922
run: npx antora docs/antora-playbook.yml
23+
2024
- name: Publish to GitHub Pages
2125
uses: peaceiris/actions-gh-pages@v4
2226
with:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Runs a build test every time a commit is pushed to branch 'main'.
2+
3+
name: Test and Publish Python Package
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*[ab]*'
9+
- 'v*rc*'
10+
11+
jobs:
12+
13+
test-ddm:
14+
uses: ./.github/workflows/test-ddm.yml
15+
16+
publish-docs:
17+
needs: test-ddm
18+
if: success()
19+
uses: ./.github/workflows/publish-docs.yml
20+
21+
deploy:
22+
needs: test-ddm
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: 3.8
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install build
36+
37+
- name: Extract version name
38+
run: echo "PKG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
39+
40+
- name: Update package version in files
41+
run: |
42+
sed -i "s/__version__/$PKG_VERSION/g" setup.cfg
43+
sed -i "s/__version__/$PKG_VERSION/g" ddm/__init__.py
44+
45+
- name: Build package
46+
run: python -m build
47+
48+
- name: Publish package
49+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/publish-to-pypi.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v3
24+
2425
- name: Set up Python ${{ matrix.python-version }}
2526
uses: actions/setup-python@v4
2627
with:
2728
python-version: ${{ matrix.python-version }}
29+
2830
- name: Install Dependencies
2931
run: |
3032
python -m pip install --upgrade pip
3133
pip install -r requirements.txt
34+
3235
- name: Run Tests
3336
run: |
3437
python test_project/manage.py test ddm
@@ -38,14 +41,18 @@ jobs:
3841
steps:
3942
- name: Checkout repository
4043
uses: actions/checkout@v2
44+
4145
- name: Install Node.js
4246
uses: actions/setup-node@v2
4347
with:
4448
node-version: '16'
49+
4550
- name: Install Antora
4651
run: npm i antora
52+
4753
- name: Generate Site
4854
run: npx antora docs/antora-playbook.yml
55+
4956
- name: Publish to GitHub Pages
5057
uses: peaceiris/actions-gh-pages@v3
5158
with:
@@ -57,23 +64,29 @@ jobs:
5764
runs-on: ubuntu-latest
5865
steps:
5966
- uses: actions/checkout@v3
67+
6068
- name: Set up Python
6169
uses: actions/setup-python@v4
6270
with:
6371
python-version: 3.8
72+
6473
- name: Install dependencies
6574
run: |
6675
python -m pip install --upgrade pip
6776
pip install build
77+
6878
- name: Generate new setup.cfg
6979
run: bash version_bump.sh
80+
7081
- name: Build package
7182
run: python -m build
83+
7284
- name: Publish package
7385
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
7486
with:
7587
user: __token__
7688
password: ${{ secrets.PYPI_API_TOKEN }}
89+
7790
- name: Dispatch signal to DDL
7891
uses: peter-evans/repository-dispatch@v2
7992
with:

.github/workflows/test-ddm.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Test DDM
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
max-parallel: 4
11+
matrix:
12+
db: [sqlite, mysql] # postgres
13+
python-version: [3.8, 3.11]
14+
include:
15+
- db: sqlite
16+
db_engine: django.db.backends.sqlite3
17+
18+
- db: mysql
19+
db_port: 3306
20+
db_engine: django.db.backends.mysql
21+
db_user: root
22+
23+
services:
24+
mysql:
25+
image: mysql
26+
env:
27+
MYSQL_ROOT_PASSWORD: password
28+
MYSQL_DATABASE: ddmtestdb
29+
ports:
30+
- 3306:3306
31+
options: >-
32+
--health-cmd="mysqladmin ping"
33+
--health-interval=10s
34+
--health-timeout=5s
35+
--health-retries=3
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
45+
- name: Install Dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -r requirements.txt
49+
pip install psycopg2 mysqlclient
50+
pip install -r test_project/dev_requirements.txt
51+
52+
- name: Run Tests With ${{ matrix.db }}
53+
env:
54+
DB: ${{ matrix.db }}
55+
DB_ENGINE: ${{ matrix.db_engine }}
56+
DB_NAME: ddmtestdb
57+
DB_USER: ${{ matrix.db_user }}
58+
DB_PASSWORD: password
59+
DB_PORT: ${{ matrix.db_port }}
60+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
61+
run: |
62+
python test_project/manage.py test ddm

.github/workflows/test-develop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
include:
1919
- db: sqlite
2020
db_engine: django.db.backends.sqlite3
21+
2122
- db: mysql
2223
db_port: 3306
2324
db_engine: django.db.backends.mysql
@@ -39,16 +40,19 @@ jobs:
3940
4041
steps:
4142
- uses: actions/checkout@v4
43+
4244
- name: Set up Python ${{ matrix.python-version }}
4345
uses: actions/setup-python@v5
4446
with:
4547
python-version: ${{ matrix.python-version }}
48+
4649
- name: Install Dependencies
4750
run: |
4851
python -m pip install --upgrade pip
4952
pip install -r requirements.txt
5053
pip install psycopg2 mysqlclient
5154
pip install -r test_project/dev_requirements.txt
55+
5256
- name: Run Tests With ${{ matrix.db }}
5357
env:
5458
DB: ${{ matrix.db }}

0 commit comments

Comments
 (0)