Skip to content

fix ci hang

fix ci hang #147

Workflow file for this run

# This workflow will do a clean installation 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: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
env:
REGISTRY: ghcr.io
WEB_IMAGE_NAME: ${{ github.repository }}-web
API_IMAGE_NAME: ${{ github.repository }}-api
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [17.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install web dependencies
run: npm i
working-directory: web
- name: Run web unit test
run: npm run test:unit:ci
working-directory: web
- name: Install api dependencies
run: npm i
working-directory: api
- name: Run api unit test
run: npm run ci
working-directory: api
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: run e2e tests
run: docker-compose -f compose/test-ci/docker-compose.yml run e2e
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push web
uses: docker/build-push-action@v2
with:
push: true
tags: poorprogrammer/cfo-web
context: "{{defaultContext}}:web"
- name: Extract metadata (tags, labels) for web
id: metaweb
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.WEB_IMAGE_NAME }}
- name: Build and push web
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: "{{defaultContext}}:web"
push: true
tags: ${{ steps.metaweb.outputs.tags }}
labels: ${{ steps.metaweb.outputs.labels }}
- name: Extract metadata (tags, labels) for web
id: metaapi
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.WEB_IMAGE_NAME }}
- name: Build and push web
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: "{{defaultContext}}:api"
push: true
tags: ${{ steps.metaapi.outputs.tags }}
labels: ${{ steps.metaapi.outputs.labels }}