Skip to content

Commit 922ef9f

Browse files
ci: Creating initial github actions
1 parent c5ae1ad commit 922ef9f

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

.github/workflows/common.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Common Workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- dev
8+
9+
jobs:
10+
pre-commit:
11+
name: Pre-commit CI
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup PDM
16+
uses: pdm-project/setup-pdm@v4
17+
with:
18+
python-version: "3.11"
19+
- name: Install dependencies
20+
run: |
21+
pdm install -G :all
22+
- name: Run pre-commit
23+
run: |
24+
pdm pre-commit
25+
26+
test:
27+
name: Test CI
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
python-version: ["3.8", "3.9", "3.10", "3.11"]
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Setup PDM
36+
uses: pdm-project/setup-pdm@v4
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Install project
40+
run: |
41+
pdm install -G :all
42+
- name: Run tests
43+
run: |
44+
pdm test

.github/workflows/main.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Main Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
common:
10+
name: Pre-commit and Test CI
11+
runs-on: ubuntu-latest
12+
13+
needs: [pre-commit, test]
14+
uses: ./.github/workflows/common.yaml
15+
16+
bump-version:
17+
name: Bump Version
18+
needs: common
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup PDM
23+
uses: pdm-project/setup-pdm@v4
24+
- name: Install dependencies
25+
run: |
26+
pdm install -G :all
27+
- name: Install bump
28+
run: |
29+
pdm self add pdm-bump
30+
- name: Bump Version
31+
run: |
32+
pdm bump auto
33+
- name: Push Changes
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
git config --global user.name "github-actions[bot]"
38+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
39+
git push origin main --tags
40+
41+
build:
42+
name: Build and Upload Artifact
43+
runs-on: ubuntu-latest
44+
needs: bump-version
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Setup PDM
48+
uses: pdm-project/setup-pdm@v4
49+
- name: Install dependencies
50+
run: |
51+
pdm install -G :all
52+
- name: Build
53+
run: |
54+
pdm build
55+
- name: Upload Artifact
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: build-artifact
59+
path: dist/*.whl
60+

0 commit comments

Comments
 (0)