Updating README #97
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
name: Continuous Integration | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:11.6-alpine | |
env: | |
POSTGRES_PASSWORD: ${{ secrets.TEST_POSTGRES_PASSWORD }} | |
POSTGRES_USER: postgres | |
ports: | |
- "5432:5432" | |
redis: | |
image: redis:latest | |
ports: | |
- "6379:6379" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Fetch unshallow | |
run: git fetch --unshallow | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Setup Databases | |
run: | | |
echo TYPEORM_PASSWORD=${{ secrets.TEST_POSTGRES_PASSWORD }} >> .env.ci | |
yarn db:setup:ci | |
- name: Lint | |
run: yarn lint | |
- name: Run tests | |
run: yarn test:ci | |
# Before running the scan, typescript must be installed from npm and | |
# NODE_PATH env var must point to tsc bin folder, otherways typescript static analysis will fail | |
- name: Setup sonar scanner | |
if: github.actor != 'dependabot[bot]' | |
uses: warchant/setup-sonar-scanner@v3 | |
- name: Run Sonarqube analysis | |
if: github.actor != 'dependabot[bot]' | |
run: | | |
echo "NODE_PATH=$(which tsc)" >> $GITHUB_ENV | |
sonar-scanner -Dsonar.host.url=${{ secrets.SONAR_URL }} -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.projectKey=${{secrets.SONAR_PROJECT_KEY }} -Dsonar.nodejs.executable=$(which node) -Dsonar.projectVersion=$(echo $GITHUB_SHA | cut -c1-8) |