Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tech] add notification to slack #775

Merged
merged 9 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: # Build 'master' branch
- 'master'
pull_request: # Build any PR
env:
SLACK_TEXT: '{"attachments":[{
"text":":warning: Un job demande votre attention !","color":"#D00000",
"fields":[{"title":"GitHub URL","value": "https://github.com/CanalTP/transit_model/actions/workflows/ci.yml"}]
}]}'

jobs:
rustfmt:
Expand All @@ -15,6 +20,10 @@ jobs:
- uses: actions/checkout@master
- name: Check formatting
run: make format
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}

clippy:
name: Analyzing code with Clippy
Expand All @@ -24,6 +33,10 @@ jobs:
- uses: actions/checkout@master
- name: Linting
run: make lint
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}

audit:
name: Audits
Expand All @@ -36,6 +49,10 @@ jobs:
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}

tests:
name: Tests
Expand All @@ -49,6 +66,10 @@ jobs:
run: apt update && apt install --yes libxml2-utils
- name: Run tests with and without features
run: make test
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}

coverage:
name: Code coverage
Expand All @@ -74,3 +95,7 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}
9 changes: 9 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Publish on crates.io
on:
release:
types: [published]
env:
SLACK_TEXT: '{"attachments":[{
"text":":warning: Un job demande votre attention !","color":"#D00000",
"fields":[{"title":"GitHub URL","value": "https://github.com/CanalTP/transit_model/actions/workflows/publish.yml"}]
}]}'

jobs:
publish:
Expand All @@ -20,3 +25,7 @@ jobs:
with:
command: publish
args: --all-features
- name: slack notification (the job has failed)
if: failure() && github.ref == 'ref/head/master'
run: |
curl -s -X POST -H "Content-Type: application/json" -d '${{ env.SLACK_TEXT }}' ${{ secrets.SLACK_CORE_TOOLS_TEAM_URL }}