✨ Added testing GitHub action #3
Workflow file for this run
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
name: Test Code on PR | |
on: [pull_request] | |
jobs: | |
test-code-on-pr: | |
name: Test Code on PR Runner | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
# TODO: After merging #255, we should probably change it so we use | |
# `requirements.in` over `requirements.txt`. | |
python-version: ["3.12"] | |
# Github actions only supports x64 architecture for now, arm64 is in a | |
# private beta. | |
architecture: ["x64"] | |
# Exclude no combinations for now | |
# exclude: [] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up PytStrEnumhon ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
cache: pip | |
# After merging #225, use this as the cache instead.The cahce merely | |
# uses a hash of a specififed file to determine if it needs to update | |
# cache-dependency-path: requirements.in | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel coverage | |
pip install -r requirements.txt | |
- name: Test with unittest | |
run: | | |
python -m coverage run --branch -m unittest discover | |
- name: Generate coverage report | |
run: | | |
python -m coverage html --skip-empty -d coverage-report-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }} | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }} | |
path: coverage-report-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }} | |
if: ${{ always()}} |