From 860cb0a16f301cd1e1cbd18a23501ba09476eebb Mon Sep 17 00:00:00 2001 From: Kuba Mazurek Date: Thu, 17 Jun 2021 23:54:29 +0200 Subject: [PATCH] Use dynamic stable branch in goth nightly --- .github/workflows/goth-nightly.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/goth-nightly.yml b/.github/workflows/goth-nightly.yml index 8040a9fcd..4fd16e506 100644 --- a/.github/workflows/goth-nightly.yml +++ b/.github/workflows/goth-nightly.yml @@ -6,13 +6,37 @@ on: - cron: '0 1 * * *' jobs: + prepare-matrix: + name: Prepare matrix JSON + runs-on: ubuntu-latest + outputs: + matrix-json: ${{ steps.get-matrix.outputs.matrix }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # finds branches with names matching 'b[0-9](\.[0-9])+' (e.g. b0.6) and returns the one with highest version + - name: Get latest stable branch + id: latest-stable + # sed removes leading whitespaces and '*' characters (git uses it to indicate the current branch) + run: | + branch=$(git branch -a | sed 's/remotes\/origin\///' | sed 's/^[ \t*]*//' | grep -E '^b[0-9](\.[0-9])+$' | sort -Vr | head -1) + echo "::set-output name=branch::$branch" + + # prepares JSON object representing strategy matrix which contains two 'branch' variants: master and latest stable + - name: Get matrix JSON + id: get-matrix + run: echo "::set-output name=matrix::{\"include\":[{\"branch\":\"master\"},{\"branch\":\"${{ steps.latest-stable.outputs.branch }}\"}]}" + goth-tests: + runs-on: goth + needs: prepare-matrix strategy: + matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix-json) }} fail-fast: false - matrix: - branch: ["master", "b0.6"] name: Run integration tests (nightly) on ${{ matrix.branch }} - runs-on: goth steps: - name: Checkout uses: actions/checkout@v2