From 8d7f735c40340c4a945b0ff34d1218999042359f Mon Sep 17 00:00:00 2001 From: Jacob Strieb Date: Thu, 21 Dec 2023 12:23:56 -0500 Subject: [PATCH] Add GitHub Actions workflow to run tests --- .github/workflows/test.yml | 77 ++++++++++++++++++++++++++++++++++++++ Justfile | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6d388e4 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/Justfile b/Justfile index 9014db6..d12ebca 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,6 @@ REQUIRED_COVERAGE := "100" -test cores="auto": lint-python +test cores="auto": python3 -m pytest \ -n {{cores}} \ --failed-first \