CI stuff and codecov #5
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
| name: CI/CD Pipeline | ||
| on: | ||
| push: | ||
| branches: [master] | ||
| release: | ||
| types: [published] | ||
| jobs: | ||
| test-on-all-push: | ||
| name: Test on Master Branch | ||
| if: github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
| fail-fast: false | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Update pip | ||
| run: python -m pip install --upgrade pip | ||
| - name: Install wheel and build tools | ||
| run: python -m pip install --upgrade wheel build | ||
| - name: Install PyTorch and dependencies | ||
| run: | | ||
| pip install --index-url https://download.pytorch.org/whl/cpu torch==2.6.0 | ||
| pip install -r ci/requirements.txt | ||
| pip install . | ||
| - name: Run tests | ||
| run: pytest tests --cov solt --cov-report=xml --junitxml=./junit.xml | ||
| - name: Check code formatting | ||
| run: black --config=black.toml --check . | ||
| - name: Run flake8 linter | ||
| run: flake8 | ||
| - name: Upload test results to Codecov | ||
| if: ${{ !cancelled() }} | ||
| uses: codecov/test-results-action@v1 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| build-and-publish: | ||
| name: Build and Publish to PyPI | ||
| runs-on: ubuntu-latest | ||
| needs: test-on-release | ||
|
Check failure on line 58 in .github/workflows/prod-release.yaml
|
||
| if: github.event_name == 'release' | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/solt/ | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Install build tools | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install --upgrade wheel build twine | ||
| - name: Build distributions | ||
| run: python -m build | ||
| - name: Validate built packages with twine | ||
| run: twine check dist/* | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| packages-dir: dist/ | ||
| verbose: true | ||