From 55b6ccf0cbf2e637acff226f72023ecf8a8bd1e1 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 10:22:49 +0100 Subject: [PATCH 01/31] Added github actions periodic build --- .github/workflows/periodic-build.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/periodic-build.yml diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml new file mode 100644 index 0000000000..bf2e2f9e46 --- /dev/null +++ b/.github/workflows/periodic-build.yml @@ -0,0 +1,39 @@ +name: release +on: + schedule: + - cron: 0 0 * * * +concurrency: + group: release-main +jobs: + publish: + runs-on: ubuntu-latest + outputs: + published: ${{ steps.changesets.outputs.published }} + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + cache: yarn + node-version: 20 + registry-url: 'https://registry.npmjs.org' + scope: '@graphcommerce' + - name: yarn && yarn build + run: | + cd examples/magento-graphcms + yarn && yarn codegen && yarn dev + notify-end: + if: always() + name: Notify release end + needs: [notify-start, activate-pm2] + uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main + secrets: + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} + with: + time: ${{ needs.notify-start.outputs.time }} + result: ${{ needs.activate-pm2.result }} + channel: graphcommerce + message: Periodic build + notifyOnlyOnFailure: true \ No newline at end of file From d1c884e3de518b411d398dffa4472d71086d7d4a Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 10:29:06 +0100 Subject: [PATCH 02/31] Changed yarn dev to yarn build --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index bf2e2f9e46..6f7a5365fc 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -23,7 +23,7 @@ jobs: - name: yarn && yarn build run: | cd examples/magento-graphcms - yarn && yarn codegen && yarn dev + yarn && yarn codegen && yarn build notify-end: if: always() name: Notify release end From 2f1dc578b4a16e6eb029b1d8fc9124e6cee612c5 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 10:31:05 +0100 Subject: [PATCH 03/31] Changed name --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 6f7a5365fc..98f35effd0 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -1,4 +1,4 @@ -name: release +name: Periodic build on: schedule: - cron: 0 0 * * * From 7feb2aa72ebed809c23f2145b4395e5f48703f32 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 10:50:57 +0100 Subject: [PATCH 04/31] Added env --- .github/workflows/periodic-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 98f35effd0..4a1aaf30ba 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -24,6 +24,10 @@ jobs: run: | cd examples/magento-graphcms yarn && yarn codegen && yarn build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} notify-end: if: always() name: Notify release end From 99abaaec00865ffe9ef9f08cd950fc275b376b54 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 11:02:07 +0100 Subject: [PATCH 05/31] Make yarn and build run from copy of examples folder --- .github/workflows/periodic-build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 4a1aaf30ba..c42b57d628 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -20,9 +20,13 @@ jobs: node-version: 20 registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' + - name: create graphcommerce folder + run: | + git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir graphcommerce-build + - name: copy gc main to new folder + run: cp -R graphcommerce/examples/magento-graphcms/. graphcommerce-build && rm -rf graphcommerce && cd graphcommerce-build - name: yarn && yarn build run: | - cd examples/magento-graphcms yarn && yarn codegen && yarn build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 692854d3f815276e49c0ed2ed7777cd39aa1d8f5 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 11:36:13 +0100 Subject: [PATCH 06/31] Put new graphcommerce -build in tmp folder --- .github/workflows/periodic-build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index c42b57d628..d60bb2d8cf 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -22,9 +22,10 @@ jobs: scope: '@graphcommerce' - name: create graphcommerce folder run: | - git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir graphcommerce-build + cd ${{ runner.temp }} + git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - name: copy gc main to new folder - run: cp -R graphcommerce/examples/magento-graphcms/. graphcommerce-build && rm -rf graphcommerce && cd graphcommerce-build + run: cp -R graphcommerce/examples/magento-graphcms/. tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build - name: yarn && yarn build run: | yarn && yarn codegen && yarn build From b175ce6443ef9fc19c30b5b012f9f88a20dcb2db Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 11:36:39 +0100 Subject: [PATCH 07/31] Removed runner.path --- .github/workflows/periodic-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index d60bb2d8cf..c6b7e65944 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -22,7 +22,6 @@ jobs: scope: '@graphcommerce' - name: create graphcommerce folder run: | - cd ${{ runner.temp }} git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - name: copy gc main to new folder run: cp -R graphcommerce/examples/magento-graphcms/. tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build From aafd44944425c3c25f23d44360ec4f440b39460e Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 11:54:04 +0100 Subject: [PATCH 08/31] Fixed invalid notification end --- .github/workflows/periodic-build.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index c6b7e65944..b71c186966 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -5,6 +5,15 @@ on: concurrency: group: release-main jobs: + notify-start: + name: Notify release start + uses: ho-nl/release-slack-action/.github/workflows/notify-slack-start.yml@main + secrets: + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} + with: + channel: graphcommerce + message: Graphcommerce start building + notifyOnlyOnFailure: true publish: runs-on: ubuntu-latest outputs: @@ -35,13 +44,13 @@ jobs: notify-end: if: always() name: Notify release end - needs: [notify-start, activate-pm2] + needs: [notify-start, publish] uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main secrets: slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} with: time: ${{ needs.notify-start.outputs.time }} - result: ${{ needs.activate-pm2.result }} + result: ${{ needs.publish.result }} channel: graphcommerce message: Periodic build notifyOnlyOnFailure: true \ No newline at end of file From 672ea6b4189e82b2d7ff3cd5de675ea023a939b9 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 11:57:36 +0100 Subject: [PATCH 09/31] Changed channel for testing --- .github/workflows/periodic-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index b71c186966..411db4b28a 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -11,7 +11,7 @@ jobs: secrets: slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} with: - channel: graphcommerce + channel: slack-test-messages message: Graphcommerce start building notifyOnlyOnFailure: true publish: @@ -51,6 +51,6 @@ jobs: with: time: ${{ needs.notify-start.outputs.time }} result: ${{ needs.publish.result }} - channel: graphcommerce + channel: slack-test-messages message: Periodic build notifyOnlyOnFailure: true \ No newline at end of file From 248dc94d0ebdb36ab6ed3ed210467ee51cd6a470 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 13:36:10 +0100 Subject: [PATCH 10/31] Added statement to start building on test branche --- .github/workflows/periodic-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 411db4b28a..f9f1751b16 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -2,6 +2,9 @@ name: Periodic build on: schedule: - cron: 0 0 * * * + push: + branches: + - 'feature/periodic-release' concurrency: group: release-main jobs: From dc67fd211729e25422e9e0d19b63d785a23a1059 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 13:47:21 +0100 Subject: [PATCH 11/31] Copy current branche examples folder to create new tmp/folder --- .github/workflows/periodic-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index f9f1751b16..59e267b03f 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -33,10 +33,9 @@ jobs: registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - name: create graphcommerce folder - run: | - git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build + run: mkdir -p /tmp/graphcommerce-build - name: copy gc main to new folder - run: cp -R graphcommerce/examples/magento-graphcms/. tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build + run: cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build - name: yarn && yarn build run: | yarn && yarn codegen && yarn build From e8d05148b9156396102fa8bfd8015d249216f094 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 13:52:18 +0100 Subject: [PATCH 12/31] Readded the git clone --- .github/workflows/periodic-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 59e267b03f..0ff7678739 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -33,7 +33,8 @@ jobs: registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - name: create graphcommerce folder - run: mkdir -p /tmp/graphcommerce-build + run: | + git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - name: copy gc main to new folder run: cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build - name: yarn && yarn build From 963d1bd376cec5475e273a1981a1fc755dd4fa4a Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 13:58:43 +0100 Subject: [PATCH 13/31] Cd into right folder before doing yarn commands --- .github/workflows/periodic-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 0ff7678739..e4b80535c8 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -36,10 +36,10 @@ jobs: run: | git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - name: copy gc main to new folder - run: cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce && cd /tmp/graphcommerce-build + run: cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce - name: yarn && yarn build run: | - yarn && yarn codegen && yarn build + cd /tmp/graphcommerce-build && yarn && yarn codegen && yarn build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 39e5fc7a36b0788be2d82c3bab56baa55d4eebb0 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 14:10:14 +0100 Subject: [PATCH 14/31] Switched setup node to V3 --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index e4b80535c8..aa144f2f28 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v3 with: cache: yarn node-version: 20 From c254c5741aa91be81896952ff7fa3c1cb9b2a5b7 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 15:01:28 +0100 Subject: [PATCH 15/31] Removed yarn from actions setup-node --- .github/workflows/periodic-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index aa144f2f28..0d51da05cf 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -28,7 +28,6 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - cache: yarn node-version: 20 registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' From 6d191e7f4323afb97e138de7dda3e3686d79da64 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 15:08:17 +0100 Subject: [PATCH 16/31] Added yarn install && yarn postinstall --- .github/workflows/periodic-build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 0d51da05cf..d8d5f59924 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -28,9 +28,12 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: 20 + cache: yarn + node-version: 18 registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' + - name: yarn install && yarn postinstall + run: yarn install && yarn postinstall - name: create graphcommerce folder run: | git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build From 5d7d3b89caf8c0681085a6ffca44c99e42863ae8 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 15:13:02 +0100 Subject: [PATCH 17/31] Readded node 20 --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index d8d5f59924..c7ac198582 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-node@v3 with: cache: yarn - node-version: 18 + node-version: 20 registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - name: yarn install && yarn postinstall From 8f4ade2041d3572d9a0a611c04520379e233ded6 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 15:49:25 +0100 Subject: [PATCH 18/31] Added matrix to try building with different versions of node --- .github/workflows/periodic-build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index c7ac198582..0aa971b5ed 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -18,6 +18,9 @@ jobs: message: Graphcommerce start building notifyOnlyOnFailure: true publish: + strategy: + matrix: + version: [18, 20, 22] runs-on: ubuntu-latest outputs: published: ${{ steps.changesets.outputs.published }} @@ -29,7 +32,7 @@ jobs: - uses: actions/setup-node@v3 with: cache: yarn - node-version: 20 + node-version: ${{ matrix.version }} registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - name: yarn install && yarn postinstall From c1d0528b5088782b31c491fba0da999e2ee4f5ab Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 16:02:30 +0100 Subject: [PATCH 19/31] Added continue on error so all the node version will be tried --- .github/workflows/periodic-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 0aa971b5ed..f73ede4946 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -18,6 +18,7 @@ jobs: message: Graphcommerce start building notifyOnlyOnFailure: true publish: + continue-on-error: true strategy: matrix: version: [18, 20, 22] From 93e84be3f9430d48d5b2c0dcd15ba4fb6fa81744 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 16:18:15 +0100 Subject: [PATCH 20/31] Notify slack when one of the jobs fails --- .github/workflows/periodic-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index f73ede4946..708eea9800 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -51,7 +51,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} notify-end: - if: always() + if: ${{ needs.publish.result == 'failure' }} name: Notify release end needs: [notify-start, publish] uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main @@ -62,4 +62,4 @@ jobs: result: ${{ needs.publish.result }} channel: slack-test-messages message: Periodic build - notifyOnlyOnFailure: true \ No newline at end of file + notifyOnlyOnFailure: false \ No newline at end of file From 51597eed3e1d57c63904385de80de38d6cd3cf87 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 16:32:37 +0100 Subject: [PATCH 21/31] Added failure flag to make sure the build fails if any of the matrix jobs fails --- .github/workflows/periodic-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 708eea9800..c2fba130c9 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -50,6 +50,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Set failure flag + if: failure() + run: echo "failed=true" >> $GITHUB_ENV notify-end: if: ${{ needs.publish.result == 'failure' }} name: Notify release end From 0b63bc2585252ffa37211f605c750ce7700f6813 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 16:33:17 +0100 Subject: [PATCH 22/31] Added failure flag to make sure the build fails if any of the matrix jobs fails --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index c2fba130c9..0f1846641d 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -54,7 +54,7 @@ jobs: if: failure() run: echo "failed=true" >> $GITHUB_ENV notify-end: - if: ${{ needs.publish.result == 'failure' }} + if: ${{ env.failed == 'true' }} name: Notify release end needs: [notify-start, publish] uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main From 9cf746a6574df3988caf8fbf72454453afd89fae Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 16:46:40 +0100 Subject: [PATCH 23/31] Added failure flag to make sure the build fails if any of the matrix jobs fails --- .github/workflows/periodic-build.yml | 54 +++++++++++++++++----------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 0f1846641d..aa8c043ded 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -12,57 +12,71 @@ jobs: name: Notify release start uses: ho-nl/release-slack-action/.github/workflows/notify-slack-start.yml@main secrets: - slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} with: channel: slack-test-messages message: Graphcommerce start building notifyOnlyOnFailure: true + publish: - continue-on-error: true strategy: matrix: version: [18, 20, 22] runs-on: ubuntu-latest + continue-on-error: true outputs: - published: ${{ steps.changesets.outputs.published }} + publish_failed: ${{ steps.set-failure-flag.outputs.publish_failed }} steps: - - name: checkout + - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 with: - cache: yarn node-version: ${{ matrix.version }} + cache: yarn registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - - name: yarn install && yarn postinstall + + - name: Install dependencies run: yarn install && yarn postinstall - - name: create graphcommerce folder - run: | - git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - - name: copy gc main to new folder - run: cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce - - name: yarn && yarn build + + - name: Prepare and build graphcommerce run: | + git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build + cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce cd /tmp/graphcommerce-build && yarn && yarn codegen && yarn build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # Set a failure flag if this specific matrix job fails - name: Set failure flag + id: set-failure-flag + run: echo "publish_failed=true" >> $GITHUB_ENV if: failure() - run: echo "failed=true" >> $GITHUB_ENV + + # Aggregate the result into a job output + - name: Aggregate failure status + id: set-failure-flag + run: | + echo "::set-output name=publish_failed::${{ env.publish_failed }}" + if: ${{ env.publish_failed == 'true' }} + + # notify-end will run only if any publish job failed notify-end: - if: ${{ env.failed == 'true' }} - name: Notify release end + if: needs.publish.outputs.publish_failed == 'true' needs: [notify-start, publish] + name: Notify release end uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main secrets: - slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}} + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} with: time: ${{ needs.notify-start.outputs.time }} - result: ${{ needs.publish.result }} + result: "failure" channel: slack-test-messages - message: Periodic build - notifyOnlyOnFailure: false \ No newline at end of file + message: "One or more Node.js versions failed in the periodic build" + notifyOnlyOnFailure: true \ No newline at end of file From 12a3ac5e1f15dac1e378db8af03db9cbdaf0dc21 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Thu, 7 Nov 2024 17:09:59 +0100 Subject: [PATCH 24/31] Check whats in needs.publish --- .github/workflows/periodic-build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index aa8c043ded..696bb8d8c3 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -65,7 +65,13 @@ jobs: run: | echo "::set-output name=publish_failed::${{ env.publish_failed }}" if: ${{ env.publish_failed == 'true' }} - + nieuwe-job: + needs: [publish] + runs-on: ubuntu-latest + steps: + - name: test a new job + uses: actions/checkout@v4 + - run: echo "${{toJSON(needs.publish)}}" # notify-end will run only if any publish job failed notify-end: if: needs.publish.outputs.publish_failed == 'true' From a161946d33a307810b7e5419e274912d704acf4f Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 09:59:05 +0100 Subject: [PATCH 25/31] Try using artifacts to set data for a matrix job --- .github/workflows/periodic-build.yml | 70 ++++++++++++++++------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 696bb8d8c3..477db6469f 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -23,9 +23,7 @@ jobs: matrix: version: [18, 20, 22] runs-on: ubuntu-latest - continue-on-error: true - outputs: - publish_failed: ${{ steps.set-failure-flag.outputs.publish_failed }} + continue-on-error: true # Continue other jobs even if one fails steps: - name: Checkout uses: actions/checkout@v4 @@ -53,36 +51,46 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # Set a failure flag if this specific matrix job fails - - name: Set failure flag - id: set-failure-flag - run: echo "publish_failed=true" >> $GITHUB_ENV + # Upload success or failure artifact based on the outcome + - name: Upload success artifact + if: success() + uses: actions/upload-artifact@v3 + with: + name: success-${{ matrix.version }} + path: /tmp/graphcommerce-build + + - name: Upload failure artifact if: failure() + uses: actions/upload-artifact@v3 + with: + name: failure-${{ matrix.version }} + path: /tmp/graphcommerce-build - # Aggregate the result into a job output - - name: Aggregate failure status - id: set-failure-flag - run: | - echo "::set-output name=publish_failed::${{ env.publish_failed }}" - if: ${{ env.publish_failed == 'true' }} - nieuwe-job: - needs: [publish] - runs-on: ubuntu-latest - steps: - - name: test a new job - uses: actions/checkout@v4 - - run: echo "${{toJSON(needs.publish)}}" - # notify-end will run only if any publish job failed notify-end: - if: needs.publish.outputs.publish_failed == 'true' needs: [notify-start, publish] + runs-on: ubuntu-latest name: Notify release end - uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main - secrets: - slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} - with: - time: ${{ needs.notify-start.outputs.time }} - result: "failure" - channel: slack-test-messages - message: "One or more Node.js versions failed in the periodic build" - notifyOnlyOnFailure: true \ No newline at end of file + steps: + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Check for any failure artifacts + id: check-failure + run: | + if ls artifacts/failure-* 1> /dev/null 2>&1; then + echo "failure_detected=true" >> $GITHUB_ENV + else + echo "failure_detected=false" >> $GITHUB_ENV + fi + + - name: Notify if any failures + if: env.failure_detected == 'true' + uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main + secrets: + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} + with: + channel: slack-test-messages + message: "One or more Node.js versions failed in the periodic build" + notifyOnlyOnFailure: true \ No newline at end of file From 5bf616716a6b7bb9c2c6b50693cfecd2076c71ab Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 10:45:24 +0100 Subject: [PATCH 26/31] Implemented pr feedback --- .github/workflows/periodic-build.yml | 69 ++++++++-------------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 477db6469f..0bcd192e8d 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -21,14 +21,16 @@ jobs: publish: strategy: matrix: - version: [18, 20, 22] + version: [18, 20] runs-on: ubuntu-latest - continue-on-error: true # Continue other jobs even if one fails + outputs: + publish_failed: ${{ steps.set-failure-flag.outputs.publish_failed }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 + path: graphcommerce - name: Set up Node.js uses: actions/setup-node@v3 @@ -38,59 +40,28 @@ jobs: registry-url: 'https://registry.npmjs.org' scope: '@graphcommerce' - - name: Install dependencies - run: yarn install && yarn postinstall - - name: Prepare and build graphcommerce run: | - git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git && mkdir -p /tmp/graphcommerce-build - cp -R graphcommerce/examples/magento-graphcms/. /tmp/graphcommerce-build && rm -rf graphcommerce - cd /tmp/graphcommerce-build && yarn && yarn codegen && yarn build + cp -R graphcommerce/examples/magento-graphcms/. graphcommerce-build + cd graphcommerce-build + yarn + yarn codegen + yarn build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - # Upload success or failure artifact based on the outcome - - name: Upload success artifact - if: success() - uses: actions/upload-artifact@v3 - with: - name: success-${{ matrix.version }} - path: /tmp/graphcommerce-build - - - name: Upload failure artifact - if: failure() - uses: actions/upload-artifact@v3 - with: - name: failure-${{ matrix.version }} - path: /tmp/graphcommerce-build - + # notify-end will run only if any publish job failed notify-end: + if: always() needs: [notify-start, publish] - runs-on: ubuntu-latest name: Notify release end - steps: - - name: Download all artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - - name: Check for any failure artifacts - id: check-failure - run: | - if ls artifacts/failure-* 1> /dev/null 2>&1; then - echo "failure_detected=true" >> $GITHUB_ENV - else - echo "failure_detected=false" >> $GITHUB_ENV - fi - - - name: Notify if any failures - if: env.failure_detected == 'true' - uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main - secrets: - slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} - with: - channel: slack-test-messages - message: "One or more Node.js versions failed in the periodic build" - notifyOnlyOnFailure: true \ No newline at end of file + uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main + secrets: + slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} + with: + time: ${{ needs.notify-start.outputs.time }} + result: ${{ needs.publish.result }} + channel: slack-test-messages + message: "One or more Node.js versions failed in the periodic build" + notifyOnlyOnFailure: true \ No newline at end of file From dcdc475333cb605fbef6b228d2ca166f115bfcbc Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 10:49:29 +0100 Subject: [PATCH 27/31] Removed incorrect output --- .github/workflows/periodic-build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 0bcd192e8d..6d539df59f 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -23,8 +23,6 @@ jobs: matrix: version: [18, 20] runs-on: ubuntu-latest - outputs: - publish_failed: ${{ steps.set-failure-flag.outputs.publish_failed }} steps: - name: Checkout uses: actions/checkout@v4 From 7405973e761032bbd66d2338c4895b73a23e2f8c Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 10:53:36 +0100 Subject: [PATCH 28/31] Adjusted scope --- .github/workflows/periodic-build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 6d539df59f..91ab635f05 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -34,9 +34,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.version }} - cache: yarn registry-url: 'https://registry.npmjs.org' - scope: '@graphcommerce' + scope: 'graphcommerce' - name: Prepare and build graphcommerce run: | From b87a7cdbdace0bcf7574d33d74b73991079cf9d2 Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 11:02:37 +0100 Subject: [PATCH 29/31] Set periodic-build.yml to canary pushes --- .github/workflows/periodic-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 91ab635f05..98bacf03d1 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -4,7 +4,7 @@ on: - cron: 0 0 * * * push: branches: - - 'feature/periodic-release' + - 'canary' concurrency: group: release-main jobs: From 962fac0e3ac812b6045dba02cc77c2bf046d599c Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 12:04:43 +0100 Subject: [PATCH 30/31] Changed message channel to GC --- .github/workflows/periodic-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index 98bacf03d1..ae26157bcf 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -14,7 +14,7 @@ jobs: secrets: slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} with: - channel: slack-test-messages + channel: graphcommerce message: Graphcommerce start building notifyOnlyOnFailure: true @@ -59,6 +59,6 @@ jobs: with: time: ${{ needs.notify-start.outputs.time }} result: ${{ needs.publish.result }} - channel: slack-test-messages + channel: graphcommerce message: "One or more Node.js versions failed in the periodic build" notifyOnlyOnFailure: true \ No newline at end of file From a3818d8df26401bc870f7c997a10b852709aa84f Mon Sep 17 00:00:00 2001 From: Renzo van Hootegem Date: Fri, 8 Nov 2024 12:06:56 +0100 Subject: [PATCH 31/31] Changed message channel to GC-build --- .github/workflows/periodic-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/periodic-build.yml b/.github/workflows/periodic-build.yml index ae26157bcf..9e3c567b2c 100644 --- a/.github/workflows/periodic-build.yml +++ b/.github/workflows/periodic-build.yml @@ -14,7 +14,7 @@ jobs: secrets: slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }} with: - channel: graphcommerce + channel: graphcommerce-build message: Graphcommerce start building notifyOnlyOnFailure: true @@ -59,6 +59,6 @@ jobs: with: time: ${{ needs.notify-start.outputs.time }} result: ${{ needs.publish.result }} - channel: graphcommerce + channel: graphcommerce-build message: "One or more Node.js versions failed in the periodic build" notifyOnlyOnFailure: true \ No newline at end of file