Add simple CI #9
Workflow file for this run
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 and Test | |
on: | |
workflow_dispatch: ~ | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build_and_test: | |
name: Build and Test | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- 16 | |
# - 18 | |
# - 20 | |
os: | |
# - ubuntu-latest | |
- windows-latest | |
experimental: [false] | |
# include: | |
# - node-version: 20 | |
# os: macos-latest | |
# experimental: true | |
# - node-version: current | |
# os: ubuntu-latest | |
# experimental: true | |
# - node-version: current | |
# os: windows-latest | |
# experimental: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm i | |
- name: Build the app | |
run: npm run build | |
- name: Start the app in production mode | |
run: npm run start:prod & | |
- name: Wait for the app to start | |
run: sleep 5 | |
- name: Check that application can be accessed (Linux) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: curl -sSf http://127.0.0.1:3000 > /dev/null | |
- name: Check netstat | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: netstat -o -n -a | findstr 3000 || true | |
- name: Check that application can be accessed (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: curl -sSf http://127.0.0.1:3000 > NIL | |
- name: Start the app in production mode | |
run: npm run start:prod |