Skip to content

Merge pull request #98 from iamthechad/remove-travis #81

Merge pull request #98 from iamthechad/remove-travis

Merge pull request #98 from iamthechad/remove-travis #81

Workflow file for this run

# 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: Node.js CI
on:
push:
pull_request:
branches: [ master ]
jobs:
lint:
runs-on: ubuntu-latest
name: Run lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'npm'
- run: npm ci
- run: npm run lint
dev_build:
runs-on: ubuntu-latest
name: Dev build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'npm'
- run: npm ci
- run: npm run build
test:
runs-on: ubuntu-latest
name: Run tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'npm'
- run: npm ci
- run: npm run test
- uses: actions/upload-artifact@v2
with:
name: coverage-info
path: coverage/lcov.info
sonar_cloud:
runs-on: ubuntu-latest
name: SonarCloud Scan
needs: test
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'npm'
- run: npm ci
- uses: actions/download-artifact@v2
with:
name: coverage-info
path: coverage/lcov.info
- uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
aws_deploy:
runs-on: ubuntu-latest
name: Deploy to AWS
needs: [lint, dev_build, test]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v2
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: npm ci
- run: npm run build:prod
- run: aws s3 sync ./dist/ s3://iamthechad.com/datacalc-ng --delete
slack_notify:
runs-on: ubuntu-latest
name: Action complete notify
needs: aws_deploy
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v2
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ env.WORKFLOW_CONCLUSION }}
if: env.WORKFLOW_CONCLUSION == 'failure'