Skip to content

Commit d409aca

Browse files
committed
chore(ci): Run Drive web E2E on a Stack PR label
1 parent 310965a commit d409aca

3 files changed

Lines changed: 79 additions & 4 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Drive web E2E
2+
run-name: 'Drive web E2E for PR #${{ github.event.pull_request.number }}'
3+
4+
on:
5+
pull_request:
6+
types: [labeled]
7+
8+
permissions:
9+
contents: read
10+
11+
# An unrelated label must not cancel an E2E run already in progress.
12+
concurrency:
13+
group: drive-web-e2e-${{ github.event.pull_request.number }}-${{ github.event.label.name }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
if: >-
19+
github.event.label.name == 'e2e:web' &&
20+
github.event.pull_request.head.repo.full_name == github.repository
21+
runs-on: ubuntu-22.04
22+
outputs:
23+
image: ${{ steps.image.outputs.image }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
- uses: docker/login-action@v3
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_SECRET }}
32+
- name: Build and publish the PR image
33+
id: image
34+
env:
35+
PR_NUMBER: ${{ github.event.pull_request.number }}
36+
PR_BRANCH: ${{ github.head_ref }}
37+
run: scripts/docker/production/release.sh --pr "$PR_NUMBER" "$PR_BRANCH"
38+
39+
web:
40+
needs: build
41+
uses: linagora/twake-drive/.github/workflows/e2e.yml@master
42+
with:
43+
drive-ref: master
44+
stack-image: ${{ needs.build.outputs.image }}

‎docs/testing.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ Keep Go tests near their packages and reuse `tests/testutils`. Keep useful Ruby
2525
coverage; replace brittle waits and shared state incrementally. Retire legacy
2626
scalability scripts only when their coverage has an identified replacement.
2727

28+
## Drive web E2E on demand
29+
30+
Add `e2e:web` to a same-repository PR to build its merge commit and call Drive's
31+
existing four-shard web E2E workflow. Remove and re-add the label to test a newer
32+
commit; pushes alone do not trigger it. Fork PRs are skipped.
33+
34+
The existing release script publishes one mutable Docker Hub tag per PR, such
35+
as `cozy/cozy-stack:e2e-pr5119-chore-drive-web-e2e-label`, using the existing
36+
Docker Hub secrets. Rebuilds overwrite it; release tags and `latest` are unchanged.
37+
Tags are not automatically deleted. Use **Re-run all jobs** to rebuild the
38+
original revision, since rerunning only web jobs pulls the current tag.
39+
40+
The [caller](../.github/workflows/drive-web-e2e.yml) runs Drive's `master` workflow
41+
against Drive's `master` branch. Scribe and desktop app tests are excluded.
42+
2843
## Load-test lifecycle
2944

3045
```mermaid
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
#!/bin/bash
2-
set -xe
2+
set -xeuo pipefail
33

4-
RELEASE="$(git describe --tags)"
4+
if [[ $# == 0 ]]; then
5+
RELEASE="$(git describe --tags)"
6+
elif [[ $# == 3 && "$1" == --pr && "$2" =~ ^[1-9][0-9]{0,9}$ ]]; then
7+
branch=$(printf '%s' "$3" | LC_ALL=C tr '[:upper:]' '[:lower:]' | LC_ALL=C sed -E 's/[^a-z0-9_.-]+/-/g; s/^[._-]+//; s/[._-]+$//')
8+
RELEASE="e2e-pr$2-${branch:-branch}"
9+
RELEASE="${RELEASE:0:128}"
10+
else
11+
echo "Usage: $0 [--pr NUMBER BRANCH]" >&2
12+
exit 2
13+
fi
514

615
docker build -t "cozy/cozy-stack:${RELEASE}" -f scripts/docker/production/Dockerfile .
716
docker push "cozy/cozy-stack:${RELEASE}"
8-
docker tag "cozy/cozy-stack:${RELEASE}" "cozy/cozy-stack:latest"
9-
docker push "cozy/cozy-stack:latest"
17+
18+
if [[ $# == 0 ]]; then
19+
docker tag "cozy/cozy-stack:${RELEASE}" "cozy/cozy-stack:latest"
20+
docker push "cozy/cozy-stack:latest"
21+
fi
22+
23+
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
24+
echo "image=cozy/cozy-stack:$RELEASE" >> "$GITHUB_OUTPUT"
25+
fi

0 commit comments

Comments
 (0)