DEV-441 hdforce v1.1.2 w/ update to github actions yml files #50
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
# This workflow will install Python dependencies, | |
# run tests and lint with Python versions 3.9<>3.12 | |
name: Test Package and TestPyPI | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
test-package: | |
name: Test Package with ${{ matrix.python-version }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/python | |
- os: macos-latest | |
path: ~/Library/Caches/python | |
- os: windows-latest | |
path: ~\AppData\Local\python\Cache | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
id: setuppython | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: cache dependecies | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Poetry | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: poetry install | |
- name: Run tests with pytest | |
env: | |
HD_REFRESH_TOKEN: ${{ secrets.HD_REFRESH_TOKEN }} | |
run: poetry run pytest tests/ | |
# Job 2: Publish to Test PyPI | |
publish-test-package: | |
name: Publish to TestPyPI | |
runs-on: ubuntu-latest | |
needs: test-package | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Build and publish to pypi | |
uses: JRubics/[email protected] | |
with: | |
pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_name: "testpypi" | |
repository_url: "https://test.pypi.org/legacy/" |