feature/update-python-versions: running cicd (test, and push documentation/package on tags) #219
Workflow file for this run
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: test-pr | |
run-name: "${{ github.ref_name }}: running cicd (test, and push documentation/package on tags)" | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
# Test for multiple python versions | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: adopt | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: vemonet/setup-spark@v1 | |
with: | |
spark-version: '3.2.1' | |
hadoop-version: '3.2' | |
- name: Install dependencies | |
run: make local-install | |
- name: Install pre-commit | |
run: make pre-commit-install | |
- name: Run pre-commit | |
run: make pre-commit-run | |
- name: Test and coverage | |
run: python -m pytest -m "not wheel" --cov-report term-missing --cov mlpype -ra --junitxml=junit/test-results-${{ matrix.python-version }}.xml | |
- name: Upload test/covarage test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
# These should only be run on tags | |
# Build the documentation and upload the static HTML files as an artifact. | |
build-docs: | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ github.ref_type == 'tag' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: make local-install | |
- name: Create docs | |
run: make create-docs | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: docs/ | |
# Deploy the artifact to GitHub pages. | |
# This is a separate job so that only actions/deploy-pages has the necessary permissions. | |
deploy-docs: | |
needs: build-docs | |
runs-on: ubuntu-latest | |
if: ${{ github.ref_type == 'tag' }} | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v1 | |
# Deploy the package to pypi | |
deploy-package: | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ github.ref_type == 'tag' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10 | |
- name: Install dependencies | |
run: make local-install | |
- name: Build src | |
run: make build-packages | |
- name: Push | |
run: twine upload dist/* -u ${{ secrets.TWINE_USER }} -p ${{ secrets.TWINE_PW }} | |