From 8922ee2b54d65b09b44a1b0ef931f07ec528ec38 Mon Sep 17 00:00:00 2001 From: Fred Date: Tue, 8 Oct 2024 10:26:26 -0300 Subject: [PATCH 1/8] chore: add documentation job --- .github/workflows/pull_request_secure.yml | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index 09f8756174..9cd47931df 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -259,6 +259,42 @@ jobs: env: PIP_FIND_LINKS: ${{ github.workspace }}/timefold-solver/dist run: tox + + build_documentation: + runs-on: ubuntu-latest + steps: + - name: Checkout frontend + id: checkout-frontend + uses: actions/checkout@v4 + with: + repository: TimefoldAI/frontend + token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Safe; only used to clone the repo and not stored in the fork. + fetch-depth: 0 # Otherwise merge will fail on account of not having history. + + - name: Set up NodeJs + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + + - name: Build Documentation + env: + GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} + run: | + sed -i 's/tags:\s*\[v[0-9.]*,\s*v0.8.42]/tags: \[main]/' apps/docs/antora-playbook.yml + npm ci + npm run build -- --filter docs + + - name: Deploy Documentation (Preview Mode) + if: ${{ github.ref != 'refs/heads/main' }} + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + workingDirectory: ./apps/docs + command: pages deploy ./public-serve --project-name=timefold-docs --branch=${{ github.ref }} + sonarcloud: needs: approval_required name: SonarCloud From bc10219445867510e82bda0e5fd01c323e534b4c Mon Sep 17 00:00:00 2001 From: Fred Date: Thu, 14 Nov 2024 17:09:48 -0300 Subject: [PATCH 2/8] chore: address comments --- .github/workflows/pull_request_secure.yml | 30 +++++++++++++++++------ docs/src/antora-playbook-template.yml | 30 +++++++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 docs/src/antora-playbook-template.yml diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index 9cd47931df..97c83d1020 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -42,16 +42,16 @@ jobs: - id: validation shell: bash run: | - echo "Authorized user: ${{ steps.auth_check.outputs.authorized }}" + echo "Authorized user: ${{ steps.auth_check.outputs.authorized }}" # If the user is not a member, require a member to approve the PR. approval_required: needs: known_user environment: - ${{ - github.event_name == 'pull_request_target' && - github.event.pull_request.head.repo.full_name != github.repository && - (needs.known_user.outputs.is_member_of_org != 'true' || github.actor == 'dependabot[bot]') && - 'external' || 'internal' + ${{ + github.event_name == 'pull_request_target' && + github.event.pull_request.head.repo.full_name != github.repository && + (needs.known_user.outputs.is_member_of_org != 'true' || github.actor == 'dependabot[bot]') && + 'external' || 'internal' }} runs-on: ubuntu-latest steps: @@ -262,6 +262,10 @@ jobs: build_documentation: runs-on: ubuntu-latest + needs: approval_required + name: Build Documentation + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} steps: - name: Checkout frontend id: checkout-frontend @@ -271,6 +275,11 @@ jobs: token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Safe; only used to clone the repo and not stored in the fork. fetch-depth: 0 # Otherwise merge will fail on account of not having history. + - name: Checkout timefold-solver + uses: actions/checkout@v4 + with: + path: ./timefold-solver + - name: Set up NodeJs uses: actions/setup-node@v4 with: @@ -281,12 +290,17 @@ jobs: env: GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} run: | - sed -i 's/tags:\s*\[v[0-9.]*,\s*v0.8.42]/tags: \[main]/' apps/docs/antora-playbook.yml + cp ${{ github.workspace }}/timefold-solver/docs/src/antora-playbook-template.yml apps/docs/antora-playbook.yml + cd ${{ github.workspace }}/timefold-solver/ + GURL="$(git remote get-url origin)" + cd - + sed -i "s#CHANGE_URL#$GURL#" apps/docs/antora-playbook.yml + sed -i "s/CHANGE_BRANCH/$BRANCH_NAME/" apps/docs/antora-playbook.yml npm ci npm run build -- --filter docs - name: Deploy Documentation (Preview Mode) - if: ${{ github.ref != 'refs/heads/main' }} + if: ${{ env.BRANCH_NAME != 'main' }} id: deploy uses: cloudflare/wrangler-action@v3 with: diff --git a/docs/src/antora-playbook-template.yml b/docs/src/antora-playbook-template.yml new file mode 100644 index 0000000000..a89c2e4684 --- /dev/null +++ b/docs/src/antora-playbook-template.yml @@ -0,0 +1,30 @@ +site: + title: Timefold Documentation + url: https://docs.timefold.ai + start_page: / + robots: allow + keys: + google_tag_manager: GTM-TBSQGHJ2 + cache_key: {timeFoldCacheKey} #This is a placeholder for the cache key, will be filled in at build time + +urls: + html_extension_style: drop + +content: + edit_url: '{web_url}/edit/main/{path}' + sources: + - url: CHANGE_URL + branches: CHANGE_BRANCH + start_path: docs/src +ui: + bundle: + url: build/ui-bundle.zip + +runtime: + fetch: true + log: + failure_level: error + +asciidoc: + extensions: + - '@asciidoctor/tabs' From 50a12cbc8413d259ba94a362c65b51effb31b5dd Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 18 Nov 2024 11:19:40 -0300 Subject: [PATCH 3/8] chore: address comments --- .github/workflows/pull_request_secure.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index 97c83d1020..8b47e37682 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -290,12 +290,18 @@ jobs: env: GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} run: | - cp ${{ github.workspace }}/timefold-solver/docs/src/antora-playbook-template.yml apps/docs/antora-playbook.yml cd ${{ github.workspace }}/timefold-solver/ GURL="$(git remote get-url origin)" cd - - sed -i "s#CHANGE_URL#$GURL#" apps/docs/antora-playbook.yml - sed -i "s/CHANGE_BRANCH/$BRANCH_NAME/" apps/docs/antora-playbook.yml + sed -i '/algolia/,+1d' apps/docs/antora-playbook.yml + sed -i '/timefold-orbit/,+3d' apps/docs/antora-playbook.yml + sed -i '/timefold-field/,+3d' apps/docs/antora-playbook.yml + sed -i '/timefold-models/,+3d' apps/docs/antora-playbook.yml + sed -i '/timefold-employee/,+3d' apps/docs/antora-playbook.yml + sed -i '/tags/,1d' apps/docs/antora-playbook.yml + sed -i "s#git@github.com:timefoldai/timefold-solver.git#$GURL#g" apps/docs/antora-playbook.yml + sed -i "s/branches:[ .-~]*/branches: $BRANCH_NAME/" apps/docs/antora-playbook.yml + cat apps/docs/antora-playbook.yml npm ci npm run build -- --filter docs From 64d2989a7b968cca35a9f2369c13599196c04d8b Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 18 Nov 2024 11:22:14 -0300 Subject: [PATCH 4/8] chore: clean script --- .github/workflows/pull_request_secure.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index 8b47e37682..c780c5547b 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -301,7 +301,6 @@ jobs: sed -i '/tags/,1d' apps/docs/antora-playbook.yml sed -i "s#git@github.com:timefoldai/timefold-solver.git#$GURL#g" apps/docs/antora-playbook.yml sed -i "s/branches:[ .-~]*/branches: $BRANCH_NAME/" apps/docs/antora-playbook.yml - cat apps/docs/antora-playbook.yml npm ci npm run build -- --filter docs From 4a34b94090bd20f66b57a43abd70a2edcc7dfb4d Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 18 Nov 2024 14:51:46 -0300 Subject: [PATCH 5/8] chore: address comments --- .github/workflows/pull_request_secure.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index c780c5547b..84bfeefb31 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -267,6 +267,10 @@ jobs: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} steps: + - name: Install yq + run: | + sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq + sudo chmod +x /usr/bin/yq - name: Checkout frontend id: checkout-frontend uses: actions/checkout@v4 @@ -290,17 +294,12 @@ jobs: env: GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} run: | + cd ${{ github.workspace }}/timefold-solver/ - GURL="$(git remote get-url origin)" + export GURL="$(git remote get-url origin)" cd - - sed -i '/algolia/,+1d' apps/docs/antora-playbook.yml - sed -i '/timefold-orbit/,+3d' apps/docs/antora-playbook.yml - sed -i '/timefold-field/,+3d' apps/docs/antora-playbook.yml - sed -i '/timefold-models/,+3d' apps/docs/antora-playbook.yml - sed -i '/timefold-employee/,+3d' apps/docs/antora-playbook.yml - sed -i '/tags/,1d' apps/docs/antora-playbook.yml - sed -i "s#git@github.com:timefoldai/timefold-solver.git#$GURL#g" apps/docs/antora-playbook.yml - sed -i "s/branches:[ .-~]*/branches: $BRANCH_NAME/" apps/docs/antora-playbook.yml + yq -i e 'del(.content.sources)' apps/docs/antora-playbook.yml + yq -i e '.content.sources += [{"url": env(GURL), "branches": env(BRANCH_NAME), "start_path": "docs/src"}]' apps/docs/antora-playbook.yml npm ci npm run build -- --filter docs From 77e7573fe045b52704a586137a3a7ba3cea72643 Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 18 Nov 2024 14:56:42 -0300 Subject: [PATCH 6/8] chore: formating --- .github/workflows/pull_request_secure.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull_request_secure.yml b/.github/workflows/pull_request_secure.yml index 84bfeefb31..19373a181e 100644 --- a/.github/workflows/pull_request_secure.yml +++ b/.github/workflows/pull_request_secure.yml @@ -271,6 +271,7 @@ jobs: run: | sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq sudo chmod +x /usr/bin/yq + - name: Checkout frontend id: checkout-frontend uses: actions/checkout@v4 From 171a497f736e85b7f2b6988a4810f2ec8ca06672 Mon Sep 17 00:00:00 2001 From: Fred Date: Wed, 20 Nov 2024 13:09:59 -0300 Subject: [PATCH 7/8] chore: address comments --- docs/src/antora-playbook-template.yml | 30 --------------------------- 1 file changed, 30 deletions(-) delete mode 100644 docs/src/antora-playbook-template.yml diff --git a/docs/src/antora-playbook-template.yml b/docs/src/antora-playbook-template.yml deleted file mode 100644 index a89c2e4684..0000000000 --- a/docs/src/antora-playbook-template.yml +++ /dev/null @@ -1,30 +0,0 @@ -site: - title: Timefold Documentation - url: https://docs.timefold.ai - start_page: / - robots: allow - keys: - google_tag_manager: GTM-TBSQGHJ2 - cache_key: {timeFoldCacheKey} #This is a placeholder for the cache key, will be filled in at build time - -urls: - html_extension_style: drop - -content: - edit_url: '{web_url}/edit/main/{path}' - sources: - - url: CHANGE_URL - branches: CHANGE_BRANCH - start_path: docs/src -ui: - bundle: - url: build/ui-bundle.zip - -runtime: - fetch: true - log: - failure_level: error - -asciidoc: - extensions: - - '@asciidoctor/tabs' From 641bb77e2d75a2aa0f9202562c5c1aee44adbbac Mon Sep 17 00:00:00 2001 From: Fred Date: Tue, 26 Nov 2024 07:03:47 -0300 Subject: [PATCH 8/8] chore: remove docs build from solver CI --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e102b99610..f353d73680 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: cache: 'maven' - name: Build and test timefold-solver - run: mvn -B -Dfull verify + run: mvn -B verify python: name: "Python Solver" concurrency: