Skip to content

Commit

Permalink
EVM-533 Nightly slack notificatinos (#1341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemanja0x authored Apr 3, 2023
1 parent 0631dd4 commit 880c32f
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ name: Build
on: # yamllint disable-line rule:truthy
workflow_dispatch:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
workflow_output:
description: "Build output"
value: ${{ jobs.go_build.outputs.build_output_failure }}

jobs:
go_build:
name: Polygon Edge
runs-on: ubuntu-latest
outputs:
build_output_failure: ${{ steps.edge_build_failure.outputs.build_output }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -27,6 +34,11 @@ jobs:
GOARC: amd64
GOOS: linux

- name: Build Polygon Edge Failed
if: failure()
id: edge_build_failure
run: echo "build_output=false" >> $GITHUB_OUTPUT

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
Expand All @@ -41,6 +53,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Go environment
uses: actions/setup-go@v3
with:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/e2e-polybft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on: # yamllint disable-line rule:truthy
- develop
pull_request:
workflow_call:
outputs:
workflow_output:
description: "E2E output"
value: ${{ jobs.build.outputs.e2e_output_failure }}

jobs:
build:
Expand All @@ -16,14 +20,23 @@ jobs:
E2E_LOGS: true
E2E_TESTS_TYPE: 'integration'
CI_VERBOSE: true
outputs:
e2e_output_failure: ${{ steps.run_e2e_failure.outputs.test_output }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Run tests
run: make test-e2e-polybft

- name: Run tests failed
if: failure()
id: run_e2e_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT

- name: Archive test logs
if: always()
uses: actions/upload-artifact@v3
Expand Down
71 changes: 70 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,73 @@ jobs:
name: Polybft Property Tests
uses: ./.github/workflows/property-polybft.yml
needs: build


notification:
name: Nightly Notifications
runs-on: ubuntu-latest
needs: [build, test, e2e, property]
if: success() || failure()
steps:
- name: Notify Slack
uses: slackapi/slack-github-action@v1.23.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TEST_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Nightly Build"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Status* ${{ needs.build.outputs.workflow_output == '' && needs.test.outputs.workflow_output == '' && needs.property.outputs.workflow_output == '' && needs.e2e.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Build ${{ needs.build.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Unit tests ${{ needs.test.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Property tests ${{ needs.property.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "E2E tests ${{ needs.e2e.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Workflow: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Results>"
}
}
]
}
13 changes: 13 additions & 0 deletions .github/workflows/property-polybft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on: # yamllint disable-line rule:truthy
- main
- develop
workflow_call:
outputs:
workflow_output:
description: "Property output"
value: ${{ jobs.build.outputs.property_output_failure }}

jobs:
build:
Expand All @@ -15,14 +19,23 @@ jobs:
E2E_LOGS: true
E2E_TESTS_TYPE: 'property'
CI_VERBOSE: true
outputs:
property_output_failure: ${{ steps.run_property_failure.outputs.test_output }}
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Run tests
run: make test-property-polybft

- name: Run tests failed
if: failure()
id: run_property_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT

- name: Archive test logs
if: always()
uses: actions/upload-artifact@v3
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ on: # yamllint disable-line rule:truthy
required: false
SONAR_HOST_URL:
required: false
outputs:
workflow_output:
description: "Unit tests output"
value: ${{ jobs.go_test.outputs.test_output_failure }}

jobs:
go_test:
name: Polygon Edge
runs-on: ubuntu-latest
outputs:
test_output_failure: ${{ steps.run_tests_failure.outputs.test_output }}
steps:
- name: Setup Go
uses: actions/setup-go@v3
Expand All @@ -28,8 +34,13 @@ jobs:
run: ./setup-ci.sh

- name: Run Go Test
run: go test -coverprofile coverage.out -timeout 20m `go list ./... | grep -v e2e`

run: make test

- name: Run Go Test Failed
if: failure()
id: run_tests_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT

# Triggering SonarQube analysis as results of it are required by Quality Gate check.
- name: SonarQube Scan
if: ${{ env.HAVE_SONAR_TOKEN == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ generate-bsd-licenses:

.PHONY: test
test:
go test -coverprofile coverage.out -timeout=20m `go list ./... | grep -v e2e`
go test -coverprofile coverage.out -timeout 20m `go list ./... | grep -v e2e`

.PHONY: test-e2e
test-e2e:
Expand Down

0 comments on commit 880c32f

Please sign in to comment.