Skip to content

Test/pkg

Test/pkg #141

Workflow file for this run

name: "CI/CD"
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 16 ]
name: "Setup"
steps:
- name: "⚙ Set up Node.js v${{ matrix.node }}"
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: "✅ Checkout repository"
uses: actions/checkout@v3
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 16 ]
needs: setup
name: "Build"
steps:
- name: "⚙ Set up Node.js v${{ matrix.node }}"
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: "✅ Checkout repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "💾 Restore packages from cache"
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: "🦉 GitGuardian scan"
uses: GitGuardian/ggshield-action@master
env:
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
- name: "📦 Install packages"
run: yarn install
- name: "💅 Lint"
run: yarn lint
- name: "🔨 Build"
run: yarn build
- name: "👨‍💻 Run Test"
run: yarn test
env:
NODE_ENV: 'test'
- name: "📊 Upload coverage report to Codecov"
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: "📊 SonarCloud Scan"
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=${{ github.repository_owner }}
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
-Dsonar.projectName=${{ github.repository_owner }}_${{ github.event.repository.name }}
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.sources=./src
-Dsonar.exclusions=**/*.bin,node_modules/**,test/**,**/__test__/**,**/__mocks__/**,src/main.ts
-Dsonar.coverage.exclusions=node_modules/**,test/**,**/__test__/**,**/__mocks__/**,src/main.ts
-Dsonar.testExecutionReportPaths=test-report.xml
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: "🐳 Docker"
run: |
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}
docker build -t ${{ github.event.repository.name }} .