Skip to content

Commit

Permalink
ci: add a slack notification on failed, scheduled builds (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
thenextman authored Jan 19, 2024
1 parent 56ae1f0 commit 3ecae17
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'Dry run'
required: true
type: boolean
default: 'true'
default: true
schedule:
- cron: '21 3 * * 1' # 3:21 AM UTC every Monday

Expand All @@ -28,8 +28,6 @@ jobs:
id: get-dry-run
shell: pwsh
run: |
Set-PSDebug -Trace 1
$IsDryRun = '${{ github.event.inputs.dry-run }}' -Eq 'true' -Or '${{ github.event_name }}' -Eq 'schedule'
if ($IsDryRun) {
Expand Down Expand Up @@ -93,9 +91,7 @@ jobs:
- name: Configure Android NDK
if: matrix.os == 'android'
shell: pwsh
run: |
Set-PSDebug -Trace 1
run: |
$CargoConfigFile = "~/.cargo/config"
$AndroidToolchain="${Env:ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
Expand Down Expand Up @@ -129,8 +125,6 @@ jobs:
- name: Build picky (${{matrix.os}}-${{matrix.arch}})
shell: pwsh
run: |
Set-PSDebug -Trace 1
$DotNetOs = '${{matrix.os}}'
$DotNetArch = '${{matrix.arch}}'
$DotNetRid = '${{matrix.os}}-${{matrix.arch}}'
Expand Down Expand Up @@ -208,8 +202,6 @@ jobs:
- name: Configure runner
shell: pwsh
run: |
Set-PSDebug -Trace 1
wget -q https://github.com/awakecoding/llvm-prebuilt/releases/download/v2021.2.4/cctools-x86_64-ubuntu-20.04.tar.xz
tar -xf cctools-x86_64-ubuntu-20.04.tar.xz -C /tmp
sudo mv /tmp/cctools-x86_64-ubuntu-20.04/bin/lipo /usr/local/bin
Expand All @@ -223,8 +215,6 @@ jobs:
- name: Lipo native components
shell: pwsh
run: |
Set-PSDebug -Trace 1
Set-Location "dependencies/runtimes"
# No RID for universal binaries, see: https://github.com/dotnet/runtime/issues/53156
$OutputPath = Join-Path "${{ matrix.os }}-universal" "native"
Expand Down Expand Up @@ -313,8 +303,6 @@ jobs:
- name: Rename dependencies
shell: pwsh
run: |
Set-PSDebug -Trace 1
Set-Location "dependencies/runtimes"
$(Get-Item ".\picky-*") | ForEach-Object { Rename-Item $_ $_.Name.Replace("picky-", "") }
Get-ChildItem * -Recurse
Expand Down Expand Up @@ -352,8 +340,6 @@ jobs:
- name: Publish to nuget.org
shell: pwsh
run: |
Set-PSDebug -Trace 1
$Files = Get-ChildItem -Recurse package/*.nupkg
foreach ($File in $Files) {
Expand All @@ -373,3 +359,33 @@ jobs:
$PushCmd = $PushCmd -Join ' '
Invoke-Expression $PushCmd
}

notify:
name: Notify failure
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
needs:
- preflight
- build-universal
- build-managed
- build-managed
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- name: Send slack notification
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>"
}
}
]
}

0 comments on commit 3ecae17

Please sign in to comment.