Skip to content

Commit 38e06b5

Browse files
authored
Merge pull request #11 from MrMatAP/feature/auth
Build modernisation
2 parents 2353cec + dcc8623 commit 38e06b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2461
-517
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#
2+
# Perform a regular build on any branch except main
3+
4+
name: build
5+
6+
on:
7+
push:
8+
pull_request:
9+
types: [opened, synchronize]
10+
11+
jobs:
12+
# Prepare the build
13+
prep:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
outputs:
18+
abort: ${{ steps.debounce.outputs.abort }}
19+
version: ${{ steps.version.outputs.version }}
20+
steps:
21+
- name: Abort building on push with open PR
22+
id: debounce
23+
uses: MrMatAP/[email protected]
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
- name: Version the project
27+
id: version
28+
uses: MrMatAP/[email protected]
29+
with:
30+
ecosystem: python
31+
major: 1
32+
minor: 1
33+
34+
# A regular project build. Test results will explicitly be reported during a pull request build
35+
build:
36+
runs-on: ubuntu-latest
37+
needs: prep
38+
if: ${{ needs.prep.outputs.abort != 'true' }}
39+
permissions:
40+
contents: read
41+
pull-requests: write
42+
checks: write
43+
env:
44+
MRMAT_VERSION: ${{ needs.prep.outputs.version }}
45+
steps:
46+
- name: Checkout out our code
47+
uses: actions/[email protected]
48+
- name: Set up uv and Python
49+
uses: astral-sh/[email protected]
50+
with:
51+
enable-cache: true
52+
python-version: 3.13.7
53+
- name: Lint
54+
run: uv run --frozen mypy --no-incremental --junit-xml=${GITHUB_WORKSPACE}/build/lint.xml ${GITHUB_WORKSPACE}/src/mrmat_python_api_fastapi || true
55+
- name: Build
56+
run: uv build --wheel
57+
- name: Test
58+
run: uv run --frozen pytest --junit-xml=${GITHUB_WORKSPACE}/build/junit.xml --cov-report=xml:${GITHUB_WORKSPACE}/build/coverage.xml
59+
- name: Upload linting results
60+
if: ${{ github.event_name == 'pull_request' }}
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: Lint Results
64+
path: build/lint.xml
65+
retention-days: 1
66+
- name: Upload unit test results
67+
if: ${{ github.event_name == 'pull_request' }}
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: Unit Test Results
71+
path: build/junit.xml
72+
retention-days: 1
73+
- name: Upload coverage results
74+
if: ${{ github.event_name == 'pull_request' }}
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: Coverage Results
78+
path: build/coverage.xml
79+
retention-days: 1
80+
- name: Report on unit tests
81+
if: ${{ github.event_name == 'pull_request' }}
82+
uses: EnricoMi/publish-unit-test-result-action@v2
83+
with:
84+
check_name: "Unit Tests"
85+
comment_title: "Unit Test Results"
86+
files: build/junit.xml
87+
- name: Report on code coverage
88+
if: ${{ github.event_name == 'pull_request' }}
89+
uses: irongut/[email protected]
90+
with:
91+
filename: build/coverage.xml
92+
93+
# The release job only executes when pushing to the main branch
94+
release:
95+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: write
99+
needs:
100+
- prep
101+
- build
102+
steps:
103+
- name: Create Release
104+
id: create_release
105+
uses: actions/create-release@latest
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
with:
109+
tag_name: ${{ needs.prep.outputs.version }}
110+
release_name: Release ${{ needs.prep.outputs.version }}
111+
body: |
112+
Release ${{ needs.prep.outputs.version }}
113+
draft: false
114+
prerelease: false

.idea/copyright/MIT.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/mrmat-python-api-fastapi.iml

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/build.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/lint.xml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/run.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)