This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
[pre-commit.ci] pre-commit autoupdate #331
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: tox-pytest | |
on: [push, pull_request] | |
jobs: | |
ci-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v1" | |
with: | |
workload_identity_provider: "projects/345950277072/locations/global/workloadIdentityPools/gh-actions-pool/providers/gh-actions-provider" | |
service_account: "tox-pytest-github-action@catalyst-cooperative-pudl.iam.gserviceaccount.com" | |
- name: Set up conda environment for testing | |
uses: conda-incubator/setup-miniconda@v2.2.0 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
python-version: ${{ matrix.python-version }} | |
activate-environment: pudl-catalog | |
environment-file: environment.yml | |
- shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
- name: Run PyTest with Tox | |
run: | | |
conda run -n pudl-catalog tox | |
- name: Upload test coverage report to CodeCov | |
uses: codecov/codecov-action@v3 | |
ci-notify: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: ci-test | |
steps: | |
- name: Inform the Codemonkeys | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: workflow,job,commit,repo,ref,author,took | |
custom_payload: | | |
{ | |
username: 'action-slack', | |
icon_emoji: ':octocat:', | |
attachments: [{ | |
color: '${{ needs.ci-test.result }}' === 'success' ? 'good' : '${{ needs.ci-test.result }}' === 'failure' ? 'danger' : 'warning', | |
text: `${process.env.AS_REPO}@${process.env.AS_REF}\n ${process.env.AS_WORKFLOW} (${process.env.AS_COMMIT})\n by ${process.env.AS_AUTHOR}\n Status: ${{ needs.ci-test.result }}`, | |
}] | |
} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} # required | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required |