Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add linting & testing #22

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @martinbrose
38 changes: 38 additions & 0 deletions .github/workflows/ci-lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CI: Lint & Test"
on:
push:
branches:
- main
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: "[INIT] Checkout project"
uses: actions/checkout@v4
- name: "[EXEC] Lint"
uses: chartboost/ruff-action@v1
test:
name: Test
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
os: [ubuntu-latest, macos-12, windows-latest]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use macos-latest here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last time i tried this, macos latest uses a different architecture (ARM), which didn't have older python versions at the time. unless this has changed, that will not be possible.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, seems that changed recently. macos-latest used to point to macos-13, now it points to 14 which uses M1 cpu's.

https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

So in theory you can use macos-13, instead of 12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's especially important now that macos-12 is EOL. macos-13 has another year of support, so i'll resolve this later.

steps:
- name: "[INIT] Checkout project"
uses: actions/checkout@v4
- name: "[INIT] Install Python ${{ matrix.python }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: "[INIT] Install Pytest"
run: pip install pytest pytest-cov
- name: "[EXEC] Test"
run: pytest tests
# TODO: add coverage?