-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Unit Tests | ||
name: CI | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
|
@@ -17,29 +17,32 @@ defaults: | |
jobs: | ||
|
||
lint: | ||
name: Code style | ||
name: Linting & Code style | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Dependencies | ||
- name: Install package | ||
run: | | ||
which python | ||
which pip | ||
set -vxeuo pipefail | ||
python -m pip install --upgrade pip | ||
pip install flake8 | ||
- name: Run flake8 | ||
run: | | ||
flake8 | ||
pip install ruff | ||
- name: Run ruff | ||
uses: davidslusser/[email protected] | ||
with: | ||
# src: "." | ||
# options: "--cov=src" | ||
pip_install_command: "pip install -e .[dev]" | ||
python_version: "3.11" | ||
|
||
test-matrix: | ||
name: Python ${{ matrix.python-version }} | ||
tests: | ||
name: CI py${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
needs: lint | ||
strategy: | ||
|
@@ -49,14 +52,17 @@ jobs: | |
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
# - "3.12" # 2023-Q4 wait for upstreams to be ready | ||
max-parallel: 5 | ||
|
||
steps: | ||
- name: Set time zone | ||
run: echo "TZ=America/Chicago" >> "$GITHUB_ENV" | ||
|
||
- name: Checkout the project from GitHub | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Diagnostics | ||
run: | | ||
|
@@ -129,6 +135,7 @@ jobs: | |
- name: Run Bluesky queueserver | ||
run: | | ||
set -vxeuo pipefail | ||
conda env list | ||
pushd ./bluesky/ | ||
bash ./qserver.sh run & | ||
|
@@ -140,9 +147,26 @@ jobs: | |
- name: Run tests with pytest & coverage | ||
run: | | ||
set -vxeuo pipefail | ||
coverage run --concurrency=thread --parallel-mode -m pytest -vvv . | ||
coverage combine | ||
coverage report --precision 3 | ||
python -m coverage report --precision 3 | ||
- name: Force Install coveralls by pip | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install --force-reinstall coveralls | ||
- name: Upload coverage data to coveralls.io | ||
shell: bash -l {0} | ||
run: | | ||
set -vxeuo pipefail | ||
python -m coveralls debug | ||
python -m coveralls --service=github | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} | ||
COVERALLS_PARALLEL: true | ||
|
||
# - name: Gather coverage data from matrix run | ||
# shell: bash -l {0} | ||
|
@@ -174,3 +198,24 @@ jobs: | |
# coveralls --service=github --finish | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support | ||
coveralls: | ||
name: Report unit test coverage to coveralls | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
container: python:3-slim | ||
|
||
steps: | ||
- name: Gather coverage and report to Coveralls | ||
run: | | ||
set -vxeuo pipefail | ||
echo "Finally!" | ||
pip3 install --upgrade coveralls | ||
# debug mode: output prepared json and reported files list to stdout | ||
# https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html | ||
coveralls debug | ||
coveralls --service=github --finish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|