From 820a4059dabbbc6552a4a9cd11f41ea4b268f6c5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:35:32 +0100 Subject: [PATCH 1/6] unit test workflow --- .github/workflows/test.unit.code.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test.unit.code.yml diff --git a/.github/workflows/test.unit.code.yml b/.github/workflows/test.unit.code.yml new file mode 100644 index 0000000..a705148 --- /dev/null +++ b/.github/workflows/test.unit.code.yml @@ -0,0 +1,34 @@ +name: "test:unit test code with defined suites" + +on: push + +jobs: + # only (but most important) job from this workflow required for pull requests + # check results serve as run conditions for all other jobs here + files-changed: + name: Detect File Changes - Frontend + runs-on: ubuntu-latest + outputs: + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + + unit: + if: needs.files-changed.outputs.frontend == 'true' + name: Unit - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Unit + run: npm install && npm run test:unit \ No newline at end of file From 74248abb3d7435d192e06b3ea4a495650888d7e0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:43:32 +0100 Subject: [PATCH 2/6] per workflow file selector --- .github/file-filters.yml | 5 ++++- .github/workflows/test.lint.code.yml | 6 +++--- .github/workflows/test.unit.code.yml | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 4562c0b..6f42ab4 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -1,4 +1,7 @@ # These file filter patterns are used by the action https://github.com/dorny/paths-filter -frontend: &frontend +frontend-test-lint-code: &frontend-test-lint-code + - '**/*' + +frontend-test-unit-code: &frontend-test-unit-code - '**/*' \ No newline at end of file diff --git a/.github/workflows/test.lint.code.yml b/.github/workflows/test.lint.code.yml index 62a871e..d2ebdd7 100644 --- a/.github/workflows/test.lint.code.yml +++ b/.github/workflows/test.lint.code.yml @@ -6,10 +6,10 @@ jobs: # only (but most important) job from this workflow required for pull requests # check results serve as run conditions for all other jobs here files-changed: - name: Detect File Changes - Frontend + name: Detect File Changes - frontend-test-lint-code runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.frontend }} + frontend: ${{ steps.changes.outputs.frontend-test-lint-code }} steps: - uses: actions/checkout@v3.3.0 @@ -22,7 +22,7 @@ jobs: list-files: shell lint: - if: needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.frontend-test-lint-code == 'true' name: Lint - Frontend needs: files-changed runs-on: ubuntu-latest diff --git a/.github/workflows/test.unit.code.yml b/.github/workflows/test.unit.code.yml index a705148..5ed58da 100644 --- a/.github/workflows/test.unit.code.yml +++ b/.github/workflows/test.unit.code.yml @@ -6,10 +6,10 @@ jobs: # only (but most important) job from this workflow required for pull requests # check results serve as run conditions for all other jobs here files-changed: - name: Detect File Changes - Frontend + name: Detect File Changes - frontend-test-unit-code runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.frontend }} + frontend: ${{ steps.changes.outputs.frontend-test-unit-code }} steps: - uses: actions/checkout@v3.3.0 @@ -22,7 +22,7 @@ jobs: list-files: shell unit: - if: needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.frontend-test-unit-code == 'true' name: Unit - Frontend needs: files-changed runs-on: ubuntu-latest From 6d72b8e680e55662daf2484cc54355cd8231cf7d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:43:52 +0100 Subject: [PATCH 3/6] test env token for lint pr workflow --- .github/workflows/test.lint.pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml index 3e6cad4..0b2015e 100644 --- a/.github/workflows/test.lint.pr.yml +++ b/.github/workflows/test.lint.pr.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: amannn/action-semantic-pull-request@v5 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} with: # Configure which types are allowed (newline delimited). # Default: https://github.com/commitizen/conventional-commit-types From c9633927c2a758bc3ca191de20deea0393952557 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:53:13 +0100 Subject: [PATCH 4/6] fix file detection outputs, revert changes of pr lint secret --- .github/workflows/test.lint.code.yml | 2 +- .github/workflows/test.lint.pr.yml | 2 +- .github/workflows/test.unit.code.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.lint.code.yml b/.github/workflows/test.lint.code.yml index d2ebdd7..dc728b7 100644 --- a/.github/workflows/test.lint.code.yml +++ b/.github/workflows/test.lint.code.yml @@ -9,7 +9,7 @@ jobs: name: Detect File Changes - frontend-test-lint-code runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.frontend-test-lint-code }} + frontend-test-lint-code: ${{ steps.changes.outputs.frontend-test-lint-code }} steps: - uses: actions/checkout@v3.3.0 diff --git a/.github/workflows/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml index 0b2015e..3e6cad4 100644 --- a/.github/workflows/test.lint.pr.yml +++ b/.github/workflows/test.lint.pr.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: amannn/action-semantic-pull-request@v5 env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: # Configure which types are allowed (newline delimited). # Default: https://github.com/commitizen/conventional-commit-types diff --git a/.github/workflows/test.unit.code.yml b/.github/workflows/test.unit.code.yml index 5ed58da..47eab92 100644 --- a/.github/workflows/test.unit.code.yml +++ b/.github/workflows/test.unit.code.yml @@ -9,7 +9,7 @@ jobs: name: Detect File Changes - frontend-test-unit-code runs-on: ubuntu-latest outputs: - frontend: ${{ steps.changes.outputs.frontend-test-unit-code }} + frontend-test-unit-code: ${{ steps.changes.outputs.frontend-test-unit-code }} steps: - uses: actions/checkout@v3.3.0 From ebe2e58a2160c6e9e6177691b68e1cee4e379323 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 16:00:42 +0100 Subject: [PATCH 5/6] workflow: lint pr: run without wip and permissions --- .github/workflows/test.lint.pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml index 3e6cad4..48a60d0 100644 --- a/.github/workflows/test.lint.pr.yml +++ b/.github/workflows/test.lint.pr.yml @@ -7,8 +7,8 @@ on: - edited - synchronize -permissions: - pull-requests: write +#permissions: +# pull-requests: write jobs: main: @@ -71,4 +71,4 @@ jobs: # special "[WIP]" prefix to indicate this state. This will avoid the # validation of the PR title and the pull request checks remain pending. # Note that a second check will be reported if this is enabled. - wip: true \ No newline at end of file + #wip: true \ No newline at end of file From 2c5276fb76da4bdfb12030ad1b63cbc2657a4f4c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 16:05:55 +0100 Subject: [PATCH 6/6] revert change --- .github/workflows/test.lint.pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml index 48a60d0..3e6cad4 100644 --- a/.github/workflows/test.lint.pr.yml +++ b/.github/workflows/test.lint.pr.yml @@ -7,8 +7,8 @@ on: - edited - synchronize -#permissions: -# pull-requests: write +permissions: + pull-requests: write jobs: main: @@ -71,4 +71,4 @@ jobs: # special "[WIP]" prefix to indicate this state. This will avoid the # validation of the PR title and the pull request checks remain pending. # Note that a second check will be reported if this is enabled. - #wip: true \ No newline at end of file + wip: true \ No newline at end of file