Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Add GH Actions test job

Russ Garrette6621b8a82a9
diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml
index 88a3e31..dbe1acd 100644
--- a/.github/workflows/web.yml
+++ b/.github/workflows/web.yml
@@ -7,9 +7,26 @@ on:
paths:
- 'web/**'
- '.github/workflows/web.yml'
+ pull_request:
+ branches:
+ - main
+ paths:
+ - 'web/**'
+ - '.github/workflows/web.yml'
jobs:
- login:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: npm ci
+ - name: Run tests
+ run: npm run test
+
+ build:
+ needs: test
+ if: github.ref == 'refs/heads/main'
env:
IMAGE: ghcr.io/openinframap/web
runs-on: ubuntu-latest
diff --git a/web/.eslintrc b/web/.eslintrc
index 9948e23..b38df56 100644
--- a/web/.eslintrc
+++ b/web/.eslintrc
@@ -1,5 +1,6 @@
{
"root": true,
+ "ignorePatterns": ["node_modules/**", "dist/**"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
diff --git a/web/package.json b/web/package.json
index 0609b93..2ddb4af 100644
--- a/web/package.json
+++ b/web/package.json
@@ -6,7 +6,8 @@
"scripts": {
"start": "vite",
"dev": "vite",
- "build": "tsc && vite build"
+ "build": "tsc && vite build",
+ "test": "eslint . && tsc --noEmit"
},
"repository": {
"type": "git",