-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds running tests to release workflow
- Loading branch information
Showing
2 changed files
with
77 additions
and
21 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,34 +1,58 @@ | ||
name: Release the Next Version of the Package | ||
name: Release the Next Version of the Package and Documentation | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
release-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
- id: version | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install build | ||
python3 -m pip install twine | ||
- name: Build package | ||
run: python -m build | ||
- name: Check package | ||
run: python3 -m twine check dist/* | ||
- name: Publish package to Test-PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
echo ${{ github.event.release.name }} | ||
# RELEASE_VERSION=${{ github.event.release.tag_name }} | ||
# echo "version=${RELEASE_VERSION/v/}" >> "$GITHUB_OUTPUT" | ||
# outputs: | ||
# version: ${{ steps.version.outputs.version }} | ||
# publish-test-pypi: | ||
# needs: release-version | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Get release version | ||
# run: | | ||
# RELEASE_VERSION=${{ github.event.release.tag_name }} | ||
# export RELEASE_VERSION=${RELEASE_VERSION/v/} | ||
# echo "Publishing package for release version ${RELEASE_VERSION}" | ||
# - uses: actions/checkout@v4 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: '3.x' | ||
# - name: Install dependencies | ||
# run: | | ||
# python3 -m pip install --upgrade pip | ||
# python3 -m pip install build | ||
# python3 -m pip install twine | ||
# - name: Build package | ||
# run: | | ||
# echo "Building package of version ${RELEASE_VERSION}" | ||
# python3 -m build | ||
# - name: Check package | ||
# run: python3 -m twine check dist/* | ||
# - name: Publish package to Test-PyPi | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
# repository-url: https://test.pypi.org/legacy/ | ||
# test-test-pypi: | ||
# needs: publish-test-pypi | ||
# uses: ./.github/workflows/tests.yml | ||
# with: | ||
# install_command: "python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple gpu-tracker==${{ env.RELEASE_VERSION }}" | ||
# | ||
# - name: Publish package to PyPi | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.PYPI_API_TOKEN }} | ||
# |
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,32 @@ | ||
name: Run Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
install_command: | ||
description: The command for installing the package to test. | ||
required: true | ||
type: string | ||
jobs: | ||
run-tests: | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
os: [ ubuntu-latest, windows-latest, macOS-latest ] | ||
runs-on: ${{matrix.os}} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install testing environment and gpu-tracker package | ||
run: | | ||
python3 -m venv .env/ | ||
source .env/bin/activate || source .env/Scripts/activate | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install pytest pytest-mock pytest-cov | ||
${{ inputs.install_command }} | ||
- name: Test with pytest | ||
run: bash tests/run.sh |