add ci tests #6
This file contains 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: CI | |
"on": | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: eifinger/setup-rye@v4 | |
id: setup-rye | |
with: | |
enable-cache: true | |
cache-prefix: ${{ matrix.python-version }} | |
- name: Pin python-version ${{ matrix.python-version }} | |
if: steps.setup-rye.outputs.cache-hit != 'true' | |
run: rye pin ${{ matrix.python-version }} | |
- name: Format check | |
run: rye fmt --check | |
- name: Lint check | |
run: rye lint | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: eifinger/setup-rye@v4 | |
id: setup-rye | |
with: | |
enable-cache: true | |
cache-prefix: ${{ matrix.python-version }} | |
- name: Pin python-version ${{ matrix.python-version }} | |
if: steps.setup-rye.outputs.cache-hit != 'true' | |
run: rye pin ${{ matrix.python-version }} | |
- name: Install dependencies | |
if: steps.setup-rye.outputs.cache-hit != 'true' | |
run: | | |
rye sync --no-lock | |
- name: Test | |
run: rye test -- --cov-report term-missing | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 10 | |
fetch-tags: true | |
- uses: eifinger/setup-rye@v4 | |
id: setup-rye | |
with: | |
enable-cache: true | |
cache-prefix: ${{ matrix.python-version }} | |
- name: Pin python-version ${{ matrix.python-version }} | |
if: steps.setup-rye.outputs.cache-hit != 'true' | |
run: rye pin ${{ matrix.python-version }} | |
- name: Build | |
run: rye build --clean | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist_${{ github.ref }} | |
path: dist |