-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bb12d0
commit 2b03ceb
Showing
5 changed files
with
119 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,18 +5,18 @@ on: | |
push: | ||
branches: [main] | ||
pull_request: | ||
schedule: | ||
# Cron executes at 0800, 1200 1600 (8am, 12pm, 4pm) | ||
- cron: "0 8,12,16 * * 1-5" | ||
# schedule: | ||
# # Cron executes at 0800, 1200 1600 (8am, 12pm, 4pm) | ||
# - cron: "0 8,12,16 * * 1-5" | ||
|
||
jobs: | ||
test-integration: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - name: Install Go | ||
# uses: actions/setup-go@v4 | ||
# with: | ||
# go-version: 1.19.x | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.19.x | ||
|
||
# - name: Add GOBIN to PATH | ||
# run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
|
@@ -33,7 +33,6 @@ jobs: | |
# restore-keys: | | ||
# ${{ runner.os }}-go- | ||
|
||
|
||
# - name: Integration Tests | ||
# if: github.event.pull_request.head.repo.full_name == github.repository | ||
# run: make test-integration cover-report | ||
|
@@ -55,25 +54,32 @@ jobs: | |
# INTEGRATION_TESTING_AZURE_SUBSCRIPTION_ID: ${{ secrets.INTEGRATION_TESTING_AZURE_SUBSCRIPTION_ID }} | ||
# INTEGRATION_TESTING_AZURE_TENANT_ID: ${{ secrets.INTEGRATION_TESTING_AZURE_TENANT_ID }} | ||
|
||
- name: Sent test report to Slack | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
# Uses Slack's Block Kit to build the message | ||
payload: | | ||
{ | ||
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | ||
} | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
# - name: Create test failure report | ||
# id: testFailureReport | ||
# run: | | ||
# go install github.com/mfridman/tparse@latest | ||
# make test-failure-report | ||
# tparse -file=coverage/integration.failures -format=markdown >> "$GITHUB_OUTPUT" | ||
|
||
# - name: Send test failures report to Slack | ||
# id: slack | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# # Uses Slack's Block Kit to build the message | ||
# payload: | | ||
# { | ||
# "text": "New Relic Terraform Provider Test Failures", | ||
# "blocks": [ | ||
# { | ||
# "type": "section", | ||
# "text": { | ||
# "type": "mrkdwn", | ||
# "text": "${{ steps.testFailureReport.outputs }}" | ||
# } | ||
# } | ||
# ] | ||
# } | ||
# env: | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,65 @@ jobs: | |
${{ runner.os }}-go- | ||
- name: Unit Tests | ||
run: make test-unit cover-report | ||
id: unit-tests | ||
run: | | ||
make test-unit cover-report | ||
- name: Report unit test coverage via Codecov | ||
uses: codecov/codecov-action@v3 | ||
- name: Create test failure report | ||
id: test-failure-report | ||
if: ${{ failure() }} | ||
run: | | ||
go install github.com/mfridman/tparse@latest | ||
make test-failure-report | ||
tparse -file=coverage/unit.failures -format=markdown > coverage/unit.md | ||
- name: Prepare multiline test report | ||
id: payload | ||
shell: bash | ||
if: ${{ always() }} | ||
run: | | ||
cat coverage/unit.md | ||
payload=$(cat coverage/unit.md) | ||
echo "test??" | ||
echo $payload | ||
echo "PAYLOAD<<EOF"$'\n'"$payload"$'\n'EOF >> "$GITHUB_OUTPUT" | ||
- name: Failure report | ||
id: failure-report | ||
if: ${{ always() }} | ||
run: | | ||
echo "${{ steps.test-failure-report.outputs.PAYLOAD }}" | ||
# - name: Report unit test coverage via Codecov | ||
# uses: codecov/codecov-action@v3 | ||
# with: | ||
# files: ./coverage/coverage.out | ||
|
||
- name: Send test failures report to Slack | ||
id: slack | ||
if: ${{ always() }} | ||
uses: slackapi/[email protected] | ||
with: | ||
files: ./coverage/coverage.out | ||
# Uses Slack's Block Kit to build the message | ||
payload: | | ||
{ | ||
"text": "New Relic Terraform Provider Test Failures", | ||
"blocks": [ | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "plain_text", | ||
"text": ${{ toJSON(steps.test-failure-report.outputs.PAYLOAD) }} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
if ! [ -f ./coverage/integration.report ]; then | ||
echo "File coverage/integration.report does not exist. Skipping." | ||
else | ||
echo "Creating integration test failures report..." | ||
grep 'FAIL:\|FAIL\|Error:\|error:' coverage/integration.report > coverage/integration.failures | ||
fi | ||
|
||
if ! [ -f ./coverage/unit.report ]; then | ||
echo "File coverage/unit.report does not exist. Skipping." | ||
else | ||
grep 'FAIL:\|FAIL\|Error:\|error:' coverage/unit.report > coverage/unit.failures | ||
fi | ||
|