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

ci(Gubbins): Extension workflow #218

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,36 @@ jobs:
tags: ghcr.io/diracgrid/diracx-web/static:${{ needs.release-please.outputs.tag_name }}
platforms: linux/amd64,linux/arm64

build-deploy-gubbins-image:
build-deploy-dev-gubbins-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }}
needs: build-deploy-library-package
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image (extension example)
uses: docker/build-push-action@v6
with:
file: ./packages/extensions/Dockerfile
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }}
tags: ghcr.io/diracgrid/diracx-web/extension-example:dev
platforms: linux/amd64,linux/arm64

build-deploy-release-gubbins-image:
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
steps:
- uses: actions/checkout@v4

Expand All @@ -168,5 +194,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/extension-example:${{ needs.release-please.outputs.tag_name }}
platforms: linux/amd64,linux/arm64
86 changes: 86 additions & 0 deletions .github/workflows/extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Gubbins extension

on:
push:
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

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

# 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 }}
4 changes: 0 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
branches-ignore:
- release-please-**

defaults:
run:
shell: bash -el {0}

jobs:
run-demo:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lerna exec -- npx lint-staged
npx lerna exec --ignore diracx-web-extension-example -- npx lint-staged
Loading
Loading