From a244a18ae8f87215cae04d7fbd713c3ddc35bb19 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 10:57:12 +0100 Subject: [PATCH 1/6] Added matrix-concurrency workflow --- .github/workflows/matrix-concurrency.yml | 20 ++++++++++++++++++++ .github/workflows/pwsh-switch-parameter.yml | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/matrix-concurrency.yml diff --git a/.github/workflows/matrix-concurrency.yml b/.github/workflows/matrix-concurrency.yml new file mode 100644 index 0000000..a2b6bd1 --- /dev/null +++ b/.github/workflows/matrix-concurrency.yml @@ -0,0 +1,20 @@ +name: MatrixConcurrency + +on: + pull_request: + workflow_dispatch: + +jobs: + test: + name: Matrix Concurrency + runs-on: ubuntu-latest + strategy: + matrix: + environment: [qa,staging,production,sandbox] + max-parallel: 1 + steps: + - name: Do some stuff in ${{ matrix.environment }} + run: | + echo "Do some stuff $(date +%T)" + sleep 30 + echo "Done some stuff $(date +%T)" diff --git a/.github/workflows/pwsh-switch-parameter.yml b/.github/workflows/pwsh-switch-parameter.yml index d9c2e8d..9069413 100644 --- a/.github/workflows/pwsh-switch-parameter.yml +++ b/.github/workflows/pwsh-switch-parameter.yml @@ -1,7 +1,6 @@ name: PowerShellSwitchParameter on: - pull_request: workflow_dispatch: jobs: From b243322beca9bb6a874fbbf1c50d167ffc96962b Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 11:02:52 +0100 Subject: [PATCH 2/6] Added workflow concurrency --- .github/workflows/matrix-concurrency.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/matrix-concurrency.yml b/.github/workflows/matrix-concurrency.yml index a2b6bd1..c09eaf0 100644 --- a/.github/workflows/matrix-concurrency.yml +++ b/.github/workflows/matrix-concurrency.yml @@ -1,11 +1,11 @@ name: MatrixConcurrency - +concurrency: matrix_concurrency_${{ github.ref_name }} on: pull_request: workflow_dispatch: jobs: - test: + matrix-job: name: Matrix Concurrency runs-on: ubuntu-latest strategy: From c1743b965d49f93cf18ca28d38c519103d3a1ea0 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 11:20:07 +0100 Subject: [PATCH 3/6] Added a job with it's own concurrency and another workflow to call it --- .../workflows/matrix-concurrency-external.yml | 16 ++++++++++++++++ .github/workflows/matrix-concurrency.yml | 12 ++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/matrix-concurrency-external.yml diff --git a/.github/workflows/matrix-concurrency-external.yml b/.github/workflows/matrix-concurrency-external.yml new file mode 100644 index 0000000..9bb3354 --- /dev/null +++ b/.github/workflows/matrix-concurrency-external.yml @@ -0,0 +1,16 @@ +name: MatrixConcurrencyExternal + +on: + workflow_dispatch: + +jobs: + pre-matrix-job: + name: Pre Matrix + concurrency: matrix_concurrency_external_${{ github.event.pull_request.number }} + runs-on: ubuntu-latest + steps: + - name: Do some stuff outside the matrix + run: | + echo "Do some stuff $(date +%T)" + sleep 30 + echo "Done some stuff $(date +%T)" diff --git a/.github/workflows/matrix-concurrency.yml b/.github/workflows/matrix-concurrency.yml index c09eaf0..cc0fafa 100644 --- a/.github/workflows/matrix-concurrency.yml +++ b/.github/workflows/matrix-concurrency.yml @@ -1,10 +1,22 @@ name: MatrixConcurrency concurrency: matrix_concurrency_${{ github.ref_name }} + on: pull_request: workflow_dispatch: jobs: + pre-matrix-job: + name: Pre Matrix + concurrency: matrix_concurrency_external_${{ github.event.pull_request.number }} + runs-on: ubuntu-latest + steps: + - name: Do some stuff in outside the matrix + run: | + echo "Do some stuff $(date +%T)" + sleep 30 + echo "Done some stuff $(date +%T)" + matrix-job: name: Matrix Concurrency runs-on: ubuntu-latest From 25622b4bd2253394df7250f2e72951c262777e40 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 11:22:16 +0100 Subject: [PATCH 4/6] Added pull request trigger to external workflow --- .github/workflows/matrix-concurrency-external.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/matrix-concurrency-external.yml b/.github/workflows/matrix-concurrency-external.yml index 9bb3354..49069c5 100644 --- a/.github/workflows/matrix-concurrency-external.yml +++ b/.github/workflows/matrix-concurrency-external.yml @@ -1,6 +1,7 @@ name: MatrixConcurrencyExternal on: + pull_request: workflow_dispatch: jobs: From c9a942dafc062827bdd1841227f8c691a8b2d95b Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 11:39:03 +0100 Subject: [PATCH 5/6] External workflow triggers on PR close --- .github/workflows/matrix-concurrency-external.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/matrix-concurrency-external.yml b/.github/workflows/matrix-concurrency-external.yml index 49069c5..f678b2e 100644 --- a/.github/workflows/matrix-concurrency-external.yml +++ b/.github/workflows/matrix-concurrency-external.yml @@ -2,6 +2,8 @@ name: MatrixConcurrencyExternal on: pull_request: + types: [closed] + branches: [main] workflow_dispatch: jobs: From e9048382230a86269c0b20284c6047b1a4a3197b Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Mon, 11 Apr 2022 11:39:48 +0100 Subject: [PATCH 6/6] Added a comment --- .github/workflows/matrix-concurrency-external.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/matrix-concurrency-external.yml b/.github/workflows/matrix-concurrency-external.yml index f678b2e..e357e6c 100644 --- a/.github/workflows/matrix-concurrency-external.yml +++ b/.github/workflows/matrix-concurrency-external.yml @@ -1,5 +1,5 @@ name: MatrixConcurrencyExternal - +##Some changes on: pull_request: types: [closed]