fix: use same image for tests and publisihng test execution #40
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: Publish to PyPI | |
on: | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
list-test-dirs: | |
if: github.repository == 'hidet-org/hidet' | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout Hidet | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- id: set-matrix | |
run: | | |
python .github/scripts/set_test_matrix.py | |
publish-tests: | |
name: Release Tests | |
needs: list-test-dirs | |
if: github.repository == 'hidet-org/hidet' | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.list-test-dirs.outputs.matrix) }} | |
runs-on: arc-runner-set | |
container: | |
image: nvidia/cuda:11.8.0-devel-ubuntu20.04 | |
steps: | |
- name: Install dependencies via apt | |
run: | | |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y ccache git graphviz | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.19.x' | |
- name: Setup Hidet | |
uses: ./.github/actions/setup-hidet | |
- name: List installed packages | |
run: | | |
pip list | |
# Run tests | |
- name: Run tests | |
run: | | |
python -m pytest -v --durations=20 --clear-cache ${{ matrix.path }} | |
build-docs: | |
if: github.repository == 'hidet-org/hidet' | |
runs-on: arc-runner-set | |
container: | |
image: nvidia/cuda:11.8.0-devel-ubuntu20.04 | |
steps: | |
- name: Install dependencies via apt | |
run: | | |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y ccache git graphviz | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1.13 | |
with: | |
cmake-version: '3.19.x' | |
- name: Setup Hidet | |
uses: ./.github/actions/setup-hidet | |
- name: List installed packages | |
run: | | |
pip list | |
- name: Install docs dependencies | |
run: | | |
pip install -r docs/requirements.txt | |
- name: Build docs | |
run: | | |
cd docs; make clean; make html | |
publish: | |
name: Publish to PyPI | |
needs: [publish-tests, build-docs] # require tests to pass before deploy runs | |
if: github.event_name == 'release' && github.event.action == 'published' && startsWith(github.event.release.tag_name, 'v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Build package | |
uses: ./.github/actions/ | |
with: | |
version: ${{ steps.get_version.outputs.VERSION }} | |
- name: Show the wheel | |
run: | | |
ls scripts/wheel/built_wheel | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@v1.5.0 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages_dir: scripts/wheel/built_wheel |