Skip to content

bump deps

bump deps #150

# 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@v3
- 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@v3
with:
name: coverage
path: coverage
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- name: Archive dist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3 # 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@v3
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@v3
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