ci: Creating initial github actions #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Common Workflow | |
on: | |
pull_request: | |
branches: | |
- main | |
- dev | |
jobs: | |
pre-commit: | |
name: Pre-commit CI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
pdm install -G :all | |
- name: Run pre-commit | |
run: | | |
pdm pre-commit | |
test: | |
name: Test CI | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install testing dependencies | |
run: | | |
pdm install -G test | |
- name: Run tests | |
run: | | |
pdm test | |
# Adding test for C Extension | |
test-c-extension: | |
name: Test C Extension | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build with C Extension | |
run: | | |
C_GRAPHLIB_EXT=true pdm build | |
- name: Install testing dependencies | |
run: | | |
pdm install -G test | |
- name: Install generated wheel | |
run: | | |
pdm run pip install dist/*.whl --force-reinstall | |
- name: Delete the checked out repository | |
run: | | |
rm -rf ${{ github.workspace }}/src/syncra | |
- name: Run tests | |
run: | | |
pdm test |