From bfd3eb9dbcdb7aee5ca640a0321ef93516a21a9c Mon Sep 17 00:00:00 2001 From: Giteabot Date: Wed, 14 Jun 2023 11:59:46 -0400 Subject: [PATCH] GitHub Actions enhancements for frontend (#25150) (#25259) Backport #25150 by @silverwind - Don't run DB tests for frontend-only changes - Build frontend as part of frontend step - Build everything when actions change Co-authored-by: silverwind --- .github/workflows/pull-compliance.yml | 24 +++++++++++------------- .github/workflows/pull-db-tests.yml | 12 ++++++------ .github/workflows/pull-docker-dryrun.yml | 2 +- .github/workflows/pull-e2e-tests.yml | 2 +- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index b7c1ab8a33..daee522c27 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -12,7 +12,7 @@ jobs: uses: ./.github/workflows/files-changed.yml lint-backend: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -27,7 +27,7 @@ jobs: TAGS: bindata sqlite sqlite_unlock_notify lint-go-windows: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -44,7 +44,7 @@ jobs: GOARCH: amd64 lint-go-gogit: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -59,7 +59,7 @@ jobs: TAGS: bindata gogit sqlite sqlite_unlock_notify checks-backend: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -72,7 +72,7 @@ jobs: - run: make --always-make checks-backend # ensure the "go-licenses" make target runs frontend: - if: needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -83,9 +83,10 @@ jobs: - run: make deps-frontend - run: make lint-frontend - run: make checks-frontend + - run: make frontend backend: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -94,12 +95,9 @@ jobs: with: go-version: ">=1.20" check-latest: true - - uses: actions/setup-node@v3 - with: - node-version: 20 + # no frontend build here as backend should be able to build + # even without any frontend files - run: make deps-backend deps-tools - - run: make deps-frontend - - run: make frontend - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag - name: build-backend-arm64 run: make backend # test cross compile @@ -120,7 +118,7 @@ jobs: GOARCH: 386 docs: - if: needs.files-changed.outputs.docs == 'true' + if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -133,7 +131,7 @@ jobs: - run: make docs # test if build could succeed actions: - if: needs.files-changed.outputs.actions == 'true' + if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index cf08da1512..3b9768a74b 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -12,7 +12,7 @@ jobs: uses: ./.github/workflows/files-changed.yml test-pgsql: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest services: @@ -58,7 +58,7 @@ jobs: USE_REPO_TEST_DIR: 1 test-sqlite: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -79,7 +79,7 @@ jobs: USE_REPO_TEST_DIR: 1 test-unit: - if: needs.files-changed.outputs.backend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest services: @@ -144,7 +144,7 @@ jobs: GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} test-mysql5: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest services: @@ -188,7 +188,7 @@ 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' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest services: @@ -217,7 +217,7 @@ jobs: USE_REPO_TEST_DIR: 1 test-mssql: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest services: diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml index 89b0c5253c..916de6b27d 100644 --- a/.github/workflows/pull-docker-dryrun.yml +++ b/.github/workflows/pull-docker-dryrun.yml @@ -12,7 +12,7 @@ jobs: uses: ./.github/workflows/files-changed.yml docker-dryrun: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index cf6af401f5..6577cfd240 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -12,7 +12,7 @@ jobs: uses: ./.github/workflows/files-changed.yml test-e2e: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: