Skip to content

Lock file maintenance (#280) #534

Lock file maintenance (#280)

Lock file maintenance (#280) #534

Workflow file for this run

name: test
on:
push:
branches:
- main
pull_request:
branches: [ "main" ]
jobs:
test:
strategy:
matrix:
node-version: [20.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
# Node 18 does resolves localhost to ipv6 address by default but refuses any connection to it
# Fix this by changing DNS entries in /etc/hosts file to resolve localhost to ipv4 address
# https://stackoverflow.com/questions/72648487/node-js-16-17-changed-resolution-of-localhost
- run: ${{ !startsWith(matrix.os, 'ubuntu') }} || sudo sed -i '/localhost/c\127.0.0.1 localhost' /etc/hosts
- run: ${{ !startsWith(matrix.os, 'macos') }} || sudo sed -i '' -e 's/.*localhost.*/127.0.0.1 localhost/g' /etc/hosts
- uses: actions/checkout@v6
- name: Set up JRE 17
uses: actions/setup-java@v5
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
java-package: "jre"
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Run npm install
run: npm install
- name: Save Specmatic license
if: github.ref == 'refs/heads/main'
run: |
mkdir -p ~/.specmatic
echo "${{ secrets.SPECMATIC_LICENSE_KEY }}" > ~/.specmatic/specmatic-license.txt
- name: Run npm test
run: npm run test
- name: Run Specmatic Insights Build Reporter
if: github.ref == 'refs/heads/main'
run: |
docker run \
-v ${{ github.workspace }}:/usr/src/app \
-v ~/.specmatic:/root/.specmatic \
specmatic/specmatic \
send-report \
--metadata build_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
--branch-name ${{ github.ref_name }} \
--repo-name ${{ github.event.repository.name }} \
--repo-id ${{ github.repository_id }} \
--repo-url ${{ github.event.repository.html_url }}
- name: Upload HTML Test Report
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}-html-report
path: build/reports/specmatic/html