Skip to content

Commit

Permalink
Copy code from carlosthe19916/controls-ui (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Feb 22, 2021
1 parent 9a3b4b0 commit bb614e9
Show file tree
Hide file tree
Showing 221 changed files with 29,353 additions and 97 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!build/*
!nginx.conf.template
!entrypoint.sh
225 changes: 225 additions & 0 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
yarn install
yarn build
- name: Test
run: yarn test --coverage --watchAll=false
- uses: codecov/codecov-action@v1
with:
flags: unitests

e2e:
needs: [unit-test]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox]
services:
keycloak:
image: quay.io/keycloak/keycloak:12.0.2
ports:
- 8180:8080
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
options: >-
--health-cmd "curl --fail http://localhost:8080/auth || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
controls-db:
image: postgres:13.1
ports:
- 5432:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: controls_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Keycloak Admin CLI
uses: carlosthe19916/keycloak-action@0.4
with:
server: http://keycloak:8080/auth
username: admin
password: admin
kcadm: create realms -f konveyor-realm.json
- name: Controls API
run: |
docker run -d --name controls --network ${{ job.services.controls-db.network }} --network-alias controls -p 8080:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://controls-db:5432/controls_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=controls-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret quay.io/mrizzi/poc-controls:latest-native
sleep 5s && docker logs controls
- name: Build
run: |
yarn install
yarn build:instrumentation
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: false
start: yarn run ui:start
wait-on: "http://localhost:3000"
wait-on-timeout: 120
config: pageLoadTimeout=100000
browser: ${{ matrix.browser }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: e2e-screenshots-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/screenshots
- uses: actions/upload-artifact@v1
if: always()
with:
name: e2e-videos-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/videos
- uses: codecov/codecov-action@v1
with:
flags: e2etests

container-images:
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'konveyor' }}
runs-on: ubuntu-latest
needs: [unit-test, e2e]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build
run: |
yarn install
yarn build
- name: Push to Quay.io
uses: elgohr/Publish-Docker-Github-Action@3.02
with:
registry: quay.io
name: konveyor/tackle-ui
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
dockerfile: Dockerfile
snapshot: false
tags: "main"

test-container-images:
needs: [container-images]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox]
services:
keycloak:
image: quay.io/keycloak/keycloak:12.0.2
ports:
- 8180:8080
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
options: >-
--health-cmd "curl --fail http://localhost:8080/auth || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
controls-db:
image: postgres:13.1
ports:
- 5432:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: controls_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Keycloak Admin CLI
uses: carlosthe19916/keycloak-action@0.4
with:
server: http://keycloak:8080/auth
username: admin
password: admin
kcadm: create realms -f konveyor-realm.json
- name: Controls API
run: |
docker run -d --name controls --network ${{ job.services.controls-db.network }} --network-alias controls -p 8080:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://controls-db:5432/controls_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=controls-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \
quay.io/mrizzi/poc-controls:latest-native
sleep 5s && docker logs controls
- name: Tackle UI
run: |
docker run -d --name tackle-ui --network ${{ job.services.controls-db.network }} --network-alias tackle-ui -p 3000:8080 \
-e SSO_REALM=konveyor \
-e SSO_CLIENT_ID=tackle-ui \
-e SSO_SERVER_URL=http://keycloak:8080/auth \
-e CONTROLS_API_URL=http://controls:8080/controls \
quay.io/konveyor/tackle-ui:main
sleep 5s && docker logs tackle-ui
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: false
wait-on: "http://localhost:3000"
wait-on-timeout: 120
config: pageLoadTimeout=100000
browser: ${{ matrix.browser }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_auth_base_url: http://localhost:3000/auth
CYPRESS_controls_base_url: http://localhost:8080/controls
- uses: actions/upload-artifact@v1
if: failure()
with:
name: container-screenshots-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/screenshots
- uses: actions/upload-artifact@v1
if: always()
with:
name: container-videos-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/videos
32 changes: 32 additions & 0 deletions .github/workflows/test-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test containers

on: [push]

jobs:
container-images:
if: ${{ github.event_name != 'pull_request' && github.repository_owner != 'konveyor' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build
run: |
yarn install
yarn build
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Push to GitHub Packages
uses: elgohr/Publish-Docker-Github-Action@3.02
with:
registry: docker.pkg.github.com
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}/tackle-ui
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
snapshot: false
tags: "${{ steps.extract_branch.outputs.branch }}"
119 changes: 24 additions & 95 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,33 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript
# dependencies
/node_modules
/.pnp
.pnp.js

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# testing
/coverage

# Dependency directories
node_modules/
jspm_packages/
# production
/build

# TypeScript v1 declaration files
typings/
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
# cypress
cypress/videos
cypress/screenshots
.nyc_output

# TernJS port file
.tern-port
# VSCode
.vscode/*
Loading

0 comments on commit bb614e9

Please sign in to comment.