Skip to content

Commit

Permalink
ci: add status for build and test (#1284)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

Add status for build and test workflow in Test-environment

<!--- Describe your changes in detail -->

## Related Issue(s)

- #{issue number}

## Verification

- [ ] **Your** code builds clean without any errors or warnings
- [ ] Manual testing done (required)
- [ ] Relevant automated test added (if you find this hard, leave it and
we'll help out)

## Documentation

- [ ] Documentation is updated (either in `docs`-directory, Altinnpedia
or a separate linked PR in
[altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if
applicable)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced Slack notifications to include the status of the build and
test process upon failure.
- Added a new input parameter for CI/CD status messages, improving
reporting capabilities.

- **Bug Fixes**
- Updated logic for status emojis to accurately reflect the build and
test job status.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
arealmaas authored Oct 14, 2024
1 parent ec13b3d commit 7267546
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,15 @@ jobs:

send-slack-message-on-failure:
name: Send Slack message on failure
needs: [deploy-infra-test, deploy-apps-test, deploy-slack-notifier-test, run-e2e-tests, publish-schema-npm, publish]
needs: [
deploy-infra-test,
deploy-apps-test,
deploy-slack-notifier-test,
run-e2e-tests,
publish-schema-npm,
publish,
build-and-test,
]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
Expand All @@ -163,6 +171,7 @@ jobs:
e2e_tests_status: ${{ needs.run-e2e-tests.result }}
schema_npm_status: ${{ needs.publish-schema-npm.result }}
publish_status: ${{ needs.publish.result }}
build_and_test_status: ${{ needs.build-and-test.result }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_FOR_CI_CD_STATUS }}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
type: string
description: "Status of the docker image publishing job"
default: "skipped"
build_and_test_status:
type: string
description: "Status of the build and test job"
default: "skipped"
secrets:
SLACK_BOT_TOKEN:
required: true
Expand Down Expand Up @@ -64,6 +68,7 @@ jobs:
echo "E2E_TESTS_EMOJI=$(determine_emoji "${{ inputs.e2e_tests_status }}")"
echo "SCHEMA_NPM_EMOJI=$(determine_emoji "${{ inputs.schema_npm_status }}")"
echo "PUBLISH_EMOJI=$(determine_emoji "${{ inputs.publish_status }}")"
echo "BUILD_AND_TEST_EMOJI=$(determine_emoji "${{ inputs.build_and_test_status }}")"
} >> "$GITHUB_OUTPUT"
- name: Send GitHub slack message
Expand All @@ -79,6 +84,7 @@ jobs:
E2E_TESTS_STATUS: "${{ steps.status-emojis.outputs.E2E_TESTS_EMOJI }}"
SCHEMA_NPM_STATUS: "${{ steps.status-emojis.outputs.SCHEMA_NPM_EMOJI }}"
PUBLISH_STATUS: "${{ steps.status-emojis.outputs.PUBLISH_EMOJI }}"
BUILD_AND_TEST_STATUS: "${{ steps.status-emojis.outputs.BUILD_AND_TEST_EMOJI }}"
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
Expand Down

0 comments on commit 7267546

Please sign in to comment.