-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI release: pushトリガーで実行されるjobを減らす (#3894)
- Loading branch information
Showing
1 changed file
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ jobs: | |
format-go: | ||
runs-on: ubuntu-latest | ||
needs: docker-compose-build-base | ||
if: always() && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') | ||
if: always() && github.event_name != 'push' && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
@@ -178,7 +178,7 @@ jobs: | |
update-package: | ||
runs-on: ubuntu-latest | ||
needs: docker-compose-build-base | ||
if: always() && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') | ||
if: always() && github.event_name != 'push' && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
@@ -250,6 +250,7 @@ jobs: | |
pr-title-prefix: nodeのバージョンを直してあげたよ! | ||
update-dockle: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'push' | ||
steps: | ||
- uses: actions/[email protected] | ||
if: github.event_name != 'pull_request' || github.event.action != 'closed' | ||
|
@@ -263,6 +264,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
needs: | ||
- docker-compose-build | ||
if: github.event_name != 'push' | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: cat .env >>"$GITHUB_ENV" | ||
|
@@ -276,6 +278,7 @@ jobs: | |
needs: | ||
- docker-compose-build | ||
- update-dockle | ||
if: github.event_name != 'push' | ||
strategy: | ||
matrix: | ||
docker_compose_file_name: ["dev.base.compose.yml", "staging.compose.yml"] | ||
|
@@ -327,6 +330,7 @@ jobs: | |
env: | ||
DOCKER_CONTENT_TRUST: 1 | ||
REPOSITORY: ${{github.repository}} | ||
if: github.event_name != 'push' | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: cat .env >>"$GITHUB_ENV" | ||
|
@@ -361,6 +365,7 @@ jobs: | |
env: | ||
DOCKER_CONTENT_TRUST: 1 | ||
REPOSITORY: ${{github.repository}} | ||
if: github.event_name != 'push' | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: cat .env >>"$GITHUB_ENV" | ||
|
@@ -388,6 +393,8 @@ jobs: | |
needs: | ||
- build-frontend | ||
- e2e-test-mini-docker-compose | ||
- docker-compose-build | ||
- make-browserslist | ||
if: github.event_name == 'push' || github.event_name == 'merge_group' || (github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama') | ||
permissions: | ||
id-token: write | ||
|
@@ -445,6 +452,7 @@ jobs: | |
env: | ||
ARTIFACT_PATH: ${{ github.workspace }}/tmp/artifacts | ||
URLS: https://v${{ github.run_number }}-dot-hato-atama.an.r.appspot.com | ||
if: github.event_name != 'push' | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: mkdir -p "${ARTIFACT_PATH}" | ||
|
@@ -488,7 +496,6 @@ jobs: | |
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
needs: | ||
- e2e-test-all-docker-compose | ||
- e2e-test-mini-prd | ||
- make-browserslist | ||
strategy: | ||
|
@@ -564,45 +571,38 @@ jobs: | |
- name: Remove app engine versions | ||
if: ${{ steps.get_run_numbers.outputs.result != '' }} | ||
run: gcloud app versions delete --service=default ${{steps.get_run_numbers.outputs.result}} | ||
# docker-compose関連でPRとpushで共通して必ず完了しているべきjobが完了したか | ||
release-complete-check-docker-compose: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- update-package | ||
- format-go | ||
- check-nginx-config | ||
- dockle | ||
- e2e-test-mini-docker-compose | ||
- e2e-test-all-docker-compose | ||
steps: | ||
- run: exit 0 | ||
# PRとpushで共通して完了しているべきjobが完了したか | ||
release-complete-check: | ||
runs-on: ubuntu-latest | ||
if: always() && (github.event_name != 'pull_request' || github.event.action != 'closed') | ||
needs: | ||
- lighthouse | ||
- e2e-test-mini-prd | ||
- check-deploy-diff | ||
- release-complete-check-docker-compose | ||
steps: | ||
- if: (github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || (needs.lighthouse.result == 'success' && needs.e2e-test-mini-prd.result == 'success')) && needs.release-complete-check-docker-compose.result == 'success' | ||
- if: (github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || needs.e2e-test-mini-prd.result == 'success') | ||
run: exit 0 | ||
- if: (github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && (needs.lighthouse.result != 'success' || needs.e2e-test-mini-prd.result != 'success')) || needs.release-complete-check-docker-compose.result != 'success' | ||
- if: (github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && needs.e2e-test-mini-prd.result != 'success') | ||
run: exit 1 | ||
# PRをトリガーとした場合に完了しているべきjobが完了したか | ||
# forkしたリポジトリからdev-hato/hato-atamaへPRを出した場合やforkしたリポジトリ上でPRを立てた場合、merge_groupトリガーの場合はcreate-pr-environmentがskipされていても完了したものと見なす | ||
pr-test-complete: | ||
runs-on: ubuntu-latest | ||
if: always() && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'merge_group') | ||
needs: | ||
- lighthouse | ||
- format-go | ||
- update-package | ||
- dockle | ||
- check-nginx-config | ||
- e2e-test-mini-docker-compose | ||
- e2e-test-all-docker-compose | ||
- release-complete-check | ||
- create-pr-environment | ||
- check-deploy-diff | ||
steps: | ||
- if: needs.release-complete-check.result == 'success' && (github.event_name == 'merge_group' || github.repository != github.event.pull_request.head.repo.full_name || github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || needs.create-pr-environment.result == 'success') | ||
- if: needs.release-complete-check.result == 'success' && (github.event_name == 'merge_group' || github.repository != github.event.pull_request.head.repo.full_name || github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || (needs.create-pr-environment.result == 'success' && needs.lighthouse.result == 'success' && needs.format-go.result == 'success' && needs.update-package.result == 'success' && needs.dockle.result == 'success' && needs.check-nginx-config.result == 'success' && needs.e2e-test-mini-docker-compose.result == 'success' && needs.e2e-test-all-docker-compose.result == 'success')) | ||
run: exit 0 | ||
- if: needs.release-complete-check.result != 'success' || (github.event_name != 'merge_group' && github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && needs.create-pr-environment.result != 'success') | ||
- if: needs.release-complete-check.result != 'success' || (github.event_name != 'merge_group' && github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && (needs.create-pr-environment.result != 'success' || needs.lighthouse.result != 'success' || needs.format-go.result != 'success' || needs.update-package.result != 'success' || needs.dockle.result != 'success' || needs.check-nginx-config.result != 'success' || needs.e2e-test-mini-docker-compose.result != 'success' || needs.e2e-test-all-docker-compose.result != 'success')) | ||
run: exit 1 | ||
action-timeline-pr-test-complete: | ||
needs: pr-test-complete | ||
|