diff --git a/DOT_github/workflows/ci.yaml b/DOT_github/workflows/ci.yaml new file mode 100644 index 0000000..da39249 --- /dev/null +++ b/DOT_github/workflows/ci.yaml @@ -0,0 +1,59 @@ +name: Run tests and upload coverage + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + name: Run tests with pytest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "windows-latest"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 + + - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + + - name: Install uv + uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff + + - name: Create virtual environment + run: uv venv .venv + + - name: Add venv to PATH (Linux/macOS) + if: runner.os != 'Windows' + run: | + echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV + echo "$PWD/.venv/bin" >> $GITHUB_PATH + + - name: Add venv to PATH (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + "VIRTUAL_ENV=.venv" >> $env:GITHUB_ENV + "$pwd\.venv\Scripts" >> $env:GITHUB_PATH + + - name: Install dependencies + run: make install + + - name: Run tests under coverage + shell: bash + run: | + coverage run --source=PACKAGE -m pytest + coverage report + + - name: Upload results to Codecov + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/DOT_github/workflows/release.yaml b/DOT_github/workflows/release.yaml new file mode 100644 index 0000000..0fd128c --- /dev/null +++ b/DOT_github/workflows/release.yaml @@ -0,0 +1,40 @@ +name: Release to PyPI + +on: + workflow_dispatch: + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 + + - name: Install uv + uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff + + - name: Build package + run: uv build + + - name: Upload dist + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: dist + path: dist/ + + publish: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Download dist + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b