From f9ed34f3b82edb4032b1a912ec159665810fb14a Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:45:00 +0200 Subject: [PATCH] Enhance CI definition --- .github/workflows/ci-actions.yml | 179 +------------------------ .github/workflows/container-images.yml | 36 +++++ 2 files changed, 43 insertions(+), 172 deletions(-) create mode 100644 .github/workflows/container-images.yml diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 22eede58..236ab307 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -2,11 +2,13 @@ name: CI on: push: - branches: - - main + branches-ignore: + - "dependabot/**" + paths-ignore: + - "README.md" pull_request: - branches: - - main + paths-ignore: + - "README.md" jobs: unit-test: @@ -32,10 +34,9 @@ jobs: e2e: needs: [unit-test] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest] browser: [chrome, firefox] services: keycloak: @@ -160,169 +161,3 @@ jobs: - 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] - 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" - buildoptions: "--pull" - - 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: - - 5433: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 - application-inventory-db: - image: postgres:13.1 - ports: - - 5434:5432 - env: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: application_inventory_db - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - pathfinder-db: - image: postgres:13.1 - ports: - - 5435:5432 - env: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: pathfinder_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 8081: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/konveyor/tackle-controls:latest-native - sleep 5s && docker logs controls - - name: Application inventory API - run: | - docker run -d --name application-inventory --network ${{ job.services.application-inventory-db.network }} --network-alias application-inventory -p 8082:8080 \ - -e QUARKUS_HTTP_PORT=8080 \ - -e QUARKUS_DATASOURCE_USERNAME=user \ - -e QUARKUS_DATASOURCE_PASSWORD=password \ - -e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://application-inventory-db:5432/application_inventory_db \ - -e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \ - -e QUARKUS_OIDC_CLIENT_ID=application-inventory-api \ - -e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \ - quay.io/konveyor/tackle-application-inventory:latest-native - sleep 5s && docker logs application-inventory - - name: Pathfinder API - run: | - docker run -d --name pathfinder --network ${{ job.services.pathfinder-db.network }} --network-alias pathfinder -p 8083:8080 \ - -e QUARKUS_HTTP_PORT=8080 \ - -e QUARKUS_DATASOURCE_USERNAME=user \ - -e QUARKUS_DATASOURCE_PASSWORD=password \ - -e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://pathfinder-db:5432/pathfinder_db \ - -e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \ - -e QUARKUS_OIDC_CLIENT_ID=pathfinder-api \ - -e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \ - quay.io/konveyor/tackle-pathfinder:latest-native - sleep 5s && docker logs pathfinder - - name: Tackle UI - run: | - docker run -d --name tackle-ui --network ${{ job.services.keycloak.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 \ - -e APPLICATION_INVENTORY_API_URL=http://application-inventory:8080/application-inventory \ - -e PATHFINDER_API_URL=http://pathfinder:8080/pathfinder \ - 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:8081/controls - CYPRESS_application_inventory_base_url: http://localhost:8082/application-inventory - CYPRESS_pathfinder_base_url: http://localhost:8083/pathfinder - - 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 diff --git a/.github/workflows/container-images.yml b/.github/workflows/container-images.yml new file mode 100644 index 00000000..1187df61 --- /dev/null +++ b/.github/workflows/container-images.yml @@ -0,0 +1,36 @@ +name: Container images generator + +on: + push: + branches-ignore: + - "dependabot/**" + +jobs: + container-images: + if: ${{ 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 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: ${{ steps.extract_branch.outputs.branch }} + buildoptions: "--pull"