-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from aldbr/main_FEAT_improve-ci-tags
feat(gha): improve ci
- Loading branch information
Showing
13 changed files
with
1,412 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
name: Basic checks | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'latest' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Check formatting rules | ||
run: npx prettier . --check | ||
|
||
- name: Check code-quality rules | ||
run: npm run lint | ||
|
||
- name: Check typescript type validity | ||
run: npm run ts-lint | ||
- name: Check formatting rules | ||
run: npx prettier . --check | ||
- name: Check code-quality rules | ||
run: npm run lint | ||
- name: Check typescript type validity | ||
run: npm run ts-lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Commit Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'latest' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- 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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Deployment | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
target-branch: ${{ github.ref_name }} | ||
config-file: release-please-config.json | ||
manifest-file: .release-please-manifest.json | ||
|
||
build-deploy-dev-image: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }} | ||
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 (dev) | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }} | ||
tags: ghcr.io/diracgrid/diracx-web/static:dev | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
build-deploy-release-image: | ||
runs-on: ubuntu-latest | ||
needs: release-please | ||
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 | ||
if: ${{ needs.release-please.outputs.release_created == 'true' }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/diracgrid/diracx-web/static:${{ needs.release-please.outputs.tag_name }} | ||
platforms: linux/amd64,linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,53 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
on: [push, pull_request] | ||
|
||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
run: | ||
shell: bash -el {0} | ||
|
||
jobs: | ||
run-demo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Clone source | ||
run: | | ||
cd .. | ||
git clone https://github.com/DIRACGrid/diracx-charts.git | ||
- name: Start demo | ||
run: | | ||
cd .. | ||
diracx-charts/run_demo.sh --exit-when-done diracx-web/ | ||
- 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 | ||
- 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-demo: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Start Cypress | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
config: baseUrl=${{ env.DIRACX_URL }} | ||
- name: Clone source | ||
run: | | ||
cd .. | ||
git clone https://github.com/DIRACGrid/diracx-charts.git | ||
- name: Start demo | ||
run: | | ||
cd .. | ||
diracx-charts/run_demo.sh --exit-when-done diracx-web/ | ||
- 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 | ||
- 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 | ||
|
||
- name: Start Cypress | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
config: baseUrl=${{ env.DIRACX_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
name: Tests | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'latest' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Trigger tests | ||
run: npm run test | ||
- name: Trigger tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ dist | |
public | ||
.github | ||
jest.config.mjs | ||
release-please-config.json | ||
.release-please-manifest.json | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{".": "0.1.0-a0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ["@commitlint/config-conventional"] }; |
Oops, something went wrong.