Skip to content

Commit 0c97dde

Browse files
committed
fix: gh actions workflow
- disables pip auto version check - installs project in editable - build package in virtual environment - move env and permissions to individual job scope - use `.venv/bin` instead of `.venv/Scripts` in Linux
1 parent 8fb3bf7 commit 0c97dde

File tree

4 files changed

+36
-30
lines changed

4 files changed

+36
-30
lines changed

.github/workflows/docs.yaml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@ on:
44
workflow_dispatch:
55
push:
66
branches: ["master"]
7-
permissions:
8-
contents: read
9-
pages: write
10-
id-token: write
11-
concurrency:
12-
group: "pages"
13-
cancel-in-progress: false
14-
env:
15-
BUILD_PATH: "."
167
jobs:
178
build:
18-
name: Build
199
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
env:
13+
BUILD_PATH: .
14+
PIP_DISABLE_PIP_VERSION_CHECK: 1
2015
steps:
2116
# checkout repository
2217
- name: Checkout repository
@@ -28,7 +23,9 @@ jobs:
2823
python-version: "3.11"
2924
# building
3025
- name: Install 'documentation' dependencies
31-
run: pip install -r python/requirements.mkdocs.txt
26+
run: |
27+
pip install .
28+
pip install -r python/requirements.mkdocs.txt
3229
- name: Build documentation
3330
run: python src/export docs
3431
# set up Pages
@@ -40,13 +37,17 @@ jobs:
4037
with:
4138
path: ${{ env.BUILD_PATH }}/site
4239
deploy:
43-
runs-on: ubuntu-latest
4440
needs: build
41+
runs-on: ubuntu-latest
42+
permissions:
43+
pages: write
44+
id-token: write
4545
environment:
4646
name: github-pages
4747
url: ${{ steps.deployment.outputs.page_url }}
4848
# deploy documentation
4949
name: Deploy
5050
steps:
5151
- name: Deploy to GitHub Pages
52-
uses: actions/deploy-pages@v1
52+
id: deployment
53+
uses: actions/deploy-pages@v2

.github/workflows/package.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ on:
44
workflow_dispatch:
55
release:
66
types: [published]
7-
permissions:
8-
contents: read
9-
env:
10-
BUILD_PATH: "."
117
jobs:
128
build:
139
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
env:
13+
BUILD_PATH: .
14+
PIP_DISABLE_PIP_VERSION_CHECK: 1
1415
steps:
1516
# checkout repository
1617
- name: Checkout repository
@@ -24,27 +25,27 @@ jobs:
2425
- name: Install dependencies
2526
run: |
2627
python -m venv .venv
27-
./.venv/Scripts/python -m pip install --upgrade pip
28-
./.venv/Scripts/pip install .
29-
./.venv/Scripts/pip install -r python/requirements.sphinx.txt
30-
./.venv/Scripts/pip install build
28+
./.venv/bin/python -m pip install --upgrade pip
29+
./.venv/bin/pip install .
30+
./.venv/bin/pip install -r python/requirements.sphinx.txt
31+
./.venv/bin/pip install build
3132
# build package
3233
- name: Build package
33-
run: ./.venv/Scripts/python src/export package
34+
run: |
35+
. ./.venv/bin/activate
36+
python src/export package
37+
deactivate
3438
# upload package as artifact
3539
- name: Upload artifact
3640
uses: actions/upload-pages-artifact@v1
3741
with:
3842
path: ${{ env.BUILD_PATH }}/dist
3943
publish:
40-
runs-on: ubuntu-latest
4144
needs: build
45+
runs-on: ubuntu-latest
46+
permissions:
47+
id-token: write
4248
steps:
43-
# download artifact
44-
- name: Download artifact
45-
uses: actions/download-artifact@v3
46-
with:
47-
path: ${{ env.BUILD_PATH }}/dist
4849
# publish package
4950
- name: Publish to PyPI
5051
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/pycqa.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
tooling:
1111
runs-on: ubuntu-latest
12+
env:
13+
PIP_DISABLE_PIP_VERSION_CHECK: 1
1214
steps:
1315
# checkout repository
1416
- name: Checkout repository
@@ -20,7 +22,9 @@ jobs:
2022
python-version: "3.8"
2123
# tooling
2224
- name: Install 'tooling' dependencies
23-
run: pip install -r python/requirements.tooling.txt
25+
run: |
26+
pip install .
27+
pip install -r python/requirements.tooling.txt
2428
- name: Tooling
2529
run: |
2630
black .

src/export/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def package(source: Path):
149149
generate_documentation(source, only_rst_man=True)
150150
# print()
151151
if getenv("CI", "false") == "true":
152-
process = Popen(("./venv/Scripts/python", "-m", "build"), shell=False) # nosec
152+
process = Popen(("./.venv/bin/python", "-m", "build"), shell=False) # nosec
153153
else:
154154
process = Popen(("pdm", "build"), shell=False) # nosec
155155
process.communicate()

0 commit comments

Comments
 (0)