Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nightly e2e pipeline #4149

Merged
merged 14 commits into from
Aug 20, 2024
35 changes: 31 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,30 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Determine Branch Name
id: branch_name
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
fi

- name: Push dev
run: |
docker buildx create --use

tags="-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }}-dev \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-latest-dev"

if [ -n "${{ env.BRANCH_NAME }}" ]; then
tags="$tags -t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ env.BRANCH_NAME }}-latest-dev"
fi

docker buildx build \
--cache-from ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-${{ github.sha }}-dev \
--cache-from ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-latest-dev \
--cache-to ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-${{ github.sha }}-dev \
--cache-to ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-latest-dev \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }}-dev \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-latest-dev \
$tags \
-f ./docker/Dockerfile \
--target dev \
--push \
Expand Down Expand Up @@ -160,10 +174,24 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Determine Branch Name
id: branch_name
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
fi

- name: Push dist
run: |
docker buildx create --use

tags="-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }}-dist \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }}"

if [ -n "${{ env.BRANCH_NAME }}" ]; then
tags="$tags -t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ env.BRANCH_NAME }}-latest-dist"
fi

# Base part of the command
build_command="docker buildx build \
--progress=plain \
Expand All @@ -173,8 +201,7 @@ jobs:
--cache-from ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-latest-dist \
--cache-to ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-${{ github.sha }}-dist \
--cache-to ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:cache-core-latest-dist \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }}-dist \
-t ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-${{ github.sha }} \
$tags \
-f ./docker/Dockerfile \
--target dist \
--push ./"
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Nightly E2E Tests

on:
workflow_dispatch:
schedule:
# Run at 2:00 AM every day
- cron: '0 2 * * *'

jobs:
e2e_tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: DockerHub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Pull Latest Docker Images
run: |
docker pull ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-develop-latest-dist
docker pull ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-develop-latest-dev

- name: Run Selenium Nightly E2E tests
run: |
dist_backend_image=${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-develop-latest-dist \
dev_backend_image=${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:core-develop-latest-dev \
docker compose \
-f ./deployment/docker-compose.selenium-night.yml \
run selenium

- name: Upload Nightly Test Artifacts
uses: actions/upload-artifact@v4
if: always()
continue-on-error: true
with:
name: nightly-e2e-report
path: ./backend/report/
retention-days: 5

- name: Upload Nightly Coverage to Codecov
uses: codecov/codecov-action@v4
if: always()
continue-on-error: true
with:
files: ./backend/coverage.xml
flags: nightly-e2e
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
2 changes: 1 addition & 1 deletion deployment/docker-compose.selenium-night.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'
volumes:
backend-web-app:
services:
selenium-night:
selenium:
stdin_open: true
environment:
- REDIS_INSTANCE=redis:6379
Expand Down
Loading