Skip to content

Instantly share code, notes, and snippets.

@faermanj
Last active February 21, 2023 16:06
Show Gist options
  • Save faermanj/e8eca01ded8cd644c9a9d227f3407104 to your computer and use it in GitHub Desktop.
Save faermanj/e8eca01ded8cd644c9a9d227f3407104 to your computer and use it in GitHub Desktop.
Test matrix with github actions
name: Test all versions
on:
workflow_dispatch: {}
jobs:
iterate_and_call:
runs-on: ubuntu-latest
strategy:
matrix:
a-version: ['1.0', '2.0', '3.0']
b-version: ['A.B', 'C.D', 'E.F']
steps:
- name: Iterate over Compatibility Matrix
if: |
(matrix.a-version == '1.0') && (matrix.b-version == 'A.B')
|| (matrix.a-version == '1.0') && (matrix.b-version == 'C.D')
|| (matrix.a-version == '2.0')
run: |
echo "Testing with a: ${{ matrix.a-version }} b: ${{ matrix.b-version }}"
curl -X POST \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
https://api.github.com/repos/CaravanaCloud/cloud-janitor-collection/actions/workflows/test-version.yml/dispatches \
-d '{"ref":"main", "inputs": {"a-version": "${{ matrix.a-version }}", "b-version": "${{ matrix.b-version }}"}}'
echo "Sent dispatch to version ${{ matrix.a-version }} - ${{ matrix.b-version }}"
name: Test single version set
on:
workflow_dispatch:
inputs:
a-version:
description: a version
b-version:
description: b version
jobs:
test_version:
runs-on: ubuntu-latest
steps:
- name: Test version
run: |
echo "Testing version ${{ github.event.inputs.a-version }} - ${{ github.event.inputs.b-version }}..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment