Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Trigger ALL tests on release #510

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/slack-github-action@v2.0.0
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/slack-github-action@v2.0.0
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' }}`"
Loading