[pre-commit.ci] pre-commit autoupdate #888
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: | |
fail-fast: false | |
permissions: | |
contents: "read" | |
id-token: "write" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up conda environment for testing | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-file: environment.yml | |
cache-environment: true | |
cache-environment-key: environment-${{ hashFiles('pyproject.toml') }} | |
condarc: | | |
channels: | |
- conda-forge | |
channel_priority: strict | |
- name: Log VM and conda environnment information | |
run: | | |
lscpu | |
free -h | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
- name: Authenticate gcloud | |
id: gcloud-auth | |
continue-on-error: true | |
uses: "google-github-actions/auth@v2" | |
with: | |
workload_identity_provider: "projects/345950277072/locations/global/workloadIdentityPools/gh-actions-pool/providers/gh-actions-provider" | |
service_account: "pudl-usage-metrics-etl@catalyst-cooperative-pudl.iam.gserviceaccount.com" | |
create_credentials_file: true | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v2" | |
with: | |
version: ">= 363.0.0" | |
- name: Run tox | |
env: | |
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }} | |
POSTGRES_IP: ${{ secrets.POSTGRES_IP }} | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} | |
KAGGLE_KEY: ${{ secrets.KAGGLE_KEY }} | |
KAGGLE_USERNAME: ${{ secrets.KAGGLE_USERNAME }} | |
run: | | |
tox | |
- name: Upload test coverage report to CodeCov | |
uses: codecov/codecov-action@v4 | |
ci-notify: | |
runs-on: ubuntu-latest | |
needs: ci-test | |
if: ${{ always() }} | |
steps: | |
- name: Inform the Codemonkeys | |
uses: 8398a7/action-slack@v3 | |
continue-on-error: true | |
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 |