Skip to content

Commit

Permalink
Adding slack webhook
Browse files Browse the repository at this point in the history
mtauraso committed Nov 13, 2024
1 parent 16d2180 commit cd3bff9
Showing 1 changed file with 64 additions and 26 deletions.
90 changes: 64 additions & 26 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -7,29 +7,67 @@ on:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tests

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Unpack test files
run: |
tar xf elasticc2_alert_test_data.tar.bz2
- name: Build docker images
run: |
docker compose build
- name: Bring docker environments up
run: |
docker compose up -d shell
- name: Run Cycle Tests
run: |
docker compose exec -it shell /bin/bash -c "python3 -m pytest /tests/test_elasticc2_spectrumcycle.py"
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tests

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Unpack test files
run: |
tar xf elasticc2_alert_test_data.tar.bz2
- name: Build docker images
run: |
docker compose build
- name: Bring docker environments up
run: |
docker compose up -d shell
- name: Run Cycle Tests
run: |
docker compose exec -it shell /bin/bash -c "python3 -m pytest /tests/test_elasticc2_spectrumcycle.py"
- name: Post to a Slack channel
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C080P31B1L4' # #lf-resspect-ci channel in LSSTC slack workspace
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.repository }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: *${{ job.status }}* :${{ job.status }}:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit cd3bff9

Please sign in to comment.