Skip to content

Merge pull request #4101 from project-koku/COST-4176-COST-5651-curren… #752

Merge pull request #4101 from project-koku/COST-4176-COST-5651-curren…

Merge pull request #4101 from project-koku/COST-4176-COST-5651-curren… #752

Workflow file for this run

name: CI
on:
pull_request:
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]
push:
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]
env:
BRANCH: ${{ github.base_ref }}
NODEJS_VERSION: '20'
jobs:
build:
# This job is run for PRs only, as a sanity check, to confirm ci.ext.devshift.net is working properly
if: ${{ github.event_name == 'pull_request' }}
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODEJS_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Lint
run: npm run lint
units:
name: Units
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODEJS_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm install
- name: Test
id: test_run
run: npm test -- --collect-coverage --max-workers=4
- uses: actions/upload-artifact@v4
if: ${{ steps.test_run.outcome == 'success' }}
name: Save coverage report
with:
name: coverage_report
path: coverage/
retention-days: 10
coverage:
name: Coverage
needs: [units]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage_report
path: coverage
- name: Upload coverage report
if: ${{ success() }}
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: coverage
plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.