Skip to content

Use initial LA sub-domain #490

Use initial LA sub-domain

Use initial LA sub-domain #490

Workflow file for this run

---
name: Integration
on:
push:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
jobs:
pre:
# Verification to be done before the real check
name: Pre-check
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_flag.outputs.should_skip }}
steps:
- name: Skip flag
id: skip_flag
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "same_content_newer"
paths: '["docker-compose*", "client/**", "client-e2e/**", ".github/workflows/integrate.yml"]'
build:
name: Build/Test
needs: pre
if: needs.pre.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache docker images
uses: ScribeMD/[email protected]
with:
key: |
docker-${{ runner.os }}-${{ hashFiles(
'docker-compose*.yml',
'client/Dockerfile',
'client-e2e/Dockerfile',
'client-e2e/images/Dockerfile.*'
) }}
- name: Setup for running tests
run: |
IP=$(ip address show eth0 | grep inet | cut -d ' ' -f 6 | cut -d '/' -f1 | head -n1)
printf "HOST_IP address is: %s\n" "$IP"
cat <<EOF >> ./.env
HOST_IP="$IP"
EOF
cat <<EOF >> ./client/.env
NODE_ENV=development
MAILBOX_URL="wss://mailbox.stage.mw.leastauthority.com/v1"
RELAY_URL="wss://relay.stage.mw.leastauthority.com"
EOF
printf "Client .env:\n"
cat ./client/.env
printf "Client-e2e .env:\n"
cat ./.env
- name: Fix group membership
id: fix_group
run: |
# Add the existing `runner` group to avoid the `docker` one
sudo adduser runner runner
echo "_GID=$(grep -E "^runner:" /etc/group | cut -d: -f3)" >> $GITHUB_ENV
- name: Build images - if not cached
run: |
repository=${{ github.repository }}
# Verify the cache
docker images --quiet ${repository##*/}-client:latest | grep -v "^$" && \
CLIENT=0 || CLIENT=1
docker images --quiet ${repository##*/}-client-e2e:latest | grep -v "^$" && \
CLIENT_E2E=0 || CLIENT_E2E=1
# Build images if any client is missing
test $CLIENT -eq 0 -a $CLIENT_E2E -eq 0 || \
docker compose --progress plain -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e \
build --build-arg uid=$(id -u) --build-arg gid=${_GID}
- name: Setup containers
run: |
docker compose run --rm --no-deps client npm i
docker compose run --rm --no-deps client ./scripts/setup.sh
docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e run --rm --no-deps client-e2e npm i
- name: Start up devserver
run: |
docker compose --progress plain up -d client
docker compose exec client ./scripts/wait-for-webpack.sh
docker compose ps
docker compose logs client
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Run UNIT and INTEGRATION tests
run: docker compose run --rm client npm run test -- --coverage
- name: Run END-2-END tests
run: |
docker compose --progress plain -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e run --rm client-e2e
- name: Stop the containers
run: docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e down
- uses: sonarsource/sonarqube-scan-action@master
# if: github.ref_name == 'main' && github.event_name == 'push'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}