Merge pull request #217 from amosproj/po/project-summary #381
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 workflow will build all images and run pre-commit | |
name: CI | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
pre-commit-and-jest: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
cache-dependency-path: Explorer/package-lock.json | |
- run: cd Explorer && npm ci | |
- run: pip install pre-commit | |
- name: Run pre-commit | |
run: pre-commit run --all | |
env: { SKIP: golangci-lint } | |
- name: Run jest-tests | |
if: ${{ always() }} | |
run: cd Explorer && npx -y jest | |
golangci-lint-mod: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: Proxy/go.mod | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | |
version: v1.53 | |
working-directory: Proxy | |
args: --timeout 5m | |
build-and-push-images: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: ./Proxy/Dockerfile | |
image: proxy | |
context: ./Proxy | |
- dockerfile: ./Explorer/Dockerfile | |
image: explorer | |
context: ./Explorer | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.image }} | |
- name: Build and push Docker Images | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
#unit-test: | |
#runs-on: "ubuntu-latest" | |
e2e-testing: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "Test-Cluster" | |
args: --agents 1 | |
- name: Prepare kubeconfig # Copy kubeconfig into /Proxy/.kube folder | |
run: | | |
cd Proxy && mkdir .kube && cd .kube | |
cp -r $HOME/.kube/config . | |
cat config | |
- name: Start kit | |
run: docker compose up -d | |
- run: sleep 20 # Wait for the proxy to collect some data | |
- name: Cypress run e2e testing | |
id: cypressE2E | |
uses: cypress-io/github-action@v5 | |
with: | |
working-directory: Explorer | |
browser: chrome | |
config: defaultCommandTimeout=10000,baseUrl=http://localhost:3000,retries=4 | |
- name: Upload screenshots Cypress E2E Testing | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() && steps.cypressE2E.outcome != 'success' }} | |
with: | |
name: cypress-screenshots-E2E | |
path: Explorer/cypress/screenshots | |
if-no-files-found: ignore | |
retention-days: 1 | |
- name: Upload videos Cypress E2E Testing | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() && steps.cypressE2E.outcome != 'success' }} | |
with: | |
name: cypress-videos-E2E | |
path: Explorer/cypress/videos | |
if-no-files-found: ignore | |
retention-days: 1 | |
- name: Cypress run component testing | |
id: cypressComponent | |
if: ${{ always() }} | |
uses: cypress-io/github-action@v5 | |
with: | |
working-directory: Explorer | |
install: false # we have already installed everything | |
component: true | |
browser: chrome | |
- name: Upload screenshots Cypress Component Testing | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() && steps.cypressComponent.outcome != 'success' }} | |
with: | |
name: cypress-screenshots-component-testing | |
path: Explorer/cypress/screenshots | |
if-no-files-found: ignore | |
retention-days: 1 | |
- name: Upload videos Cypress Component Testing | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() && steps.cypressComponent.outcome != 'success' }} | |
with: | |
name: cypress-videos-component-testing | |
path: Explorer/cypress/videos | |
if-no-files-found: ignore | |
retention-days: 1 | |
#proxy-integration-test: | |
#runs-on: "ubuntu-latest" |