CI check & bundle dependencies #3
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: Build & Test | |
on: | |
# push: | |
# branches: [ main ] | |
pull_request: | |
branches: | |
- "main" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
env: | |
TEST_API_URL: https://api.dev.supernova.io/api/v2 | |
TEST_API_KEY: ${{ secrets.SN_API_KEY_DEV }} | |
TEST_ENVIRONMENT: development | |
TEST_DOC_ENVIRONMENT: Live | |
TEST_DESIGN_SYSTEM_ID: 3644 | |
TEST_SYNC_DESIGN_SYSTEM_ID: 3644 | |
TEST_BRAND_ID: acf822d2-c315-4897-b875-d5b00654b057 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/Hydrogen | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
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: Authenticate with private NPM package | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_READ }}" > ~/.npmrc | |
- name: Ensure there is no .nprmc with tokens | |
run: cat ~/.npmrc | |
- name: Ensure there is no .nprmc with tokens | |
run: rm -rf ~/.npmrc | |
- name: Ensure there is no .nprmc with tokens | |
uses: GuillaumeFalourd/[email protected] | |
with: | |
command_line: cat ~/.npmrc | |
assert_file_path: discard.txt | |
expected_result: PASSED | |
- name: Ensure there is no .nprmc with tokens | |
uses: GuillaumeFalourd/[email protected] | |
with: | |
command_line: cat ~/.npmrc | |
assert_file_path: ${{ github.workspace }}/test-resources/exporter-output-files.txt | |
expected_result: PASSED | |
- name: Install dependencies | |
run: npm i | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm run test |