Skip to content

Lock file maintenance #1569

Lock file maintenance

Lock file maintenance #1569

Workflow file for this run

name: Build
on: [ push ]
jobs:
#
# dependencies job
#
dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
always-auth: true
registry-url: https://registry.npmjs.org
- name: Install dependencies with NPM
run: npm ci
- name: Archive node_modules
run: tar --use-compress-program "zstd -T0 --long=31 -1" -cf node_modules.tar.zstd -P node_modules
- name: Persisting node_modules artifact
uses: actions/upload-artifact@v3
with:
name: node_modules.tar.zstd
path: node_modules.tar.zstd
retention-days: 2
#
# lint job
#
lint:
runs-on: ubuntu-latest
needs: [ dependencies ]
steps:
# Setup
- uses: actions/checkout@v3
with:
token: ${{ secrets.BUILD_USER_TOKEN || github.token }} # allows commit of any fixes to trigger a new workflow run
- name: Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
always-auth: true
registry-url: https://registry.npmjs.org
- name: Restore node_modules artifact
uses: actions/download-artifact@v3
with:
name: node_modules.tar.zstd
- name: Unarchive node_modules
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
# Lint
- name: Run linters
uses: wearerequired/lint-action@v2
with:
prettier: true
eslint: true
eslint_args: "--ext '.ts,.js' --ignore-path '.gitignore' --ignore-pattern '.github/*'"
continue_on_error: false
auto_fix: ${{ secrets.BUILD_USER_TOKEN && 'true' || 'false' }}
git_name: equabot
git_email: git@equalogic.com
#
# build job
#
build:
runs-on: ubuntu-latest
needs: [ dependencies ]
steps:
# Setup
- uses: actions/checkout@v3
- name: Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
always-auth: true
registry-url: https://registry.npmjs.org
- name: Restore node_modules artifact
uses: actions/download-artifact@v3
with:
name: node_modules.tar.zstd
- name: Unarchive node_modules
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
# Build
- name: Build application
run: npm run build
env:
CI: true
- name: Check build worked correctly
run: |
if [ ! -f ./dist/index.js ]; then
echo "Something went wrong: no ./dist/index.js file was built!"
exit 1
else
echo "Build appears to be successful: ./dist/index.js was created"
fi
#
# test job
#
test:
runs-on: ubuntu-latest
needs: [ dependencies ]
steps:
# Setup
- uses: actions/checkout@v3
- name: Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
always-auth: true
registry-url: https://registry.npmjs.org
- name: Restore node_modules artifact
uses: actions/download-artifact@v3
with:
name: node_modules.tar.zstd
- name: Unarchive node_modules
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
# Tests
- name: Run project tests
run: npm run test
env:
CI: true