Skip to content

Commit 11d5d11

Browse files
committed
chore(build): add local only workflow
1 parent da3a20d commit 11d5d11

File tree

2 files changed

+124
-2
lines changed

2 files changed

+124
-2
lines changed

.github/workflows/ci-local.yaml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Full LocalTests And Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- 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"
16+
17+
jobs:
18+
run:
19+
name: Python ${{ matrix.python-version }}
20+
runs-on: self-hosted
21+
timeout-minutes: 30
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
31+
name: Lint
32+
run: hatch run lint:check
33+
34+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
35+
name: Run tests with coverage tracking
36+
run: hatch run +py=${{ matrix.python-version }} test:cov
37+
38+
- if: matrix.python-version != '3.12' || runner.os != 'Linux'
39+
name: Run tests without tracking coverage
40+
run: hatch run +py=${{ matrix.python-version }} test:no-cov
41+
42+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: coverage-xml
46+
path: coverage.xml
47+
48+
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
49+
name: Upload coverage reports to Codecov
50+
uses: codecov/[email protected]
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
slug: litestar-org/pytest-databases
54+
sonar:
55+
needs:
56+
- run
57+
if: github.event.pull_request.head.repo.fork == false && github.repository_owner == 'litestar-org'
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Check out repository
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
64+
- name: Download Artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: coverage-xml
68+
69+
- name: Fix coverage file for sonarcloud
70+
run: sed -i "s/home\/runner\/work\/pytest-databases\/pytest-databases/github\/workspace/g" coverage.xml
71+
72+
- name: SonarCloud Scan
73+
uses: sonarsource/sonarcloud-github-action@master
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
77+
codeql:
78+
needs:
79+
- run
80+
runs-on: ubuntu-latest
81+
permissions:
82+
security-events: write
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v4
86+
87+
- name: Initialize CodeQL Without Dependencies
88+
uses: github/codeql-action/init@v3
89+
90+
- name: Perform CodeQL Analysis
91+
uses: github/codeql-action/analyze@v3
92+
93+
build-docs:
94+
if: github.event_name == 'pull_request'
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Check out repository
98+
uses: actions/checkout@v4
99+
100+
- name: Set up Python
101+
uses: actions/setup-python@v5
102+
with:
103+
python-version: "3.11"
104+
105+
- name: Install Hatch
106+
run: pip install --upgrade hatch hatch-containers hatch-pip-compile
107+
108+
- name: Build docs
109+
run: hatch run docs:build
110+
111+
- name: Save PR number
112+
env:
113+
PR_NUMBER: ${{ github.event.number }}
114+
run: echo $PR_NUMBER > .pr_number
115+
116+
- name: Upload artifact
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: docs-preview
120+
path: |
121+
docs/_build/html
122+
.pr_number

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ env:
1717
jobs:
1818
run:
1919
name: Python ${{ matrix.python-version }}
20-
runs-on: self-hosted
20+
runs-on: ubuntu-latest
2121
timeout-minutes: 30
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
25+
python-version: ["3.12"]
2626

2727
steps:
2828
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)