Skip to content

Commit

Permalink
chore: use setup-pdm action, move check-wheel-contents to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
agateau-gg committed Nov 20, 2024
1 parent a6b75e2 commit e9783ef
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 18 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build_release_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ on:
type: boolean
default: false

env:
PDM_VERSION: 2.20.1

jobs:
build_wheel_sdist:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install packaging tools
run: |
pip install --upgrade pdm
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
version: ${{ env.PDM_VERSION }}

- name: Create packages
run: |
Expand Down Expand Up @@ -141,7 +145,9 @@ jobs:
shell: bash
run: |
$PYTHON_CMD -m pip install --upgrade pip
$PYTHON_CMD -m pip install --upgrade pdm
# We do not install pdm using setup-pdm because we want to use $PYTHON_CMD for
# our interpreter
$PYTHON_CMD -m pip install --upgrade pdm==$PDM_VERSION
pdm sync --group tests --group standalone
- name: Prepare macOS secrets
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
- 'doc/**'
- 'README.md'

env:
PDM_VERSION: 2.20.1

jobs:
lint:
name: Lint package
Expand All @@ -26,15 +29,14 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v5
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
version: ${{ env.PDM_VERSION }}
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pdm pre-commit
pdm sync
- uses: actions/cache@v3
Expand All @@ -43,7 +45,7 @@ jobs:
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit hooks
run: pre-commit install --install-hooks
run: pdm run pre-commit install --install-hooks

- name: Skip ggshield hooks when running from a fork
# See note about steps requiring the GITGUARDIAN_API at the top of this file
Expand All @@ -53,7 +55,7 @@ jobs:
- name: Run pre-commit checks
run: |
pre-commit run --show-diff-on-failure --all-files
pdm run pre-commit run --show-diff-on-failure --all-files
env:
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

Expand Down Expand Up @@ -83,16 +85,15 @@ jobs:
# Get enough commits to run `ggshield secret scan commit-range` on ourselves
fetch-depth: 10

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Setup PDM & Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v4
with:
version: ${{ env.PDM_VERSION }}
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pdm
pdm sync --global --project . --group dev --group tests
pdm sync --group dev --group tests
- name: Override base Docker image used for functional tests on Windows
if: matrix.os == 'windows-2022'
Expand All @@ -104,10 +105,9 @@ jobs:
- name: Ensure a clean package installation
run: |
python -m pip install --upgrade check-wheel-contents
pdm build --no-sdist
# The created wheel (.whl) file will be found and analyzed within the `dist/` folder
check-wheel-contents dist/
pdm run check-wheel-contents dist/
- name: Run unit tests
run: |
Expand Down
Loading

0 comments on commit e9783ef

Please sign in to comment.