add messages, remove logs #192
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 do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: build CoderBot frontend | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
cache: 'npm' | |
- name: Docker login | |
run: docker login ghcr.io -u previ -p ${{ secrets.GHCR_BACKEND_STUB_RO }} | |
- name: Run stub | |
run: docker run -dp 5000:5000 --name backend-stub ghcr.io/coderbotorg/backend:stub-latest | |
# Install NPM dependencies, cache them correctly | |
# and run all Cypress tests | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
#build: npm run build-test | |
start: npm run test | |
wait-on: 'http://localhost:5000/api/v1/openapi.json' | |
wait-on-timeout: 60 | |
browser: chrome | |
record: true | |
parallel: true | |
group: 'UI - Chrome' | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# Recommended: pass the GitHub token lets this action correctly | |
# determine the unique run id necessary to re-run the checks | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clean up | |
run: docker stop backend-stub && docker rm backend-stub | |
- name: Archive coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
- name: Archive dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Create Release | |
if: ${{ github.ref_type == 'tag' }} | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: ${{ github.ref_name }} | |
draft: ${{ contains( github.ref_name, 'rc') }} | |
prerelease: false | |
- name: Create archive | |
if: ${{ github.ref_type == 'tag' }} | |
run: tar czf frontend.tar.gz dist | |
- name: Upload Built Frontend | |
if: ${{ github.ref_type == 'tag' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: frontend.tar.gz | |
asset_name: frontend.tar.gz | |
asset_content_type: application/gzip | |
- uses: eregon/publish-release@v1 | |
if: ${{ github.ref_type == 'tag' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 # Checking out the repo | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: ghcr.io/coderbotorg/frontend | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
# always latest | |
type=raw,value=latest | |
# branch event | |
type=ref,event=branch | |
# tag event | |
type=ref,event=tag | |
# pull request event | |
type=ref,event=pr | |
# push event | |
type=sha,enable=true,prefix=git-,format=short | |
- name: Download dist artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- run: wget https://github.com/CoderBotOrg/docs/releases/download/v0.2/docs.tgz | |
- run: mkdir -p cb_docs | |
- run: tar xzf docs.tgz -C cb_docs | |
- run: rm docs.tgz | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
platforms: linux/arm/v7 | |
tags: ${{ steps.meta.outputs.tags }} | |
context: . | |
file: docker/Dockerfile | |
cache-from: type=registry,ref=ghcr.io/coderbotorg/frontend:latest | |
cache-to: type=inline |