Skip to content

Commit

Permalink
Fix #61 (#62)
Browse files Browse the repository at this point in the history
* Replace PDM to use `sync` instead of `install`

As suggested in the official docs:
<https://pdm.fming.dev/2.7/usage/advanced/#use-pdm-in-continuous-integration>

* Upgrade PDM

* Rewrite the CI/CD

Based on the:
<https://pdm.fming.dev/2.7/usage/advanced/#use-pdm-in-continuous-integration>

Notable changes include:
- Pin versions of each step.
- Explicitly define all options of `setup-pdm` action.
- Reimplement cache using built-in solution of `setup-pdm` action.
  • Loading branch information
Toreno96 committed Jun 30, 2023
1 parent 5964f71 commit 9ca92f7
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 206 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,20 @@ jobs:
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
- uses: actions/checkout@v3
- name: Set up PDM
uses: pdm-project/setup-pdm@v3.1
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- uses: pdm-project/setup-pdm@main
name: Setup PDM
with:
python-version: "3.10" # Version range or exact version of a Python version to use, the same as actions/setup-python
version: 1.14.0 # The version of PDM to install. Leave it as empty to use the latest version from PyPI
prerelease: false # Allow prerelease versions to be installed
enable-pep582: true # Enable PEP 582 package loading globally
python-version: "3.10"
architecture: x64
version: 2.7.4 # The version of PDM
prerelease: false # Disallow prerelease versions of PDM
enable-pep582: true
allow-python-prereleases: false
cache: true
- name: Install dependencies
run: pdm install # Then you can use pdm in the following steps.
- name: Test
run: |
python -m unittest
pdm sync
- name: Run unit tests
run: |
pdm run python -m unittest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ cython_debug/

# End of https://www.toptal.com/developers/gitignore/api/python,pycharm+all

.pdm.toml
.pdm-python
Loading

0 comments on commit 9ca92f7

Please sign in to comment.