Skip to content

Commit 2a7a895

Browse files
committed
integration-test for gha
1 parent 27f243e commit 2a7a895

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ Does this PR require updates to the documentation at www.gitpod.io/docs?
6161
- [ ] /werft with-large-vm
6262
- [ ] /werft with-gce-vm
6363
If enabled this will create the environment on GCE infra
64-
- [ ] /werft with-integration-tests=all
64+
- [ ] with-integration-tests=all
6565
Valid options are `all`, `workspace`, `webapp`, `ide`, `jetbrains`, `vscode`, `ssh`

.github/workflows/build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
workspace_feature_flags: ${{ steps.output.outputs.workspace_feature_flags }}
3737
pr_no_diff_skip: ${{ steps.pr-diff.outputs.pr_no_diff_skip }}
3838
with_werft: ${{ steps.output.outputs.with-werft }}
39+
with_integration_tests: ${{ steps.output.outputs.with_integration_tests }}
3940
steps:
4041
- name: "Determine Branch"
4142
id: branches
@@ -66,6 +67,7 @@ jobs:
6667
run: |
6768
{
6869
echo "workspace_feature_flags=$(echo "$PR_DESC" | grep -oP '(?<=\[X\] workspace-feature-flags).*')"
70+
echo "with_integration_tests=$(echo "$PR_DESC" | grep -oiP '(?<=\[x\] with-integration-tests=).*')"
6971
} >> $GITHUB_OUTPUT
7072
7173
build-previewctl:
@@ -315,3 +317,42 @@ jobs:
315317
with:
316318
sa_key: ${{ secrets.GCP_CREDENTIALS }}
317319
previewctl_hash: ${{ needs.build-previewctl.outputs.previewctl_hash }}
320+
321+
integration-test:
322+
name: "Run integration test"
323+
needs: [ configuration, build-previewctl, build-gitpod, infrastructure, install ]
324+
runs-on: [ self-hosted ]
325+
if: needs.configuration.outputs.with_integration_tests != ''
326+
concurrency:
327+
group: ${{ github.head_ref || github.ref_name }}-integration-test
328+
cancel-in-progress: true
329+
steps:
330+
- uses: actions/checkout@v3
331+
- name: Run integration test
332+
shell: bash
333+
env:
334+
ROBOQUAT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
335+
INTEGRATION_TEST_USERNAME: ${{ secrets.IDE_INTEGRATION_TEST_USERNAME }}
336+
INTEGRATION_TEST_USER_TOKEN: ${{ secrets.IDE_INTEGRATION_TEST_USER_TOKEN }}
337+
PREVIEW_ENV_DEV_SA_KEY: ${{ secrets.GCP_CREDENTIALS }}
338+
PREVIEW_NAME: ${{ github.head_ref || github.ref_name }}
339+
TEST_SUITS: ${{ needs.configuration.outputs.with_integration_tests }}
340+
run: |
341+
set -euo pipefail
342+
343+
export LEEWAY_WORKSPACE_ROOT="$(pwd)"
344+
export HOME="/home/gitpod"
345+
export PREVIEW_ENV_DEV_SA_KEY_PATH="/home/gitpod/.config/gcloud/preview-environment-dev-sa.json"
346+
347+
echo "${PREVIEW_ENV_DEV_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
348+
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
349+
350+
leeway run dev/preview/previewctl:install
351+
352+
echo "Setting up access to core-dev and harvester"
353+
previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
354+
355+
previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 1m --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
356+
357+
$GITHUB_WORKSPACE/test/run.sh -s ${TEST_SUITS}
358+

0 commit comments

Comments
 (0)