Skip to content

Commit

Permalink
Add GitHub Actions workflow to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrieb committed Dec 21, 2023
1 parent eac9b0b commit 8d7f735
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test just.sh

on:
push:
branches:
- master
tags-ignore:
- '*.*.*'
workflow_dispatch:
workflow_call:

permissions:
contents: read

env:
JUST_VERSION: '1.17.0'

defaults:
run:
shell: bash -euxo pipefail {0}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python3 -m pip install .[test]
- name: Install Just on Linux
run: |
curl -L "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
| sudo tar -C /usr/local/bin -xzv just
- name: Lint
run: |
just lint
test:
name: Run all tests
needs: lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
include:
- os: macos-latest
python-version: '3.8'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python3 -m pip install .[test]
- name: Install Just on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
curl -L "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-apple-darwin.tar.gz" \
| sudo tar -C /usr/local/bin -xzv just
- name: Install Just on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
curl -L "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
| sudo tar -C /usr/local/bin -xzv just
- name: Run tests
run: |
just test
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REQUIRED_COVERAGE := "100"

test cores="auto": lint-python
test cores="auto":
python3 -m pytest \
-n {{cores}} \
--failed-first \
Expand Down

0 comments on commit 8d7f735

Please sign in to comment.