Skip to content

test: fix playing tests in CI #22

test: fix playing tests in CI

test: fix playing tests in CI #22

Workflow file for this run

name: Test and build
on: push
env:
ARTIFACT_PREFIX: hh-creator-${{ github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # for the PyPI release
contents: write # for the GH release
steps:
- uses: astral-sh/setup-uv@v4
- uses: actions/checkout@v4
- name: Setup venv
run: uv venv && uv pip install -e .
- name: Run tests
run: uv run --frozen pytest test
- name: Set version from tag or commit SHA
run: |
case ${{ github.ref }} in
refs/tags/v*)
VERSION=$(echo ${{ github.ref_name }} | cut -c2-)
;;
*)
VERSION=0.0.0dev+git$(date +%Y%m%d-%H%M)-$(echo ${{ github.sha }} | cut -c1-8)
;;
esac
echo Package will be versioned as $VERSION
sed -i "s/NO_VERSION/$VERSION/" hh_creator/__init__.py
sed -i "s/0.0.0dev/$VERSION/" pyproject.toml
# pyinstaller for windows
- name: Export requirements for pyinstaller
run: uv pip compile pyproject.toml -o pyinstaller/requirements.txt
- uses: ./.github/actions/pyinstaller
with:
path: pyinstaller
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_PREFIX }}-windows
path: pyinstaller/dist/windows
# python package
- name: Build PyPI package
run: uv build
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_PREFIX }}-pypi
path: dist
- name: PyPI release
if: startsWith(github.ref, 'refs/tags/v')
run: uv publish
# github release
- uses: actions/download-artifact@v4
- name: Check what artifacts have been downloaded
run: |
ls -la
ls -la ${{ env.ARTIFACT_PREFIX }}*
- name: Github release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARTIFACT_PREFIX }}*