From b53df6deddc2d80e40e100603050ef4be0729052 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 23 May 2023 17:38:48 +0800 Subject: [PATCH 1/8] Use file filters action instead of Github's files filter --- .github/file-filters.yml | 16 +++++++ .github/workflows/pull-compliance-docs.yml | 17 ++++++++ .../workflows/pull-compliance-docsignore.yml | 43 ------------------- .github/workflows/pull-compliance.yml | 32 ++++++++++++-- .../workflows/pull-db-tests-docsignore.yml | 38 ---------------- .github/workflows/pull-db-tests.yml | 31 +++++++++++-- .../pull-docker-dryrun-docsignore.yml | 13 ------ .github/workflows/pull-docker-dryrun.yml | 21 +++++++-- .../workflows/pull-e2e-tests-docsignore.yml | 13 ------ .github/workflows/pull-e2e-tests.yml | 21 +++++++-- 10 files changed, 126 insertions(+), 119 deletions(-) create mode 100644 .github/file-filters.yml delete mode 100644 .github/workflows/pull-compliance-docsignore.yml delete mode 100644 .github/workflows/pull-db-tests-docsignore.yml delete mode 100644 .github/workflows/pull-docker-dryrun-docsignore.yml delete mode 100644 .github/workflows/pull-e2e-tests-docsignore.yml diff --git a/.github/file-filters.yml b/.github/file-filters.yml new file mode 100644 index 0000000000000..9bb74b4a5af2c --- /dev/null +++ b/.github/file-filters.yml @@ -0,0 +1,16 @@ +# This is used by the action https://github.com/dorny/paths-filter (which we have forked to https://github.com/getsentry/paths-filter) + +docs: &docs + - "docs/**" + - "**/*.md" + +backend: &backend + - "**/*.go" + - "go.mod" + - "go.sum" + +frontend: &frontend + - "web_src/**" + - "package.json" + - "package-lock.json" + - "*.js" diff --git a/.github/workflows/pull-compliance-docs.yml b/.github/workflows/pull-compliance-docs.yml index 44db6d67af10f..6df8bb0b2c236 100644 --- a/.github/workflows/pull-compliance-docs.yml +++ b/.github/workflows/pull-compliance-docs.yml @@ -11,7 +11,24 @@ concurrency: cancel-in-progress: true jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + docs: ${{ steps.changes.outputs.docs }} + steps: + - uses: actions/checkout@v3 # v2 + - name: Check for backend file changes + uses: getsentry/paths-filter@v2 # v2 + id: changes + with: + filters: .github/file-filters.yml + compliance-docs: + if: needs.files-changed.outputs.docs == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/pull-compliance-docsignore.yml b/.github/workflows/pull-compliance-docsignore.yml deleted file mode 100644 index ea0619e122eb9..0000000000000 --- a/.github/workflows/pull-compliance-docsignore.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: compliance - -on: - pull_request: - paths: - - "docs/**" - - "*.md" - -jobs: - compliance-docs: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - lint-backend: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - lint-go-windows: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - lint-go-gogit: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - checks-backend: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - frontend: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - backend: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index ace2b15a9b5fd..694c829057773 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -2,16 +2,32 @@ name: compliance on: pull_request: - paths-ignore: - - "docs/**" - - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + docs: ${{ steps.changes.outputs.docs }} + backend: ${{ steps.changes.outputs.backend }} + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3 # v2 + - name: Check for backend file changes + uses: getsentry/paths-filter@v2 # v2 + id: changes + with: + filters: .github/file-filters.yml + lint-backend: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,6 +40,8 @@ jobs: env: TAGS: bindata sqlite sqlite_unlock_notify lint-go-windows: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -38,6 +56,8 @@ jobs: GOOS: windows GOARCH: amd64 lint-go-gogit: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -50,6 +70,8 @@ jobs: env: TAGS: bindata gogit sqlite sqlite_unlock_notify checks-backend: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -60,6 +82,8 @@ jobs: - run: make deps-backend deps-tools - run: make --always-make checks-backend # ensure the "go-licenses" make target runs frontend: + if: needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -70,6 +94,8 @@ jobs: - run: make lint-frontend - run: make checks-frontend backend: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/pull-db-tests-docsignore.yml b/.github/workflows/pull-db-tests-docsignore.yml deleted file mode 100644 index c04f763c3e933..0000000000000 --- a/.github/workflows/pull-db-tests-docsignore.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: db-tests - -on: - pull_request: - paths: - - "docs/**" - - "*.md" - -jobs: - test-pgsql: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - test-sqlite: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - test-unit: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - test-mysql5: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - test-mysql8: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" - - test-mssql: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index b3b02f15caf22..052b06e6e7852 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -2,16 +2,31 @@ name: db-tests on: pull_request: - paths-ignore: - - "docs/**" - - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + backend: ${{ steps.changes.outputs.backend }} + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3 # v2 + - name: Check for backend file changes + uses: getsentry/paths-filter@v2 # v2 + id: changes + with: + filters: .github/file-filters.yml + test-pgsql: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest services: pgsql: @@ -56,6 +71,8 @@ jobs: USE_REPO_TEST_DIR: 1 test-sqlite: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -75,6 +92,8 @@ jobs: USE_REPO_TEST_DIR: 1 test-unit: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed runs-on: ubuntu-latest services: mysql: @@ -138,6 +157,8 @@ jobs: GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} test-mysql5: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest services: mysql: @@ -180,6 +201,8 @@ jobs: TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" test-mysql8: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest services: mysql8: @@ -207,6 +230,8 @@ jobs: USE_REPO_TEST_DIR: 1 test-mssql: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest services: mssql: diff --git a/.github/workflows/pull-docker-dryrun-docsignore.yml b/.github/workflows/pull-docker-dryrun-docsignore.yml deleted file mode 100644 index 7c74efb34a9db..0000000000000 --- a/.github/workflows/pull-docker-dryrun-docsignore.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: docker-dryrun - -on: - pull_request: - paths: - - "docs/**" - - "*.md" - -jobs: - docker-dryrun: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml index c3cdefc7a7dcf..263d1d2e9b15b 100644 --- a/.github/workflows/pull-docker-dryrun.yml +++ b/.github/workflows/pull-docker-dryrun.yml @@ -2,16 +2,31 @@ name: docker-dryrun on: pull_request: - paths-ignore: - - "docs/**" - - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + backend: ${{ steps.changes.outputs.backend }} + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3 # v2 + - name: Check for backend file changes + uses: getsentry/paths-filter@v2 # v2 + id: changes + with: + filters: .github/file-filters.yml + docker-dryrun: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: docker/setup-buildx-action@v2 diff --git a/.github/workflows/pull-e2e-tests-docsignore.yml b/.github/workflows/pull-e2e-tests-docsignore.yml deleted file mode 100644 index e809af7216b18..0000000000000 --- a/.github/workflows/pull-e2e-tests-docsignore.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: e2e-tests - -on: - pull_request: - paths: - - "docs/**" - - "*.md" - -jobs: - test-e2e: - runs-on: ubuntu-latest - steps: - - run: echo "No build required" diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index 611a6b07417fe..ca5812ad3008a 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -2,16 +2,31 @@ name: e2e-tests on: pull_request: - paths-ignore: - - "docs/**" - - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + backend: ${{ steps.changes.outputs.backend }} + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3 # v2 + - name: Check for backend file changes + uses: getsentry/paths-filter@v2 # v2 + id: changes + with: + filters: .github/file-filters.yml + test-e2e: + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 7644f668665227c92efe81093b179c101c9e2d67 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 23 May 2023 17:53:50 +0800 Subject: [PATCH 2/8] Fix docs build --- .github/file-filters.yml | 2 +- .github/workflows/pull-compliance-docs.yml | 2 +- .github/workflows/pull-compliance.yml | 2 +- .github/workflows/pull-db-tests.yml | 2 +- .github/workflows/pull-docker-dryrun.yml | 2 +- .github/workflows/pull-e2e-tests.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 9bb74b4a5af2c..05cd06a8a9743 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -1,4 +1,4 @@ -# This is used by the action https://github.com/dorny/paths-filter (which we have forked to https://github.com/getsentry/paths-filter) +# This is used by the action https://github.com/dorny/paths-filter (which we have forked to https://github.com/dorny/paths-filter) docs: &docs - "docs/**" diff --git a/.github/workflows/pull-compliance-docs.yml b/.github/workflows/pull-compliance-docs.yml index 6df8bb0b2c236..3671e31447d72 100644 --- a/.github/workflows/pull-compliance-docs.yml +++ b/.github/workflows/pull-compliance-docs.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 # v2 - name: Check for backend file changes - uses: getsentry/paths-filter@v2 # v2 + uses: dorny/paths-filter@v2 # v2 id: changes with: filters: .github/file-filters.yml diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index 694c829057773..906f202495548 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v3 # v2 - name: Check for backend file changes - uses: getsentry/paths-filter@v2 # v2 + uses: dorny/paths-filter@v2 # v2 id: changes with: filters: .github/file-filters.yml diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index 052b06e6e7852..f71373ed2af32 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v3 # v2 - name: Check for backend file changes - uses: getsentry/paths-filter@v2 # v2 + uses: dorny/paths-filter@v2 # v2 id: changes with: filters: .github/file-filters.yml diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml index 263d1d2e9b15b..c34f6c781d2c9 100644 --- a/.github/workflows/pull-docker-dryrun.yml +++ b/.github/workflows/pull-docker-dryrun.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v3 # v2 - name: Check for backend file changes - uses: getsentry/paths-filter@v2 # v2 + uses: dorny/paths-filter@v2 # v2 id: changes with: filters: .github/file-filters.yml diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index ca5812ad3008a..a6b8f94e6fc6f 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v3 # v2 - name: Check for backend file changes - uses: getsentry/paths-filter@v2 # v2 + uses: dorny/paths-filter@v2 # v2 id: changes with: filters: .github/file-filters.yml From ee66be150f2e3e1ba41d4ebdd70c6138e0927254 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 23 May 2023 17:58:59 +0800 Subject: [PATCH 3/8] Remove unnecessary check --- .github/workflows/pull-compliance-docs.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pull-compliance-docs.yml b/.github/workflows/pull-compliance-docs.yml index 3671e31447d72..a84f93f4033e6 100644 --- a/.github/workflows/pull-compliance-docs.yml +++ b/.github/workflows/pull-compliance-docs.yml @@ -2,9 +2,6 @@ name: compliance-docs on: pull_request: - paths: - - "docs/**" - - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From 118df78ff74f6390ffaa80e075b135e09ea9dd11 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 May 2023 15:24:45 +0800 Subject: [PATCH 4/8] Apply suggestions from code review Co-authored-by: silverwind --- .github/file-filters.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 05cd06a8a9743..e88a052039345 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -1,16 +1,17 @@ # This is used by the action https://github.com/dorny/paths-filter (which we have forked to https://github.com/dorny/paths-filter) docs: &docs - - "docs/**" - "**/*.md" + - "docs/**" backend: &backend - "**/*.go" + - "**/*.tmpl" - "go.mod" - "go.sum" frontend: &frontend + - "**/*.js" - "web_src/**" - "package.json" - "package-lock.json" - - "*.js" From 2706af3cc9b07578aeace3b82bd318abd099a56b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 May 2023 15:48:46 +0800 Subject: [PATCH 5/8] Use reuse workflow --- .github/file-filters.yml | 2 -- .github/workflows/files-changed.yml | 32 ++++++++++++++++++++++ .github/workflows/pull-compliance-docs.yml | 14 +--------- .github/workflows/pull-compliance.yml | 16 +---------- .github/workflows/pull-db-tests.yml | 15 +--------- .github/workflows/pull-docker-dryrun.yml | 15 +--------- .github/workflows/pull-e2e-tests.yml | 15 +--------- Makefile | 7 +++++ 8 files changed, 44 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/files-changed.yml diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 05cd06a8a9743..d4566e2ed9e47 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -1,5 +1,3 @@ -# This is used by the action https://github.com/dorny/paths-filter (which we have forked to https://github.com/dorny/paths-filter) - docs: &docs - "docs/**" - "**/*.md" diff --git a/.github/workflows/files-changed.yml b/.github/workflows/files-changed.yml new file mode 100644 index 0000000000000..2a4ddefe655cf --- /dev/null +++ b/.github/workflows/files-changed.yml @@ -0,0 +1,32 @@ +name: files changed + +on: + workflow_call: + outputs: + docs: + description: "wehther docs files changed" + value: ${{ jobs.files-changed.outputs.docs }} + backend: + description: "wehther backend files changed" + value: ${{ jobs.files-changed.outputs.backend }} + frontend: + description: "wehther frontend files changed" + value: ${{ jobs.files-changed.outputs.frontend }} + +jobs: + files-changed: + name: detect what files changed + runs-on: ubuntu-latest + timeout-minutes: 3 + # Map a step output to a job output + outputs: + docs: ${{ steps.changes.outputs.docs }} + backend: ${{ steps.changes.outputs.backend }} + frontend: ${{ steps.changes.outputs.frontend }} + steps: + - uses: actions/checkout@v3 + - name: Check for backend file changes + uses: dorny/paths-filter@v2 + id: changes + with: + filters: .github/file-filters.yml diff --git a/.github/workflows/pull-compliance-docs.yml b/.github/workflows/pull-compliance-docs.yml index a84f93f4033e6..be0ecc322064d 100644 --- a/.github/workflows/pull-compliance-docs.yml +++ b/.github/workflows/pull-compliance-docs.yml @@ -9,19 +9,7 @@ concurrency: jobs: files-changed: - name: detect what files changed - runs-on: ubuntu-latest - timeout-minutes: 3 - # Map a step output to a job output - outputs: - docs: ${{ steps.changes.outputs.docs }} - steps: - - uses: actions/checkout@v3 # v2 - - name: Check for backend file changes - uses: dorny/paths-filter@v2 # v2 - id: changes - with: - filters: .github/file-filters.yml + uses: ./.github/workflows/files-changed.yml compliance-docs: if: needs.files-changed.outputs.docs == 'true' diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index 906f202495548..e108379b3096a 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -9,21 +9,7 @@ concurrency: jobs: files-changed: - name: detect what files changed - runs-on: ubuntu-latest - timeout-minutes: 3 - # Map a step output to a job output - outputs: - docs: ${{ steps.changes.outputs.docs }} - backend: ${{ steps.changes.outputs.backend }} - frontend: ${{ steps.changes.outputs.frontend }} - steps: - - uses: actions/checkout@v3 # v2 - - name: Check for backend file changes - uses: dorny/paths-filter@v2 # v2 - id: changes - with: - filters: .github/file-filters.yml + uses: ./.github/workflows/files-changed.yml lint-backend: if: needs.files-changed.outputs.backend == 'true' diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index f71373ed2af32..cf08da151246b 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -9,20 +9,7 @@ concurrency: jobs: files-changed: - name: detect what files changed - runs-on: ubuntu-latest - timeout-minutes: 3 - # Map a step output to a job output - outputs: - backend: ${{ steps.changes.outputs.backend }} - frontend: ${{ steps.changes.outputs.frontend }} - steps: - - uses: actions/checkout@v3 # v2 - - name: Check for backend file changes - uses: dorny/paths-filter@v2 # v2 - id: changes - with: - filters: .github/file-filters.yml + uses: ./.github/workflows/files-changed.yml test-pgsql: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml index c34f6c781d2c9..89b0c5253c371 100644 --- a/.github/workflows/pull-docker-dryrun.yml +++ b/.github/workflows/pull-docker-dryrun.yml @@ -9,20 +9,7 @@ concurrency: jobs: files-changed: - name: detect what files changed - runs-on: ubuntu-latest - timeout-minutes: 3 - # Map a step output to a job output - outputs: - backend: ${{ steps.changes.outputs.backend }} - frontend: ${{ steps.changes.outputs.frontend }} - steps: - - uses: actions/checkout@v3 # v2 - - name: Check for backend file changes - uses: dorny/paths-filter@v2 # v2 - id: changes - with: - filters: .github/file-filters.yml + uses: ./.github/workflows/files-changed.yml docker-dryrun: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index a6b8f94e6fc6f..cf6af401f5eae 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -9,20 +9,7 @@ concurrency: jobs: files-changed: - name: detect what files changed - runs-on: ubuntu-latest - timeout-minutes: 3 - # Map a step output to a job output - outputs: - backend: ${{ steps.changes.outputs.backend }} - frontend: ${{ steps.changes.outputs.frontend }} - steps: - - uses: actions/checkout@v3 # v2 - - name: Check for backend file changes - uses: dorny/paths-filter@v2 # v2 - id: changes - with: - filters: .github/file-filters.yml + uses: ./.github/workflows/files-changed.yml test-e2e: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' diff --git a/Makefile b/Makefile index 3d777505a56f2..a3e94b8b72a27 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4 XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest +ACTION_LINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest DOCKER_IMAGE ?= gitea/gitea DOCKER_TAG ?= latest @@ -199,6 +200,7 @@ help: @echo " - deps-tools install tool dependencies" @echo " - lint lint everything" @echo " - lint-fix lint everything and fix issues" + @echo " - lint-action lint action workflow files" @echo " - lint-frontend lint frontend files" @echo " - lint-frontend-fix lint frontend files and fix issues" @echo " - lint-backend lint backend files" @@ -411,6 +413,10 @@ lint-go-vet: lint-editorconfig: $(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .github/workflows +.PHONY: lint-action +lint-action: + actionlint + .PHONY: watch watch: bash build/watch.sh @@ -908,6 +914,7 @@ deps-tools: $(GO) install $(XGO_PACKAGE) $(GO) install $(GO_LICENSES_PACKAGE) $(GO) install $(GOVULNCHECK_PACKAGE) + $(GO) install $(ACTION_LINT_PACKAGE) node_modules: package-lock.json npm install --no-save From 750e45974f3feed71ffcfe500e1e1bff4135f101 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 May 2023 19:44:20 +0800 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: silverwind --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index fd9e22e7bf5ce..b813bed3e5999 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4 XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest -ACTION_LINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest +ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest DOCKER_IMAGE ?= gitea/gitea DOCKER_TAG ?= latest @@ -200,7 +200,7 @@ help: @echo " - deps-tools install tool dependencies" @echo " - lint lint everything" @echo " - lint-fix lint everything and fix issues" - @echo " - lint-action lint action workflow files" + @echo " - lint-actions lint action workflow files" @echo " - lint-frontend lint frontend files" @echo " - lint-frontend-fix lint frontend files and fix issues" @echo " - lint-backend lint backend files" @@ -413,9 +413,9 @@ lint-go-vet: lint-editorconfig: $(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .github/workflows -.PHONY: lint-action -lint-action: - actionlint +.PHONY: lint-actions +lint-actions: + $(GO) run $(ACTIONLINT_PACKAGE) .PHONY: watch watch: @@ -914,7 +914,7 @@ deps-tools: $(GO) install $(XGO_PACKAGE) $(GO) install $(GO_LICENSES_PACKAGE) $(GO) install $(GOVULNCHECK_PACKAGE) - $(GO) install $(ACTION_LINT_PACKAGE) + $(GO) install $(ACTIONLINT_PACKAGE) node_modules: package-lock.json npm install --no-save From 964da421b6214f0b7b44983ba79b582c6f923ab3 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 24 May 2023 14:49:05 +0200 Subject: [PATCH 7/8] fix typos --- .github/workflows/files-changed.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/files-changed.yml b/.github/workflows/files-changed.yml index 2a4ddefe655cf..b39e5d524d56d 100644 --- a/.github/workflows/files-changed.yml +++ b/.github/workflows/files-changed.yml @@ -4,13 +4,13 @@ on: workflow_call: outputs: docs: - description: "wehther docs files changed" + description: "whether docs files changed" value: ${{ jobs.files-changed.outputs.docs }} backend: - description: "wehther backend files changed" + description: "whether backend files changed" value: ${{ jobs.files-changed.outputs.backend }} frontend: - description: "wehther frontend files changed" + description: "whether frontend files changed" value: ${{ jobs.files-changed.outputs.frontend }} jobs: From 4d2e851ee5b1959bbdb8749d337fff0587f2b9e1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 24 May 2023 14:49:21 +0200 Subject: [PATCH 8/8] Update .github/workflows/files-changed.yml --- .github/workflows/files-changed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/files-changed.yml b/.github/workflows/files-changed.yml index b39e5d524d56d..2efd6767197d1 100644 --- a/.github/workflows/files-changed.yml +++ b/.github/workflows/files-changed.yml @@ -15,7 +15,7 @@ on: jobs: files-changed: - name: detect what files changed + name: detect which files changed runs-on: ubuntu-latest timeout-minutes: 3 # Map a step output to a job output