Cdaction #1
Workflow file for this run
This file contains hidden or 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
| # Workflow for publishing into pyPI | |
| name: ci-cd | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| workflow_dispatch: | |
| jobs: | |
| ci: | |
| # Set up operating system | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| # Steps represent a sequence of tasks that will be executed as | |
| # part of the job | |
| steps: | |
| # Checks-out your repository so your job can access it | |
| - name: Check-out repository | |
| uses: actions/checkout@v2 | |
| # Set up Python | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[tests] | |
| # Run pytest with coverage | |
| - name: Run tests with coverage | |
| run: | | |
| pytest --cov --cov-report=term --cov-branch | |
| cd: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| # Only run this job if the "ci" job passes | |
| needs: ci | |
| # Only run this job if new work is pushed to "main" or "dev" | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' ) | |
| # Set up operating system | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| # Define job steps | |
| steps: | |
| - name: Check-out repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Hatch build | |
| run: hatch build | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: steps.release.outputs.released == 'true' | |
| with: | |
| repository-url: https://test.pypi.org/dumbpy/ | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| - name: Test install from TestPyPI | |
| run: | | |
| pip install \ | |
| --index-url https://test.pypi.org/dumbpy/ \ | |
| --extra-index-url https://pypi.org/dumbpy \ | |
| pycounts | |