[pre-commit.ci] pre-commit autoupdate #656
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] | |
env: | |
PUDL_OUTPUT: ~/pudl-work/output/ | |
PUDL_INPUT: ~/pudl-work/data/ | |
jobs: | |
ci-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up conda environment for testing | |
uses: conda-incubator/[email protected] | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
python-version: "3.11" | |
activate-environment: pudl-rmi | |
environment-file: environment.yml | |
- name: Log the conda environment | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
# - name: Cache PUDL DB | |
# uses: actions/[email protected] | |
# with: | |
# path: ~/pudl-work/data/pudl.sqlite | |
# # The last time we deployed Datasette. Update if we redeploy. | |
# key: "2022-05-05" | |
- name: Download PUDL DB and log pre-test PUDL workspace contents | |
run: | | |
mkdir -p ~/pudl-work/output/ | |
curl -o ~/pudl-work/output/pudl.sqlite http://intake.catalyst.coop.s3.amazonaws.com/dev/pudl.sqlite | |
find ~/pudl-work/ | |
- name: Log SQLite3 version | |
run: | | |
conda run -n pudl-rmi which sqlite3 | |
conda run -n pudl-rmi sqlite3 --version | |
- name: Run pytest using Tox | |
env: | |
API_KEY_EIA: ${{ secrets.API_KEY_EIA }} | |
run: | | |
conda run -n pudl-rmi tox -- --five-year-coverage | |
- name: Log post-test PUDL workspace contents | |
run: find ~/pudl-work/ | |
- name: Upload test coverage report to CodeCov | |
uses: codecov/[email protected] | |
with: | |
verbose: true | |
files: ./coverage.xml | |
ci-notify: | |
runs-on: ubuntu-latest | |
needs: ci-test | |
if: ${{ always() }} | |
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 |