From fb5d3b1d3b1b718cf68998637d0578bc3ba269ec Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:11:07 +0100 Subject: [PATCH 1/5] workflow: test:lint code --- .github/file-filters.yml | 4 ++++ .github/webhooks/test.lint.code.yml | 34 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/file-filters.yml create mode 100644 .github/webhooks/test.lint.code.yml diff --git a/.github/file-filters.yml b/.github/file-filters.yml new file mode 100644 index 0000000..4562c0b --- /dev/null +++ b/.github/file-filters.yml @@ -0,0 +1,4 @@ +# These file filter patterns are used by the action https://github.com/dorny/paths-filter + +frontend: &frontend + - '**/*' \ No newline at end of file diff --git a/.github/webhooks/test.lint.code.yml b/.github/webhooks/test.lint.code.yml new file mode 100644 index 0000000..62a871e --- /dev/null +++ b/.github/webhooks/test.lint.code.yml @@ -0,0 +1,34 @@ +name: "test:lint code with defined linters" + +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 + + lint: + if: needs.files-changed.outputs.frontend == 'true' + name: Lint - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Lint + run: npm install && npm run test:lint \ No newline at end of file From 6bcd7501c487db112aaecd834071064ebfd7ce19 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:13:53 +0100 Subject: [PATCH 2/5] fixed foldername for workflows --- .github/workflows/example.yml | 84 +++++++++++++++++++ .../test.lint.code.yml | 0 .../{webhooks => workflows}/test.lint.pr.yml | 0 3 files changed, 84 insertions(+) create mode 100644 .github/workflows/example.yml rename .github/{webhooks => workflows}/test.lint.code.yml (100%) rename .github/{webhooks => workflows}/test.lint.pr.yml (100%) diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml new file mode 100644 index 0000000..c0d6031 --- /dev/null +++ b/.github/workflows/example.yml @@ -0,0 +1,84 @@ +name: Gradido Frontend Test CI + +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 + + + build_test: + if: needs.files-changed.outputs.frontend == 'true' + name: Docker Build Test - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Build 'test' image + run: docker build --target test -t "gradido/frontend:test" frontend/ --build-arg NODE_ENV="test" + + unit_test: + if: needs.files-changed.outputs.frontend == 'true' + name: Unit Tests - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Unit tests + run: cd frontend && yarn global add node-gyp && yarn && yarn run test + + lint: + if: needs.files-changed.outputs.frontend == 'true' + name: Lint - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Lint + run: cd frontend && yarn global add node-gyp && yarn && yarn run lint + + stylelint: + if: needs.files-changed.outputs.frontend == 'true' + name: Stylelint - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Stylelint + run: cd frontend && yarn global add node-gyp && yarn && yarn run stylelint + + locales: + if: needs.files-changed.outputs.frontend == 'true' + name: Locales - Frontend + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Frontend | Locales + run: cd frontend && yarn global add node-gyp && yarn && yarn run locales \ No newline at end of file diff --git a/.github/webhooks/test.lint.code.yml b/.github/workflows/test.lint.code.yml similarity index 100% rename from .github/webhooks/test.lint.code.yml rename to .github/workflows/test.lint.code.yml diff --git a/.github/webhooks/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml similarity index 100% rename from .github/webhooks/test.lint.pr.yml rename to .github/workflows/test.lint.pr.yml From 6db6286cc4390303287bd4914abc44a1a9c22c02 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:15:11 +0100 Subject: [PATCH 3/5] removed example --- .github/workflows/example.yml | 84 ----------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 .github/workflows/example.yml diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml deleted file mode 100644 index c0d6031..0000000 --- a/.github/workflows/example.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Gradido Frontend Test CI - -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 - - - build_test: - if: needs.files-changed.outputs.frontend == 'true' - name: Docker Build Test - Frontend - needs: files-changed - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Frontend | Build 'test' image - run: docker build --target test -t "gradido/frontend:test" frontend/ --build-arg NODE_ENV="test" - - unit_test: - if: needs.files-changed.outputs.frontend == 'true' - name: Unit Tests - Frontend - needs: files-changed - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Frontend | Unit tests - run: cd frontend && yarn global add node-gyp && yarn && yarn run test - - lint: - if: needs.files-changed.outputs.frontend == 'true' - name: Lint - Frontend - needs: files-changed - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Frontend | Lint - run: cd frontend && yarn global add node-gyp && yarn && yarn run lint - - stylelint: - if: needs.files-changed.outputs.frontend == 'true' - name: Stylelint - Frontend - needs: files-changed - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Frontend | Stylelint - run: cd frontend && yarn global add node-gyp && yarn && yarn run stylelint - - locales: - if: needs.files-changed.outputs.frontend == 'true' - name: Locales - Frontend - needs: files-changed - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Frontend | Locales - run: cd frontend && yarn global add node-gyp && yarn && yarn run locales \ No newline at end of file From cb0e93ddacc64a4f9704eef33fcfbce85b3a42d1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:19:39 +0100 Subject: [PATCH 4/5] add permissions --- .github/workflows/test.lint.pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.lint.pr.yml b/.github/workflows/test.lint.pr.yml index 35ccc33..3e6cad4 100644 --- a/.github/workflows/test.lint.pr.yml +++ b/.github/workflows/test.lint.pr.yml @@ -7,6 +7,9 @@ on: - edited - synchronize +permissions: + pull-requests: write + jobs: main: name: Validate PR title From f051e110a88809e1fde2d6fec0f93a48423d5102 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Nov 2023 15:25:30 +0100 Subject: [PATCH 5/5] ignore .github folder in remark linting --- .github/.remarkignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/.remarkignore diff --git a/.github/.remarkignore b/.github/.remarkignore new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/.github/.remarkignore @@ -0,0 +1 @@ +* \ No newline at end of file