api use yarn #150
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 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: | |
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: ./runtests.md | |
working-directory: web | |
- name: Install api dependencies | |
run: npm i | |
working-directory: api | |
- name: Run api unit test | |
run: ./runtests.md | |
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: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push web | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: poorprogrammer/cfo-web | |
context: "{{defaultContext}}:web" | |
- name: Build and push api | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: poorprogrammer/cfo-api | |
context: "{{defaultContext}}:api" |