Hidden Darwinia and Crab #623
Workflow file for this run
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
name: Test | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
test-lint: | |
name: ESlint check | |
runs-on: ubuntu-latest | |
outputs: | |
check-ok: ${{ steps.output-ok.outputs.STATUS }} | |
check-err: ${{ steps.output-err.outputs.STATUS }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: install | |
run: yarn | |
- name: Lint | |
run: yarn lint | |
- id: output-ok | |
run: echo "::set-output name=STATUS::ok" | |
- id: output-err | |
if: failure() | |
run: echo "::set-output name=STATUS::err" | |
test-unit: | |
name: Unit test | |
runs-on: ubuntu-latest | |
outputs: | |
check-ok: ${{ steps.output-ok.outputs.STATUS }} | |
check-err: ${{ steps.output-err.outputs.STATUS }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: install | |
run: yarn | |
- name: test apps | |
run: yarn test:apps:unit | |
- name: test shared | |
run: yarn test:shared | |
- id: output-ok | |
run: echo "::set-output name=STATUS::ok" | |
- id: output-err | |
if: failure() | |
run: echo "::set-output name=STATUS::err" | |
test-bundle: | |
name: Bundle test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- apps | |
- apps:test | |
outputs: | |
check-ok: ${{ steps.output-ok.outputs.STATUS }} | |
check-err: ${{ steps.output-err.outputs.STATUS }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: install | |
run: yarn | |
- name: build | |
run: yarn build:${{matrix.package}} | |
- id: output-ok | |
run: echo "::set-output name=STATUS::ok" | |
- id: output-err | |
if: failure() | |
run: echo "::set-output name=STATUS::err" | |
completed-test: | |
name: Completed test | |
runs-on: ubuntu-latest | |
needs: [test-unit, test-bundle, test-lint] | |
if: always() | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Test status | |
id: test-status | |
run: | | |
UNIT_OK='${{ needs.test-unit.outputs.check-ok }}' | |
UNIT_ERR='${{ needs.test-unit.outputs.check-err }}' | |
BUNDLE_OK='${{ needs.test-bundle.outputs.check-ok }}' | |
BUNDLE_ERR='${{ needs.test-bundle.outputs.check-err }}' | |
LINT_OK='${{ needs.test-lint.outputs.check-ok }}' | |
LINT_ERR='${{ needs.test-lint.outputs.check-err }}' | |
UNIT_STATUS= | |
BUNDLE_STATUS= | |
LINT_STATUS= | |
if [ "${UNIT_OK}" == "ok" ]; then | |
UNIT_STATUS="π ${UNIT_OK}" | |
else | |
UNIT_STATUS="π ${UNIT_ERR}" | |
fi | |
if [ "${BUNDLE_OK}" == "ok" ]; then | |
BUNDLE_STATUS="π ${BUNDLE_OK}" | |
else | |
BUNDLE_STATUS="π ${BUNDLE_ERR}" | |
fi | |
if [ "${LINT_OK}" == "ok" ]; then | |
LINT_STATUS="π ${LINT_OK}" | |
else | |
LINT_STATUS="π ${LINT_ERR}" | |
fi | |
SHA='${{github.event.pull_request.head.sha}}' | |
SHA=${SHA::7} | |
COMMIT="[${SHA}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${SHA})" | |
ARTIFACTS_MD= | |
ARTIFACTS_LINK= | |
if [[ "${UNIT_ERR}" == "err" ]]; then | |
ARTIFACTS_LINK="https://github.com/darwinia-network/wormhole-ui/actions/runs/${{ github.run_id }}" | |
ARTIFACTS_MD="[${{ github.run_id }}](${ARTIFACTS_LINK})" | |
echo "::set-output name=ARTIFACTS_MD::${ARTIFACTS_MD}" | |
echo "::set-output name=ARTIFACTS_LINK::${ARTIFACTS_LINK}" | |
fi | |
echo "::set-output name=E2E_STATUS::${E2E_STATUS}" | |
echo "::set-output name=UNIT_STATUS::${UNIT_STATUS}" | |
echo "::set-output name=BUNDLE_STATUS::${BUNDLE_STATUS}" | |
echo "::set-output name=LINT_STATUS::${LINT_STATUS}" | |
echo "::set-output name=COMMIT::${COMMIT}" | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
append: true | |
message: | | |
\--- | |
Type: π§ͺ | |
Commit: ${{ steps.test-status.outputs.COMMIT }} | |
Unit: ${{ steps.test-status.outputs.UNIT_STATUS }} | |
Bundle: ${{ steps.test-status.outputs.BUNDLE_STATUS }} | |
Lint: ${{ steps.test-status.outputs.LINT_STATUS }} | |
Artifacts: ${{ steps.test-status.outputs.ARTIFACTS_MD }} | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: helix-ui | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_ICON: https://avatars.githubusercontent.com/u/14985020?s=48&v=4 | |
SLACK_MESSAGE: | | |
Unit: ${{ steps.test-status.outputs.UNIT_STATUS }} | |
Bundle: ${{ steps.test-status.outputs.BUNDLE_STATUS }} | |
Lint: ${{ steps.test-status.outputs.LINT_STATUS }} | |
Artifacts: ${{ steps.test-status.outputs.ARTIFACTS_LINK }} | |
SLACK_TITLE: Cypress | |
SLACK_USERNAME: Vercel | |
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }} |