Skip to content

Commit dac76e2

Browse files
committed
fix: updated release pipeline
1 parent a6886fc commit dac76e2

File tree

7 files changed

+188
-204
lines changed

7 files changed

+188
-204
lines changed

.github/workflows/ci.yaml

Lines changed: 97 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,122 @@
11
name: Tests And Linting
22

33
on:
4-
pull_request:
54
push:
65
branches:
76
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: test-${{ github.head_ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
PYTHONUNBUFFERED: "1"
15+
FORCE_COLOR: "1"
816

917
jobs:
10-
validate:
11-
runs-on: ubuntu-latest
18+
run:
19+
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
20+
runs-on: ${{ matrix.os }}
21+
timeout-minutes: 30
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ubuntu-latest]
26+
# os: [ubuntu-latest, windows-latest, macos-latest]
27+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
28+
1229
steps:
1330
- uses: actions/checkout@v4
1431

15-
- uses: actions/setup-python@v5
32+
- if: runner.os == 'Linux'
33+
name: Install Microsoft ODBC Drivers & Free additional space
34+
run: |
35+
sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y || true
36+
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
37+
sudo rm -rf \
38+
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
39+
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
40+
/usr/lib/jvm || true
41+
sudo apt-get autoremove -y \
42+
&& sudo apt-get clean -y \
43+
&& sudo rm -rf /root/.cache \
44+
&& sudo rm -rf /var/apt/lists/* \
45+
&& sudo rm -rf /var/cache/apt/* \
46+
&& sudo apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
47+
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v5
1650
with:
17-
python-version: "3.11"
51+
python-version: ${{ matrix.python-version }}
1852

19-
- name: Install Pre-Commit
20-
run: python -m pip install pre-commit && pre-commit install
53+
- name: Install Hatch
54+
run: pip install --upgrade hatch hatch-pip-compile
2155

22-
- name: Load cached Pre-Commit Dependencies
23-
id: cached-pre-commit-dependencies
24-
uses: actions/cache@v4
25-
with:
26-
path: ~/.cache/pre-commit/
27-
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
56+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
57+
name: Lint
58+
run: hatch run lint:check
59+
60+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
61+
name: Run tests with coverage tracking
62+
run: hatch run +py=${{ matrix.python-version }} test:cov
2863

29-
- name: Execute Pre-Commit
30-
run: pre-commit run --show-diff-on-failure --color=always --all-files
64+
- if: matrix.python-version != '3.12' || runner.os != 'Linux'
65+
name: Run tests without tracking coverage
66+
run: hatch run +py=${{ matrix.python-version }} test:no-cov
3167

32-
test:
68+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: coverage-xml
72+
path: coverage.xml
73+
74+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
75+
name: Upload coverage reports to Codecov
76+
uses: codecov/codecov-action@v4.5.0
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
slug: litestar-org/pytest-databases
80+
sonar:
81+
needs:
82+
- run
83+
if: github.event.pull_request.head.repo.fork == false && github.repository_owner == 'litestar-org'
3384
runs-on: ubuntu-latest
34-
strategy:
35-
fail-fast: true
36-
matrix:
37-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
38-
timeout-minutes: 30
39-
defaults:
40-
run:
41-
shell: bash
4285
steps:
4386
- name: Check out repository
4487
uses: actions/checkout@v4
45-
46-
- uses: pdm-project/setup-pdm@v4
47-
name: Set up PDM
4888
with:
49-
python-version: ${{ matrix.python-version }}
89+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
90+
- name: Download Artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: coverage-xml
5094

51-
- name: Install dependencies
52-
run: pdm install
95+
- name: Fix coverage file for sonarcloud
96+
run: sed -i "s/home\/runner\/work\/pytest-databases\/pytest-databases/github\/workspace/g" coverage.xml
5397

54-
- name: Test
55-
run: pdm run pytest -m ""
98+
- name: SonarCloud Scan
99+
uses: sonarsource/sonarcloud-github-action@master
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
103+
codeql:
104+
needs:
105+
- run
106+
runs-on: ubuntu-latest
107+
permissions:
108+
security-events: write
109+
steps:
110+
- name: Checkout repository
111+
uses: actions/checkout@v4
112+
113+
- name: Initialize CodeQL Without Dependencies
114+
uses: github/codeql-action/init@v3
115+
116+
- name: Perform CodeQL Analysis
117+
uses: github/codeql-action/analyze@v3
56118

57119
build-docs:
58-
needs:
59-
- validate
60120
if: github.event_name == 'pull_request'
61121
runs-on: ubuntu-latest
62122
steps:
@@ -68,16 +128,11 @@ jobs:
68128
with:
69129
python-version: "3.11"
70130

71-
- uses: pdm-project/setup-pdm@v4
72-
name: Set up PDM
73-
with:
74-
python-version: "3.11"
75-
76-
- name: Install dependencies
77-
run: pdm install -G:all
131+
- name: Install Hatch
132+
run: pip install --upgrade hatch hatch-containers hatch-pip-compile
78133

79134
- name: Build docs
80-
run: pdm run make docs
135+
run: hatch run docs:build
81136

82137
- name: Save PR number
83138
env:

.github/workflows/codeql.yml

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

.github/workflows/docs-preview.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Documentation Preview
1+
name: Documentation Preview
22

33
on:
44
workflow_run:
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919

2020
- name: Download artifact
21-
uses: dawidd6/action-download-artifact@v3
21+
uses: dawidd6/action-download-artifact@v6
2222
with:
2323
workflow_conclusion: success
2424
run_id: ${{ github.event.workflow_run.id }}
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
folder: docs-preview/docs/_build/html
3535
token: ${{ secrets.DOCS_PREVIEW_DEPLOY_TOKEN }}
36-
repository-name: litestar-org/litestar-oracledb-docs-preview
36+
repository-name: litestar-org/pytest-databases-docs-preview
3737
clean: false
3838
target-folder: ${{ env.PR_NUMBER }}
3939
branch: gh-pages
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
script: |
4646
const issue_number = process.env.PR_NUMBER
47-
const body = "Documentation preview will be available shortly at https://litestar-org.github.io/litestar-oracledb-docs-preview/" + issue_number
47+
const body = "Documentation preview will be available shortly at https://litestar-org.github.io/pytest-databases-docs-preview/" + issue_number
4848
4949
const opts = github.rest.issues.listComments.endpoint.merge({
5050
owner: context.repo.owner,

.github/workflows/docs.yaml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,38 @@
1-
name: Documentation Building
2-
1+
name: Documentation
32
on:
43
release:
54
types: [published]
65
push:
76
branches:
87
- main
9-
8+
env:
9+
PYTHONUNBUFFERED: "1"
10+
FORCE_COLOR: "1"
1011
jobs:
1112
docs:
1213
permissions:
1314
contents: write
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v4
17-
18-
- uses: actions/setup-python@v5
19-
with:
20-
python-version: "3.11"
21-
22-
- uses: pdm-project/setup-pdm@v4
23-
name: Set up PDM
24-
with:
25-
python-version: "3.11"
26-
allow-python-prereleases: true
27-
cache: true
17+
- uses: actions/checkout@v4
2818

29-
- name: Install dependencies
30-
run: pdm install -G:docs
19+
- name: Set up Python 3.12
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.11
3123

32-
- name: Fetch gh pages
33-
run: git fetch origin gh-pages --depth=1
24+
- name: Install Hatch
25+
run: pip install --upgrade hatch hatch-pip-compile
3426

35-
- name: Build release docs
36-
run: pdm run python tools/build_docs.py docs-build
37-
if: github.event_name == 'release'
27+
- name: Build release docs
28+
run: hatch run docs:python scripts/build_docs.py docs-build
29+
if: github.event_name == 'release'
3830

39-
- name: Build dev docs
40-
run: pdm run python tools/build_docs.py docs-build
41-
if: github.event_name == 'push'
31+
- name: Build dev docs
32+
run: hatch run docs:python scripts/build_docs.py docs-build
33+
if: github.event_name == 'push'
4234

43-
- name: Deploy
44-
uses: JamesIves/github-pages-deploy-action@v4
45-
with:
46-
folder: docs-build
35+
- name: Deploy
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
folder: docs-build

0 commit comments

Comments
 (0)