Skip to content

Commit

Permalink
feat(CI): add extension tests within the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Nov 4, 2024
1 parent 6541d3c commit 16ce39d
Show file tree
Hide file tree
Showing 13 changed files with 10,563 additions and 13,166 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ name: Basic checks
on:
push:
branches-ignore:
- dependabot/**
- release-please-**
pull_request:
branches-ignore:
- release-please-**

jobs:
build:
basic-checks:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
if: github.actor != 'dependabot[bot]' && (github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web')
steps:
- uses: actions/checkout@v4

Expand All @@ -22,9 +21,6 @@ jobs:
cache: 'npm'
- name: Install dependencies
run: npm ci

- name: Build Library
run: npm run build:diracx-web-components

- name: Check formatting rules
run: npx prettier . --check
Expand All @@ -33,3 +29,10 @@ jobs:
- name: Check typescript type validity
run: npm run ts-lint

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
33 changes: 0 additions & 33 deletions .github/workflows/commit-lint.yml

This file was deleted.

20 changes: 14 additions & 6 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

# Storybook is built and deployed to GitHub Pages
# -----------------------------------------------

build-deploy-library-package:
runs-on: ubuntu-latest
needs: release-please
Expand Down Expand Up @@ -88,9 +91,11 @@ jobs:
uses: actions/deploy-pages@v4
with:
token: ${{ github.token }}


build-deploy-dev-image:

# diracx-web is built and deployed to GitHub Container Registry
# -------------------------------------------------------------

build-deploy-diracx-web-dev-image:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
steps:
Expand All @@ -116,7 +121,7 @@ jobs:
tags: ghcr.io/diracgrid/diracx-web/static:dev
platforms: linux/amd64,linux/arm64

build-deploy-release-image:
build-deploy-diracx-web-release-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }}
needs: release-please
Expand Down Expand Up @@ -144,7 +149,10 @@ jobs:
tags: ghcr.io/diracgrid/diracx-web/static:${{ needs.release-please.outputs.tag_name }}
platforms: linux/amd64,linux/arm64

build-deploy-gubbins-image:
# gubbins is built and deployed to GitHub Container Registry
# -------------------------------------------------------------

build-deploy-gubbins-dev-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }}
needs: build-deploy-library-package
Expand All @@ -168,5 +176,5 @@ jobs:
with:
context: ./packages/extensions
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }}
tags: ghcr.io/diracgrid/diracx-web/static:extension-example
tags: ghcr.io/diracgrid/diracx-web/gubbins:dev
platforms: linux/amd64,linux/arm64
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: Tests
name: DiracX-Web Components Tests

on:
push:
paths:
- 'packages/diracx-web-components/**'
- 'package.json'
- 'package-lock.json'
branches-ignore:
- dependabot/**
- release-please-**
pull_request:
paths:
- 'packages/diracx-web-components/**'
- 'package.json'
- 'package-lock.json'
branches-ignore:
- release-please-**

Expand All @@ -22,6 +30,9 @@ jobs:
cache: 'npm'
- name: Install dependencies
run: npm ci

- name: Build Library
run: npm run build:diracx-web-components

- name: Trigger tests
- name: Trigger unit tests
run: npm --prefix packages/diracx-web-components run test
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Integration Tests
name: DiracX-Web Integration Tests

on:
push:
paths-ignore:
- 'packages/extensions/**'
branches-ignore:
- dependabot/**
- release-please-**
Expand Down Expand Up @@ -58,3 +60,4 @@ jobs:
with:
browser: chrome
config: baseUrl=${{ env.DIRACX_URL }}
working-directory: packages/diracx-web
91 changes: 91 additions & 0 deletions .github/workflows/gubbins-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Gubbins extension tests

on:
push:
paths-ignore:
- 'packages/diracx-web/**'
branches-ignore:
- dependabot/**
- release-please-**
pull_request:
branches-ignore:
- release-please-**

jobs:
run-lint:
runs-on: ubuntu-latest
# Run the tests only if It's a PR or if the repo is DIRACGrid/diracx-web
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
steps:
# Checkout the new source code
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Check code-quality rules
run: npm run lint
working-directory: packages/extensions
- name: Check typescript type validity
run: npm run ts-lint

run-demo:
runs-on: ubuntu-latest
# Run the tests only if It's a PR or if the repo is DIRACGrid/diracx-web
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
steps:
# Checkout the new source code
- uses: actions/checkout@v4

# Clone diracx-charts
- name: Clone source
run: |
cd ..
git clone https://github.com/DIRACGrid/diracx-charts.git
# Runs the demo with the extension source code
- name: Start demo
run: |
cd ..
diracx-charts/run_demo.sh --exit-when-done diracx-web/packages/extensions
# Prints some debugging information in case something goes wrong
- name: Debugging information
run: |
cd ../diracx-charts
export KUBECONFIG=$PWD/.demo/kube.conf
.demo/kubectl get pods
for pod_name in $(.demo/kubectl get pods -o json | jq -r '.items[] | .metadata.name' | grep -vE '(dex|minio|mysql|rabbitmq|opensearch)'); do
echo "${pod_name}"
.demo/kubectl describe pod/"${pod_name}" || true
for container_name in $(.demo/kubectl get pods $pod_name -o jsonpath='{.spec.initContainers[*].name} {.spec.containers[*].name}'); do
echo $pod_name $container_name
.demo/kubectl logs "${pod_name}" -c "${container_name}" || true
done
done
- name: Check for success
run: |
cd ../diracx-charts
if [ ! -f ".demo/.success" ]; then
echo "Demo failed"
cat ".demo/.failed"
exit 1
fi
# Find the URL to be tested and put it in the github environment
- name: Set DIRACX_URL
run: echo "DIRACX_URL=https://$(ifconfig | grep 'inet ' | awk '{ print $2 }' | grep -v '^127' | head -n 1 | cut -d '/' -f 1).nip.io:8000" >> $GITHUB_ENV

# Run e2e tests with Cypress
- name: Start Cypress
uses: cypress-io/github-action@v6
with:
browser: chrome
config: baseUrl=${{ env.DIRACX_URL }}
working-directory: packages/extensions
12 changes: 0 additions & 12 deletions cypress.config.ts

This file was deleted.

Loading

0 comments on commit 16ce39d

Please sign in to comment.