-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Emily Rockman <ebuschang@gmail.com>
- Loading branch information
1 parent
f81e17e
commit 3929ed2
Showing
5 changed files
with
100 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Implement unit testing in CI | ||
time: 2024-01-12T23:02:36.630106-05:00 | ||
custom: | ||
Author: mikealfare | ||
Issue: "10" |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish results | ||
|
||
inputs: | ||
file-name: | ||
description: File type for file name stub (e.g. "unit-tests") | ||
required: true | ||
python-version: | ||
description: Create an environment with the appropriate version of python and hatch installed | ||
required: true | ||
source-file: | ||
description: File to be uploaded | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get timestamp | ||
id: timestamp | ||
run: echo "ts=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT #no colons allowed for artifacts | ||
shell: bash | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.file-name }}_${{ inputs.python-version }}-${{ steps.timestamp.outputs.ts }}.csv | ||
path: ${{ inputs.source-file }} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Setup `hatch` | ||
|
||
inputs: | ||
python-version: | ||
description: Create an environment with the appropriate version of python and hatch installed | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install hatch | ||
run: python -m pip install hatch | ||
shell: bash |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "*.latest" | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: read-all | ||
|
||
# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit: | ||
name: Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup-environment | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run unit tests | ||
run: hatch run unit-tests | ||
shell: bash | ||
|
||
- name: Publish results | ||
uses: ./.github/actions/publish-results | ||
if: always() | ||
with: | ||
source-file: "results.csv" | ||
file-name: "unit_results" | ||
python-version: ${{ matrix.python-version }} |
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 |
---|---|---|
|
@@ -119,3 +119,5 @@ testpaths = [ | |
"tests/functional", | ||
"tests/unit", | ||
] | ||
color = true | ||
csv = "results.csv" |