From 24bbaee3a1441d27fab0734bcda6ae72d59ad18d Mon Sep 17 00:00:00 2001 From: Erick Guan <297343+erickguan@users.noreply.github.com> Date: Tue, 9 Jun 2026 17:03:45 +0800 Subject: [PATCH 1/2] Move Ghac cache to another repo --- .github/workflows/service_test_ghac.yml | 44 +++--- .../workflows/service_test_ghac_incoming.yml | 139 ++++++++++++++++++ .../workflows/service_test_ghac_legacy.yml | 72 +++++++++ 3 files changed, 231 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/service_test_ghac_incoming.yml create mode 100644 .github/workflows/service_test_ghac_legacy.yml diff --git a/.github/workflows/service_test_ghac.yml b/.github/workflows/service_test_ghac.yml index 0d80cbc03dee..edd911a0983c 100644 --- a/.github/workflows/service_test_ghac.yml +++ b/.github/workflows/service_test_ghac.yml @@ -18,38 +18,34 @@ name: Service Test Ghac on: - push: - branches: - - main - pull_request: - branches: - - main - paths: - - "core/Cargo.toml" - - "core/Cargo.lock" - - "core/core/Cargo.toml" - - "core/core/src/**" - - "core/layers/**" - - "core/testkit/**" - - "core/tests/**" - - "!core/core/src/docs/**" - - "core/services/azblob/**" - - "core/services/azure-common/**" - - "core/services/ghac/**" - - ".github/workflows/service_test_ghac.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true + workflow_call: + inputs: + opendal_repository: + description: "OpenDAL repository to checkout" + required: true + type: string + opendal_ref: + description: "OpenDAL ref to test" + required: true + type: string + correlation_id: + description: "Identifier used by OpenDAL CI to find this run" + required: true + type: string jobs: ghac_v2: + name: ghac v2 runs-on: ubuntu-latest - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork permissions: actions: write + contents: read steps: - uses: actions/checkout@v6 + with: + repository: ${{ inputs.opendal_repository }} + ref: ${{ inputs.opendal_ref }} + - name: Setup Rust toolchain uses: ./.github/actions/setup with: diff --git a/.github/workflows/service_test_ghac_incoming.yml b/.github/workflows/service_test_ghac_incoming.yml new file mode 100644 index 000000000000..af5506048710 --- /dev/null +++ b/.github/workflows/service_test_ghac_incoming.yml @@ -0,0 +1,139 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Service Test Ghac Incoming +# We will replace existing `service_test_ghac_legacy.yml` when we set up +# shared workflows with another repo `opendal-ghac-service-continous-integration` with: +# - this workflow as `service_test_ghac_trigger.yml` +# - and the new definition at `service_test_ghac.yml` + +on: + push: + branches: + - main + pull_request: + branches: + - main + paths: + - "core/Cargo.toml" + - "core/Cargo.lock" + - "core/core/Cargo.toml" + - "core/core/src/**" + - "core/layers/**" + - "core/testkit/**" + - "core/tests/**" + - "!core/core/src/docs/**" + - "core/services/azblob/**" + - "core/services/azure-common/**" + - "core/services/ghac/**" + - ".github/workflows/service_test_ghac_incoming.yml" + - ".github/workflows/service_test_ghac_probe.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + ghac_v2: + runs-on: ubuntu-latest + if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork + timeout-minutes: 90 + permissions: + contents: read + env: + TARGET_WORKFLOW: opendal-ghac-runner.yml + CORRELATION_ID: ghac-${{ github.run_id }}-${{ github.run_attempt }} + OPENDAL_REPOSITORY: ${{ github.repository }} + OPENDAL_REF: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} + steps: + - uses: actions/checkout@v6 + + - name: Dispatch remote GHAC test + uses: actions/github-script@v8 + with: + # `GITHUB_TOKEN` cannot dispatch workflows in another repository. + # This token must have Actions read/write permission on `opendal-ghac-service-continuous-integration`. + github-token: ${{ secrets.GHAC_SERVICE_CI_TOKEN }} + script: | + const OWNER = 'apache'; + const RUNNER_REPO = 'opendal-ghac-service-continuous-integration'; + const workflow_id = process.env.TARGET_WORKFLOW; + const correlation_id = process.env.CORRELATION_ID; + + await github.rest.actions.createWorkflowDispatch({ + OWNER, + RUNNER_REPO, + workflow_id, + ref: 'main', + inputs: { + opendal_repository: process.env.OPENDAL_REPOSITORY, + opendal_ref: process.env.OPENDAL_REF, + correlation_id, + }, + }); + + core.info(`Dispatched ${OWNER}/${RUNNER_REPO}/${workflow_id} with correlation ${correlation_id}`); + + - name: Wait for remote GHAC test + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.GHAC_SERVICE_CI_TOKEN }} + script: | + const { setTimeout } = require('node:timers/promises'); + + const REMOTE_RUN_POLL_ATTEMPTS = 180; // 10s * 120 = 1200s = 20min + const REMOTE_RUN_POLL_INTERVAL_MS = 10000; // 10s + const OWNER = 'apache'; + const RUNNER_REPO = 'opendal-ghac-service-continuous-integration'; + + const workflow_id = process.env.TARGET_WORKFLOW; + const correlation_id = process.env.CORRELATION_ID; + const expectedTitle = `opendal-ghac-${correlation_id}`; + + let run; + for (let attempt = 0; attempt < REMOTE_RUN_POLL_ATTEMPTS; attempt++) { + const { data } = await github.rest.actions.listWorkflowRuns({ + OWNER, + RUNNER_REPO, + workflow_id, + event: 'workflow_dispatch', + per_page: 20, + }); + + run = data.workflow_runs.find(item => item.display_title === expectedTitle); + if (!run) { + core.info(`Waiting for remote run ${expectedTitle} to appear`); + await setTimeout(REMOTE_RUN_POLL_INTERVAL_MS); + continue; + } + + core.info(`Remote run ${run.html_url} is ${run.status}${run.conclusion ? ` / ${run.conclusion}` : ''}`); + if (run.status === 'completed') { + if (run.conclusion !== 'success') { + core.setFailed(`Remote GHAC test failed with conclusion ${run.conclusion}: ${run.html_url}`); + } + return; + } + + await setTimeout(REMOTE_RUN_POLL_INTERVAL_MS); + } + + if (run?.html_url) { + core.setFailed(`Timed out waiting for remote GHAC test: ${run.html_url}`); + } else { + core.setFailed(`Timed out waiting for remote GHAC test ${expectedTitle} to appear`); + } diff --git a/.github/workflows/service_test_ghac_legacy.yml b/.github/workflows/service_test_ghac_legacy.yml new file mode 100644 index 000000000000..0d80cbc03dee --- /dev/null +++ b/.github/workflows/service_test_ghac_legacy.yml @@ -0,0 +1,72 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Service Test Ghac + +on: + push: + branches: + - main + pull_request: + branches: + - main + paths: + - "core/Cargo.toml" + - "core/Cargo.lock" + - "core/core/Cargo.toml" + - "core/core/src/**" + - "core/layers/**" + - "core/testkit/**" + - "core/tests/**" + - "!core/core/src/docs/**" + - "core/services/azblob/**" + - "core/services/azure-common/**" + - "core/services/ghac/**" + - ".github/workflows/service_test_ghac.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + ghac_v2: + runs-on: ubuntu-latest + if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork + permissions: + actions: write + steps: + - uses: actions/checkout@v6 + - name: Setup Rust toolchain + uses: ./.github/actions/setup + with: + need-nextest: true + + - name: Configure Cache Env + uses: actions/github-script@v8 + with: + script: | + core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); + + - name: Test + shell: bash + working-directory: core + run: cargo test behavior --features tests,services-ghac + env: + OPENDAL_TEST: ghac + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 73455d7150f1fbb4c4a5dbb7a46823eb85ed31fe Mon Sep 17 00:00:00 2001 From: Erick Guan <297343+erickguan@users.noreply.github.com> Date: Tue, 9 Jun 2026 17:16:25 +0800 Subject: [PATCH 2/2] Add ghac-ci branch for test --- .../actions/test_service_ghac_v2/action.yml | 33 +++++ .github/workflows/service_test_ghac.yml | 32 +--- .../workflows/service_test_ghac_incoming.yml | 139 ------------------ .../workflows/service_test_ghac_legacy.yml | 72 --------- 4 files changed, 40 insertions(+), 236 deletions(-) create mode 100644 .github/actions/test_service_ghac_v2/action.yml delete mode 100644 .github/workflows/service_test_ghac_incoming.yml delete mode 100644 .github/workflows/service_test_ghac_legacy.yml diff --git a/.github/actions/test_service_ghac_v2/action.yml b/.github/actions/test_service_ghac_v2/action.yml new file mode 100644 index 000000000000..009322966954 --- /dev/null +++ b/.github/actions/test_service_ghac_v2/action.yml @@ -0,0 +1,33 @@ +name: Test Service GHAC v2 +description: 'Test GHAC v2 service' +inputs: + setup: + description: "The setup action for test" + service: + description: "The service to test" + feature: + description: "The feature to test" + +runs: + using: "composite" + steps: + - name: Setup Rust toolchain + uses: ./.github/actions/setup + with: + need-nextest: true + + - name: Configure Cache Env + uses: actions/github-script@v8 + with: + script: | + core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); + + - name: Test + shell: bash + working-directory: core + run: cargo test behavior --features tests,services-ghac + env: + OPENDAL_TEST: ghac + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/service_test_ghac.yml b/.github/workflows/service_test_ghac.yml index edd911a0983c..3bfdfea16589 100644 --- a/.github/workflows/service_test_ghac.yml +++ b/.github/workflows/service_test_ghac.yml @@ -40,29 +40,11 @@ jobs: permissions: actions: write contents: read - steps: - - uses: actions/checkout@v6 - with: - repository: ${{ inputs.opendal_repository }} - ref: ${{ inputs.opendal_ref }} - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - - name: Configure Cache Env - uses: actions/github-script@v8 - with: - script: | - core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); - - - name: Test - shell: bash - working-directory: core - run: cargo test behavior --features tests,services-ghac - env: - OPENDAL_TEST: ghac - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # `opendal-ghac-service-continous-integration` repo contains an action wrapper that delegates + # implementation on opendal repo but runs and store caches in `opendal-ghac-service-continous-integration` repo. + # We want to reduce cache load on GitHub for a single repo. + uses: apache/opendal-ghac-service-continous-integration/.github/workflows/service-ghac-v2-test.yml@main + with: + repository: ${{ inputs.opendal_repository }} + ref: ${{ inputs.opendal_ref }} diff --git a/.github/workflows/service_test_ghac_incoming.yml b/.github/workflows/service_test_ghac_incoming.yml deleted file mode 100644 index af5506048710..000000000000 --- a/.github/workflows/service_test_ghac_incoming.yml +++ /dev/null @@ -1,139 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -name: Service Test Ghac Incoming -# We will replace existing `service_test_ghac_legacy.yml` when we set up -# shared workflows with another repo `opendal-ghac-service-continous-integration` with: -# - this workflow as `service_test_ghac_trigger.yml` -# - and the new definition at `service_test_ghac.yml` - -on: - push: - branches: - - main - pull_request: - branches: - - main - paths: - - "core/Cargo.toml" - - "core/Cargo.lock" - - "core/core/Cargo.toml" - - "core/core/src/**" - - "core/layers/**" - - "core/testkit/**" - - "core/tests/**" - - "!core/core/src/docs/**" - - "core/services/azblob/**" - - "core/services/azure-common/**" - - "core/services/ghac/**" - - ".github/workflows/service_test_ghac_incoming.yml" - - ".github/workflows/service_test_ghac_probe.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -jobs: - ghac_v2: - runs-on: ubuntu-latest - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork - timeout-minutes: 90 - permissions: - contents: read - env: - TARGET_WORKFLOW: opendal-ghac-runner.yml - CORRELATION_ID: ghac-${{ github.run_id }}-${{ github.run_attempt }} - OPENDAL_REPOSITORY: ${{ github.repository }} - OPENDAL_REF: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} - steps: - - uses: actions/checkout@v6 - - - name: Dispatch remote GHAC test - uses: actions/github-script@v8 - with: - # `GITHUB_TOKEN` cannot dispatch workflows in another repository. - # This token must have Actions read/write permission on `opendal-ghac-service-continuous-integration`. - github-token: ${{ secrets.GHAC_SERVICE_CI_TOKEN }} - script: | - const OWNER = 'apache'; - const RUNNER_REPO = 'opendal-ghac-service-continuous-integration'; - const workflow_id = process.env.TARGET_WORKFLOW; - const correlation_id = process.env.CORRELATION_ID; - - await github.rest.actions.createWorkflowDispatch({ - OWNER, - RUNNER_REPO, - workflow_id, - ref: 'main', - inputs: { - opendal_repository: process.env.OPENDAL_REPOSITORY, - opendal_ref: process.env.OPENDAL_REF, - correlation_id, - }, - }); - - core.info(`Dispatched ${OWNER}/${RUNNER_REPO}/${workflow_id} with correlation ${correlation_id}`); - - - name: Wait for remote GHAC test - uses: actions/github-script@v8 - with: - github-token: ${{ secrets.GHAC_SERVICE_CI_TOKEN }} - script: | - const { setTimeout } = require('node:timers/promises'); - - const REMOTE_RUN_POLL_ATTEMPTS = 180; // 10s * 120 = 1200s = 20min - const REMOTE_RUN_POLL_INTERVAL_MS = 10000; // 10s - const OWNER = 'apache'; - const RUNNER_REPO = 'opendal-ghac-service-continuous-integration'; - - const workflow_id = process.env.TARGET_WORKFLOW; - const correlation_id = process.env.CORRELATION_ID; - const expectedTitle = `opendal-ghac-${correlation_id}`; - - let run; - for (let attempt = 0; attempt < REMOTE_RUN_POLL_ATTEMPTS; attempt++) { - const { data } = await github.rest.actions.listWorkflowRuns({ - OWNER, - RUNNER_REPO, - workflow_id, - event: 'workflow_dispatch', - per_page: 20, - }); - - run = data.workflow_runs.find(item => item.display_title === expectedTitle); - if (!run) { - core.info(`Waiting for remote run ${expectedTitle} to appear`); - await setTimeout(REMOTE_RUN_POLL_INTERVAL_MS); - continue; - } - - core.info(`Remote run ${run.html_url} is ${run.status}${run.conclusion ? ` / ${run.conclusion}` : ''}`); - if (run.status === 'completed') { - if (run.conclusion !== 'success') { - core.setFailed(`Remote GHAC test failed with conclusion ${run.conclusion}: ${run.html_url}`); - } - return; - } - - await setTimeout(REMOTE_RUN_POLL_INTERVAL_MS); - } - - if (run?.html_url) { - core.setFailed(`Timed out waiting for remote GHAC test: ${run.html_url}`); - } else { - core.setFailed(`Timed out waiting for remote GHAC test ${expectedTitle} to appear`); - } diff --git a/.github/workflows/service_test_ghac_legacy.yml b/.github/workflows/service_test_ghac_legacy.yml deleted file mode 100644 index 0d80cbc03dee..000000000000 --- a/.github/workflows/service_test_ghac_legacy.yml +++ /dev/null @@ -1,72 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -name: Service Test Ghac - -on: - push: - branches: - - main - pull_request: - branches: - - main - paths: - - "core/Cargo.toml" - - "core/Cargo.lock" - - "core/core/Cargo.toml" - - "core/core/src/**" - - "core/layers/**" - - "core/testkit/**" - - "core/tests/**" - - "!core/core/src/docs/**" - - "core/services/azblob/**" - - "core/services/azure-common/**" - - "core/services/ghac/**" - - ".github/workflows/service_test_ghac.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -jobs: - ghac_v2: - runs-on: ubuntu-latest - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork - permissions: - actions: write - steps: - - uses: actions/checkout@v6 - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - - name: Configure Cache Env - uses: actions/github-script@v8 - with: - script: | - core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); - - - name: Test - shell: bash - working-directory: core - run: cargo test behavior --features tests,services-ghac - env: - OPENDAL_TEST: ghac - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}