-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
507 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
gha/ci: Execute smoke tests on GHA/CI | ||
``` |
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,35 +1,143 @@ | ||
name: Build & Push images | ||
|
||
on: workflow_dispatch | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
image_tag: | ||
required: true | ||
type: string | ||
# push: | ||
# branches: | ||
# - 'main' | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
production-image: | ||
sk8l-ui-production-img: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Checkout - set env | ||
run: echo "IMAGE_TAG=$(make version)" >> $GITHUB_ENV | ||
- | ||
name: Set up QEMU | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v5 | ||
- name: Build and push release version | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
if: ${{ github.event_name != 'pull_request' && github.event_name != 'workflow_call' && github.event_name != 'workflow_dispatch' }} | ||
with: | ||
context: . | ||
file: production.dockerfile | ||
push: true | ||
tags: | | ||
${{ vars.DOCKERHUB_SK8L_UI_IMAGE_NAME }}:latest | ||
${{ vars.DOCKERHUB_SK8L_UI_IMAGE_NAME }}:${{ env.IMAGE_TAG }} | ||
${{ vars.DOCKERHUB_SK8L_UI_IMAGE_NAME }}:latestx | ||
${{ vars.DOCKERHUB_SK8L_UI_IMAGE_NAME }}:x-${{ env.IMAGE_TAG }} | ||
sk8l-ui-dev-img: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Checkout - set env | ||
run: echo "IMAGE_TAG=$(make version)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push dev version | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }} | ||
with: | ||
context: . | ||
file: Dockerfile | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
push: true | ||
tags: | | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.event.pull_request.head.ref }} | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.event.pull_request.number }} | ||
sk8l-ui-pre-img: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Checkout - set env | ||
run: echo "IMAGE_TAG=$(make version)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push dev version | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }} | ||
with: | ||
context: . | ||
file: production.dockerfile | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
push: true | ||
tags: | | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ github.event.pull_request.head.ref }} | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ github.event.pull_request.number }} | ||
sk8l-ui-test-img: | ||
runs-on: ubuntu-latest | ||
name: sk8l-ui:ui-test-${{ github.event.pull_request.number }} | ||
needs: [sk8l-ui-pre-img] | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Checkout - set env | ||
run: echo "IMAGE_TAG=$(make version)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push test version | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }} | ||
with: | ||
context: . | ||
file: Dockerfile.test | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
push: true | ||
tags: | | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ github.event.pull_request.head.ref }} | ||
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ github.event.pull_request.number }} |
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,71 @@ | ||
name: k8s-rwkld | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
pull_request_number: | ||
required: true | ||
type: number | ||
image_tag: | ||
required: true | ||
type: string | ||
kind_version: | ||
required: true | ||
type: string | ||
k8s_version: | ||
required: true | ||
type: string | ||
k8s_image: | ||
required: true | ||
type: string | ||
jobs: | ||
k8s-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Setup Kubernetes cluster ${{ inputs.kind_version }}/${{ inputs.k8s_version }} | ||
uses: engineerd/[email protected] | ||
with: | ||
name: sk8l | ||
version: ${{ inputs.kind_version }} | ||
image: ${{ inputs.k8s_image }} | ||
config: testdata/sk8l-kind.yml | ||
- name: Test connection | ||
run: | | ||
kubectl cluster-info > /dev/null | ||
kubectl describe node > /dev/null | ||
- name: Install Helm | ||
uses: azure/[email protected] | ||
with: | ||
version: 'v3.13.3' | ||
- name: Setup certs | ||
run: | | ||
make setup-certs > /dev/null | ||
- name: Install Chart | ||
run: | | ||
make install-chart-ci > /dev/null | ||
- name: ui smoke tests | ||
id: ui_smoke_tests | ||
run: | | ||
./ci/ui_smoke_tests.sh | ||
- name: ui smoke tests error output | ||
if: ${{ failure() && steps.ui_smoke_tests.conclusion == 'failure' }} | ||
run: | | ||
echo "----------------------------" | ||
kubectl get pods -n sk8l | ||
kubectl get cronjobs -n sk8l | ||
echo "----------------------------" | ||
kubectl get jobs cypress-job -n sk8l | ||
kubectl logs job.batch/cypress-job -n sk8l | ||
echo "----------------------------" | ||
curl -vvv http://0.0.0.0:9901/clusters | ||
exit 1 | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: e2e-job-ss | ||
path: cypress/sk8l.js/screenshots/ |
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,36 @@ | ||
name: k8s | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
GO_VERSION: "1.22.2" | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
docker-img: | ||
name: Build Docker image dev-${{ github.event.pull_request.number }} | ||
uses: ./.github/workflows/docker.yml | ||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} | ||
with: | ||
image_tag: dev-${{ github.event.pull_request.number }} | ||
secrets: inherit | ||
k8s-tests: | ||
name: k8s ${{ matrix.k8s.version }}/pr#${{ github.event.pull_request.number }} tests | ||
needs: [docker-img] | ||
strategy: | ||
matrix: | ||
k8s: | ||
- image: "kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245" | ||
version: v1.29.2 | ||
kind: | ||
- version: "v0.22.0" | ||
uses: ./.github/workflows/k8s-test.yml | ||
with: | ||
image_tag: dev-${{ github.event.pull_request.number }} | ||
pull_request_number: ${{ github.event.pull_request.number }} | ||
kind_version: ${{ matrix.kind.version }} | ||
k8s_version: ${{ matrix.k8s.version }} | ||
k8s_image: ${{ matrix.k8s.image }} |
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,12 @@ | ||
FROM ghcr.io/danroux/sk8l-ui:dev AS release | ||
|
||
FROM cypress/included:13.7.3 | ||
LABEL org.opencontainers.image.source=https://github.com/danroux/sk8l-ui | ||
LABEL org.opencontainers.image.description="sk8l-ui ui-test image" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
# USER 1001 | ||
|
||
# RUN chown -R 1001:1001 /var/cache | ||
# COPY --chown=1001:1001 --from=release /usr/app ./e2e | ||
COPY --from=release /usr/app ./e2e |
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,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
kubectl apply -f https://raw.githubusercontent.com/danroux/sk8l-api/main/testdata/sk8l-cronjobs.yml -n sk8l > /dev/null | ||
kubectl wait -n sk8l --for=condition=ready pod -l app.kubernetes.io/pod=sk8l-ui --timeout=300s | ||
sleep 30 | ||
kubectl apply -f testdata/cypress-job.yml -n sk8l | ||
kubectl wait --for=condition=complete job.batch/cypress-job -n sk8l --timeout=600s | ||
|
||
failed=$(kubectl get jobs cypress-job -n sk8l -o jsonpath='{.status.failed}') | ||
kubectl logs job.batch/cypress-job -n sk8l | ||
if [[ "$failed" -gt 0 ]]; then | ||
echo "Failed jobs found. Failing the step." | ||
find cypress/ -type f | ||
exit 1 | ||
fi |
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,24 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
clientCertificates: [ | ||
{ | ||
url: 'https://sk8l-ui', | ||
ca: ['testdata/sk8l-certs/ca-cert.pem'], | ||
certs: [ | ||
{ | ||
cert: 'testdata/sk8l-certs/server-cert.pem', | ||
key: 'testdata/sk8l-certs/server-key.pem', | ||
}, | ||
], | ||
} | ||
], | ||
e2e: { | ||
baseUrl: 'https://sk8l-ui:8001', | ||
supportFile: false, | ||
video: false, | ||
specPattern: [ | ||
"cypress/**/*.spec.js" | ||
] | ||
} | ||
}) |
Oops, something went wrong.