From f2376a3c427b273cdc0bea6a0554869ac670e0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 10:54:29 +0200 Subject: [PATCH 1/9] added CI stable build --- .github/workflows/build_ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index 992f178aa..df8c40746 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -13,6 +13,7 @@ jobs: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] + target: ${{ github.ref == 'refs/heads/master' && [ 'refs/heads/master', 'refs/heads/stable' ] || [ github.ref ] }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: @@ -38,7 +39,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v3 with: - ref: ${{ github.ref }} + ref: ${{ matrix.target }} - name: Set ulimit run: ulimit -n 9999 - name: venv Setup From 827d5b1dbb9a6301206d2d6dd3993e4c24ae3839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:03:52 +0200 Subject: [PATCH 2/9] action type fix --- .github/workflows/build_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index df8c40746..e193ca654 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] - target: ${{ github.ref == 'refs/heads/master' && [ 'refs/heads/master', 'refs/heads/stable' ] || [ github.ref ] }} + target: ${{ github.ref == 'refs/heads/master' && toJSON('[ \'refs/heads/master\', \'refs/heads/stable\' ]') || toJSON('[' + github.ref + ']') }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: From 152f42569de453d19b4b288e9b564e33182f057c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:09:39 +0200 Subject: [PATCH 3/9] syntax fix? --- .github/workflows/build_ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index e193ca654..36d873c45 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -6,6 +6,8 @@ on: schedule: - cron: "0 3 * * *" workflow_dispatch: +env: + MY_ENV_VAR: ${{ github.ref == 'refs/heads/master' && '[ \'refs/heads/master\', \'refs/heads/stable\' ]' || '[ ${{ github.ref }} ]' }} jobs: build-ci: @@ -13,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] - target: ${{ github.ref == 'refs/heads/master' && toJSON('[ \'refs/heads/master\', \'refs/heads/stable\' ]') || toJSON('[' + github.ref + ']') }} + target: ${{ toJSON(MY_ENV_VAR) }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: From f13c0f7989ba8635f49ec306f8557c01b32bde24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:10:40 +0200 Subject: [PATCH 4/9] syntax fix?? --- .github/workflows/build_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index 36d873c45..b95e0b29e 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -7,7 +7,7 @@ on: - cron: "0 3 * * *" workflow_dispatch: env: - MY_ENV_VAR: ${{ github.ref == 'refs/heads/master' && '[ \'refs/heads/master\', \'refs/heads/stable\' ]' || '[ ${{ github.ref }} ]' }} + MY_ENV_VAR: ${{ github.ref == 'refs/heads/master' && '[ \\'refs/heads/master\\', \\'refs/heads/stable\\' ]' || '[ ${{ github.ref }} ]' }} jobs: build-ci: From 4cd7172d503105888204784167226599919cd0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:14:00 +0200 Subject: [PATCH 5/9] syntax fix??? --- .github/workflows/build_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index b95e0b29e..bb0fd6bfe 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -7,7 +7,7 @@ on: - cron: "0 3 * * *" workflow_dispatch: env: - MY_ENV_VAR: ${{ github.ref == 'refs/heads/master' && '[ \\'refs/heads/master\\', \\'refs/heads/stable\\' ]' || '[ ${{ github.ref }} ]' }} + TARGET: ${{ github.ref == 'refs/heads/master' && '[ "refs/heads/master", "refs/heads/stable" ]' || '[ "${{ github.ref }}" ]' }} jobs: build-ci: @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] - target: ${{ toJSON(MY_ENV_VAR) }} + target: ${{ toJSON(TARGET) }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: From 45741594130612a240d40063358aa80bf422c5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:15:27 +0200 Subject: [PATCH 6/9] syntax fix?(4) --- .github/workflows/build_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index bb0fd6bfe..f8367efe0 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] - target: ${{ toJSON(TARGET) }} + target: ${{ toJSON(env.TARGET) }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: From 857c1b56c12cd3d766060dd5a57d4c996841bbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 11:54:14 +0200 Subject: [PATCH 7/9] ci action: two stage build --- .github/workflows/build_ci.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index f8367efe0..565774990 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -6,16 +6,31 @@ on: schedule: - cron: "0 3 * * *" workflow_dispatch: -env: - TARGET: ${{ github.ref == 'refs/heads/master' && '[ "refs/heads/master", "refs/heads/stable" ]' || '[ "${{ github.ref }}" ]' }} jobs: + generate-matrix: + name: Generate matrix for build + runs-on: ubuntu-latest + outputs: + target: ${{ steps.set-matrix.outputs.target }} + steps: + - id: set-matrix + run: | + if [ $GITHUB_BASE_REF ]; then + # Pull Request -> only use that branch + export TARGET="[\"${GITHUB_REF}\"]" + else + # scheduled build -> use master & stable branch + export TARGET='["refs/heads/master","refs/heads/stable"]' + fi + echo "target=${TARGET}" | tee -a $GITHUB_OUTPUT build-ci: + needs: generate-matrix strategy: fail-fast: false matrix: os: [ focal, jammy, bullseye, bookworm ] - target: ${{ toJSON(env.TARGET) }} + target: ${{ fromJson(needs.generate-matrix.outputs.target) }} runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] timeout-minutes: 35 steps: From 09dda3b3fb2ba0179e49bbfa6f651341dbf9e55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 12:15:22 +0200 Subject: [PATCH 8/9] ci action: check from base_ref check to ref/ref_name --- .github/workflows/build_ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index 565774990..faa532456 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -16,12 +16,13 @@ jobs: steps: - id: set-matrix run: | - if [ $GITHUB_BASE_REF ]; then - # Pull Request -> only use that branch - export TARGET="[\"${GITHUB_REF}\"]" - else + echo "github.ref: ${GITHUB_REF}, name: ${GITHUB_REF_NAME}, base: ${GITHUB_BASE_REF}" + if [ "${GITHUB_REF}" = "refs/heads/master" ] || [ "${GITHUB_REF_NAME}" = "master" ]; then # scheduled build -> use master & stable branch export TARGET='["refs/heads/master","refs/heads/stable"]' + else + # Pull Request -> only use that branch + export TARGET="[\"${GITHUB_REF}\"]" fi echo "target=${TARGET}" | tee -a $GITHUB_OUTPUT build-ci: From 462175f500d22ebe2b658cc15fb306c5a4522898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 11 Aug 2023 14:40:06 +0200 Subject: [PATCH 9/9] ci action: directly test for event type --- .github/workflows/build_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index faa532456..49b0799e1 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -16,8 +16,8 @@ jobs: steps: - id: set-matrix run: | - echo "github.ref: ${GITHUB_REF}, name: ${GITHUB_REF_NAME}, base: ${GITHUB_BASE_REF}" - if [ "${GITHUB_REF}" = "refs/heads/master" ] || [ "${GITHUB_REF_NAME}" = "master" ]; then + echo "github.ref: ${GITHUB_REF}, name: ${GITHUB_REF_NAME}, event: ${GITHUB_EVENT_NAME}" + if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then # scheduled build -> use master & stable branch export TARGET='["refs/heads/master","refs/heads/stable"]' else