diff --git a/.github/workflows/trybot.yaml b/.github/workflows/trybot.yaml index 0bd61905c..b852195c6 100644 --- a/.github/workflows/trybot.yaml +++ b/.github/workflows/trybot.yaml @@ -184,7 +184,8 @@ jobs: if: always() run: test -z "$(git status --porcelain)" || (git status; git diff; false) - run: ./_scripts/buildDockerImage.bash - - run: npm install + - name: npm install in hugo dir + run: npm install working-directory: hugo - name: Test run: go test ./... @@ -233,18 +234,22 @@ jobs: ALGOLIA_INDEX_FILE: ../_public/algolia.json - name: 'tip.cuelang.org: Patch the site to be compatible with the tip of cue-lang/cue' run: _scripts/tipPatchApply.bash - - name: 'tip.cuelang.org: Configure the site to use the tip of cue-lang/cue' - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + name: npm install in hugo dir + run: npm install + working-directory: hugo + - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + name: 'tip.cuelang.org: Configure the site to use the tip of cue-lang/cue' env: GOPRIVATE: cuelang.org/go run: _scripts/tipUseAlternativeCUE.bash - - name: 'tip.cuelang.org: Build the site against the tip of cue-lang/cue' - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + name: 'tip.cuelang.org: Build the site against the tip of cue-lang/cue' run: _scripts/regenPostInfraChange.bash env: GOPRIVATE: cuelang.org/go - - name: 'tip.cuelang.org: Deploy the site' - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + - if: github.repository == 'cue-lang/cuelang.org' && (github.ref == 'refs/heads/master' || (github.ref == 'refs/heads/ci/test')) + name: 'tip.cuelang.org: Deploy the site' run: |- git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" _scripts/tipDeploy.bash 'cueckoo' 'cueckoo@gmail.com' diff --git a/internal/ci/github/trybot.cue b/internal/ci/github/trybot.cue index 2422ddb58..efa738574 100644 --- a/internal/ci/github/trybot.cue +++ b/internal/ci/github/trybot.cue @@ -222,49 +222,17 @@ workflows: trybot: _repo.bashWorkflow & { } }, - githubactions.#Step & { - name: "tip.cuelang.org: Patch the site to be compatible with the tip of cue-lang/cue" - run: "_scripts/tipPatchApply.bash" - }, + // We do this on all branches to catch changes in CL that cause the + // application of tip patches to fail. This doesn't guarantee later + // success, but it's a useful early indicator. + _applyTipPatches, - githubactions.#Step & { - name: "tip.cuelang.org: Configure the site to use the tip of cue-lang/cue" - // Only run in the main repo on the default branch or its designated test branch (i.e not CLs) - // so that CLs aren't blocked by failures caused by unrelated changes. - if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))" - - // Force Go to bypass the module proxy and sumdb for the - // cuelang.org/go module, ensuring that the absolute latest CUE - // pseudo-version is available to test against. - // - // TODO: is this really necessary? Tracking - // https://golang.org/issue/70042 to confirm. - env: GOPRIVATE: "cuelang.org/go" - - run: "_scripts/tipUseAlternativeCUE.bash" - }, - githubactions.#Step & { - name: "tip.cuelang.org: Build the site against the tip of cue-lang/cue" - // Only run in the main repo on the default branch or its designated test branch (i.e not CLs) - // so that CLs aren't blocked by failures caused by unrelated changes. - if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))" - run: "_scripts/regenPostInfraChange.bash" - - // TODO: See comment in previous step - env: GOPRIVATE: "cuelang.org/go" - }, - githubactions.#Step & { - name: "tip.cuelang.org: Deploy the site" - // Only run in the main repo on the default branch or its designated test branch. - if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))" - run: """ - git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n \(_repo.botGitHubUser):${{ secrets.\(_repo.botGitHubUserTokenSecretsKey) }} | base64)" - _scripts/tipDeploy.bash '\(_repo.botGitHubUser)' '\(_repo.botGitHubUserEmail)' - """ + // npm install post applying of tip patches in case there is an relevant patch + _mainRepoDefaulBranch & _npmInstall, - // TODO: See comment in previous step - env: GOPRIVATE: "cuelang.org/go" - }, + _mainRepoDefaulBranch & _useTipOfCUE, + _mainRepoDefaulBranch & _regenPostInfraChange, + _mainRepoDefaulBranch & _deployTipCuelangOrg, ] } @@ -286,6 +254,10 @@ workflows: trybot: _repo.bashWorkflow & { } } +_mainRepoDefaulBranch: githubactions.#Step & { + if: "github.repository == '\(_repo.githubRepositoryPath)' && (github.ref == 'refs/heads/\(_repo.defaultBranch)' || \(_repo.isTestDefaultBranch))" +} + _installNode: githubactions.#Step & { name: "Install Node" uses: "actions/setup-node@v4" @@ -488,6 +460,46 @@ _porcuepineCueLogin: githubactions.#Step & { // npm install in hugo to allow serve test to pass _npmInstall: githubactions.#Step & { + name: "npm install in hugo dir" run: "npm install" "working-directory": "hugo" } + +_applyTipPatches: githubactions.#Step & { + name: "tip.cuelang.org: Patch the site to be compatible with the tip of cue-lang/cue" + run: "_scripts/tipPatchApply.bash" +} + +_useTipOfCUE: githubactions.#Step & { + name: "tip.cuelang.org: Configure the site to use the tip of cue-lang/cue" + + // Force Go to bypass the module proxy and sumdb for the + // cuelang.org/go module, ensuring that the absolute latest CUE + // pseudo-version is available to test against. + // + // TODO: is the use of GOPRIVATE (as opposed to GONOPROXY) really + // necessary? Tracking https://golang.org/issue/70042 to confirm. + env: GOPRIVATE: "cuelang.org/go" + + run: "_scripts/tipUseAlternativeCUE.bash" +} + +_regenPostInfraChange: githubactions.#Step & { + name: "tip.cuelang.org: Build the site against the tip of cue-lang/cue" + run: "_scripts/regenPostInfraChange.bash" + + // TODO: See comment in previous step + env: GOPRIVATE: "cuelang.org/go" +} + +_deployTipCuelangOrg: githubactions.#Step & { + name: "tip.cuelang.org: Deploy the site" + // Only run in the main repo on the default branch or its designated test branch. + run: """ + git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n \(_repo.botGitHubUser):${{ secrets.\(_repo.botGitHubUserTokenSecretsKey) }} | base64)" + _scripts/tipDeploy.bash '\(_repo.botGitHubUser)' '\(_repo.botGitHubUserEmail)' + """ + + // TODO: See comment in previous step + env: GOPRIVATE: "cuelang.org/go" +}