Skip to content

TSPS-325 Add more cli commands #88

TSPS-325 Add more cli commands

TSPS-325 Add more cli commands #88

Workflow file for this run

name: Test Python CLI
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- '.github/**'
pull_request:
branches: [ '**' ]
# There is an issue with GitHub required checks and paths-ignore. We don't really need to
# run the tests if there are only irrelevant changes (see paths-ignore above). However,
# we require tests to pass by making a "required check" rule on the branch. If the action
# is not triggered, the required check never passes and you are stuck. Therefore, we have
# to run tests even when we only change a markdown file. So don't do what I did and put a
# paths-ignore right here!
workflow_dispatch: {}
jobs:
bump-check:
runs-on: ubuntu-latest
outputs:
is-bump: ${{ steps.skiptest.outputs.is-bump }}
steps:
- uses: actions/checkout@v2
- name: Skip version bump merges
id: skiptest
uses: ./.github/actions/bump-skip
with:
event-name: ${{ github.event_name }}
install-and-test-python-cli:
needs: [ bump-check ]
runs-on: ubuntu-latest
if: needs.bump-check.outputs.is-bump == 'no'
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install the thick CLI
run: |
poetry install
- name: Run linter check (ruff)
run: |
poetry run ruff check
- name: Run tests with coverage, write coverage report to coverage.xml
run: |
poetry run pytest --cov-report xml --cov=terralab
# The SonarQube scan is done here, so it can upload the coverage report generated by the tests.
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
notify-slack:
needs: [ bump-check, install-and-test-python-cli ]
runs-on: ubuntu-latest
if: failure() && github.event_name == 'push' && needs.bump-check.outputs.is-bump == 'no'
steps:
- name: Notify Teaspoons Slack on Failure
uses: broadinstitute/[email protected]
# see https://github.com/broadinstitute/action-slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: failure
channel: "#terra-tsps-alerts"
username: "Terralab CLI push to main branch"
author_name: "test-cli workflow"
icon_emoji: ":triangular_ruler:"
fields: job, commit