Skip to content

Commit

Permalink
ci: add rc workflows (#380)
Browse files Browse the repository at this point in the history
Because

- we are introducing the rc branch to make the ci/cd flow more robust

This commit

- add corresponding GitHub actions
  • Loading branch information
pinglin committed Mar 26, 2023
1 parent 7463895 commit fffa29b
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build and Push Images

on:
push:
branches:
- main
workflow_call:
release:
types: [published]

Expand All @@ -21,9 +19,10 @@ jobs:
password: ${{ secrets.botDockerHubPassword }}

- name: Build and push (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: instill/console:latest
cache-from: type=registry,ref=instill/console:buildcache
Expand Down Expand Up @@ -85,7 +84,7 @@ jobs:
if: github.event_name == 'release'
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: instill/console:${{steps.set_version.outputs.no_v_tag}}
cache-from: type=registry,ref=instill/console:buildcache
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Integration Test

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

jobs:
build-push-image:
if: github.ref == 'refs/heads/main'
name: Build and push image
uses: instill-ai/console/.github/workflows/images.yml@main
secrets: inherit
backends:
needs: build-push-image
if: github.ref == 'refs/heads/main'
name: Backends
strategy:
fail-fast: false
matrix:
component: [pipeline, connector, model, mgmt]
uses: instill-ai/vdp/.github/workflows/integration-test-backend.yml@main
with:
component: ${{ matrix.component }}
target: latest
console:
needs: build-push-image
if: github.ref == 'refs/heads/main'
name: Console
uses: instill-ai/vdp/.github/workflows/integration-test-console.yml@main
with:
target: latest

pr-head:
if: github.event_name == 'pull_request'
name: PR head branch
runs-on: ubuntu-latest
steps:

# mono occupies port 8084 which conflicts with mgmt-backend
- name: Stop mono service
run: |
sudo kill -9 `sudo lsof -t -i:8084`
sudo lsof -i -P -n | grep LISTEN
- name: Free disk space
run: |
df --human-readable
sudo apt clean
docker rmi $(docker image ls --all --quiet)
rm --recursive --force "$AGENT_TOOLSDIRECTORY"
df --human-readable
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: dropletbot
password: ${{ secrets.botDockerHubPassword }}

- name: Build image
uses: docker/build-push-action@v3
with:
context: .
load: true
tags: instill/console:latest

- name: Checkout (vdp)
uses: actions/checkout@v3
with:
repository: instill-ai/vdp

- name: Launch VDP
run: |
COMPOSE_PROFILES=all \
EDITION=local-ce:test \
ITMODE=true \
TRITON_CONDA_ENV_PLATFORM=cpu \
CONSOLE_BASE_URL_HOST=console \
CONSOLE_BASE_API_GATEWAY_URL_HOST=api-gateway \
docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull
COMPOSE_PROFILES=all \
EDITION=local-ce:test \
docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Run integration-test
run: |
docker build --build-arg TEST_USER='root' -f Dockerfile.playwright -t console-playwright .
docker run -t --rm \
-e NEXT_PUBLIC_CONSOLE_BASE_URL=http://console:3000 \
-e NEXT_PUBLIC_API_GATEWAY_BASE_URL=http://api-gateway:8080 \
-e NEXT_SERVER_API_GATEWAY_BASE_URL=http://api-gateway:8080 \
-e NEXT_PUBLIC_API_VERSION=v1alpha \
-e NEXT_PUBLIC_SELF_SIGNED_CERTIFICATION=false \
-e NEXT_PUBLIC_INSTILL_AI_USER_COOKIE_NAME=instill-ai-user \
--network instill-network \
--entrypoint ./entrypoint-playwright.sh \
--name console-integration-test console-playwright
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ jobs:
config-file: release-please/config.json
manifest-file: release-please/manifest.json
- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}
with:
token: ${{ secrets.botGitHubToken }}
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
if: ${{ steps.release.outputs.release_created }}
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.botGPGPrivateKey }}
passphrase: ${{ secrets.botGPGPassphrase }}
Expand All @@ -43,4 +45,4 @@ jobs:
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }} pointing to tag ${{ steps.release.outputs.tag_name }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} pointing to tag ${{ steps.release.outputs.tag_name }}"
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint PR"
name: Lint PR

on:
pull_request_target:
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Versatile Data Pipeline (VDP) console

[![Integration Test](https://github.com/instill-ai/console/actions/workflows/integration-test.yml/badge.svg)](https://github.com/instill-ai/console/actions/workflows/integration-test.yml)

## About VDP Console

The VDP console is written in Nextjs, Typescript, TailwindCSS and it runs a docker container with the VDP backend. Interested in trying it out? Check out [here](https://github.com/instill-ai/vdp) to run it locally.
Expand Down Expand Up @@ -105,3 +107,14 @@ Please refer to the console integration test [document](/integration-test/README
### net::ERR_CERT_AUTHORITY_INVALID

During the local development, our whole backends use self-signed certification. The browser will complain about with `net::ERR_CERT_AUTHORITY_INVALID` error. Please proceed to the API-gateway URL (default: https://localhost:8080) and tell your browser that you want to proceed with the request under this url.

### CI/CD

- **pull_request** to the `main` branch will trigger the **`Integration Test`** workflow running the integration test using the image built on the PR head branch.
- **push** to the `main` branch will trigger
- the **`Integration Test`** workflow building and pushing the `:latest` image on the `main` branch, following by running the integration test, and
- the **`Release Please`** workflow, which will create and update a PR with respect to the up-to-date `main` branch using [release-please-action](https://github.com/google-github-actions/release-please-action).

Once the release PR is merged to the `main` branch, the [release-please-action](https://github.com/google-github-actions/release-please-action) will tag and release a version correspondingly.

The images are pushed to Docker Hub [repository](https://hub.docker.com/r/instill/console).

0 comments on commit fffa29b

Please sign in to comment.