Skip to content

Commit

Permalink
✨ Trigger ALL tests on release
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker committed Jan 17, 2025
1 parent c76e0f4 commit 2b3d756
Showing 1 changed file with 118 additions and 6 deletions.
124 changes: 118 additions & 6 deletions .github/workflows/test-released-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,141 @@ on:
description: "Version to test"
required: true
default: "9.0.0"
release:
types: [published]

env:
# C07QZDJFF89 == #release-coordination
SLACK_BOT_CHANNEL_ID: "C07QZDJFF89"

jobs:
notification-start:
name: Send Slack notification
runs-on: ubuntu-latest
outputs:
update-ts: ${{ steps.slack.outputs.ts }}
steps:
- id: slack
uses: slackapi/[email protected]
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}"
text: "GitHub Actions Run"
attachments:
- color: "#FFFF00"
blocks:
- type: "section"
fields:
- type: "mrkdwn"
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
- type: "mrkdwn"
text: "*Status:*\n`In Progress`"
setup:
runs-on: ubuntu-latest
needs: notification-start
name: 'Unify Inputs'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
INPUT_NAME=${{ inputs.name }}
if [[ ${INPUT_NAME} == '' ]]; then
echo "Name is empty, using default"
echo "name=mondoo" >> $GITHUB_OUTPUT
else
echo "Name: ${INPUT_NAME}"
echo "name=${INPUT_NAME}" >> $GITHUB_OUTPUT
fi
V=$(echo $VERSION | sed 's/v//')
echo "Version: $V"
echo "version=${V}" >> $GITHUB_OUTPUT
# wait at least for one package to be published, otherwise tests will fail directly
- name: Wait for packages to be published (Release Event)
if: github.event_name == 'release'
id: check_release_file
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 10
timeout_seconds: 5
max_attempts: 60
retry_on: error
# error on HTTP code different to 200
command: |
vSEMVER=${{ steps.version.outputs.version }}
SEMVER="${vSEMVER//v}"
curl -o /dev/null -s -w "%{http_code}\n" "https://releases.mondoo.com/mondoo/${SEMVER}/mondoo_${SEMVER}_windows_amd64.msi" | grep 200
test-arch:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-archlinux.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}
test-docker:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-docker.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}
test-install-sh:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-install-sh.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}
test-install-ps1:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-install-ps1.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}
test-osx-pkg:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-osx-pkg.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}
test-brew:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-brew.yaml
with:
version: ${{ github.event.inputs.version }}
version: ${{ needs.setup.outputs.version }}

notification:
runs-on: ubuntu-latest
name: Update Slack notification
needs: [test-arch, test-docker, test-install-sh, test-install-ps1, test-osx-pkg, test-brew, notification-start, setup]
if: ${{ always() }}
steps:
- name: Set status
id: status
run: |
echo "status_success=${{ needs.setup.result == 'success' && needs.test-arch.result == 'success' && needs.test-docker.result == 'success' && needs.test-install-sh.result == 'success' && needs.test-install-ps1.result == 'success' && needs.test-osx-pkg.result == 'success' && needs.test-brew.result == 'success' }}" >> $GITHUB_OUTPUT
- uses: slackapi/[email protected]
if : ${{ always() }}
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}"
ts: "${{ needs.notification-start.outputs.update-ts }}"
text: "GitHub Actions Run"
attachments:
- color: "${{ steps.status.outputs.status_success == 'true' && '#00FF00' || '#FF0000' }}"
blocks:
- type: "section"
fields:
- type: "mrkdwn"
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
- type: "mrkdwn"
text: "*Status:*\n`${{ steps.status.outputs.status_success == 'true' && 'Success' || 'Failed' }}`"

0 comments on commit 2b3d756

Please sign in to comment.