From c5aaa0bc2e421b34de8d4fe9039621f1465f341f Mon Sep 17 00:00:00 2001
From: tooomm
Date: Fri, 26 Nov 2021 22:55:53 +0100
Subject: [PATCH] CI: Add webclient (#4478)
---
.../{ci-builds.yml => desktop-build.yml} | 4 +-
.../{clangify.yml => desktop-lint.yml} | 1 +
.github/workflows/web-build.yml | 55 +++++++++++++++++++
.github/workflows/web-lint.yml | 34 ++++++++++++
README.md | 4 +-
5 files changed, 95 insertions(+), 3 deletions(-)
rename .github/workflows/{ci-builds.yml => desktop-build.yml} (99%)
rename .github/workflows/{clangify.yml => desktop-lint.yml} (93%)
create mode 100644 .github/workflows/web-build.yml
create mode 100644 .github/workflows/web-lint.yml
diff --git a/.github/workflows/ci-builds.yml b/.github/workflows/desktop-build.yml
similarity index 99%
rename from .github/workflows/ci-builds.yml
rename to .github/workflows/desktop-build.yml
index 700ab8b0..97b2ce52 100644
--- a/.github/workflows/ci-builds.yml
+++ b/.github/workflows/desktop-build.yml
@@ -1,4 +1,4 @@
-name: Build
+name: Build Desktop
on:
push:
@@ -7,6 +7,7 @@ on:
paths-ignore:
- '**.md'
- 'webclient/**'
+ - '.github/workflows/web-*.yml'
tags:
- '*'
pull_request:
@@ -15,6 +16,7 @@ on:
paths-ignore:
- '**.md'
- 'webclient/**'
+ - '.github/workflows/web-*.yml'
jobs:
configure:
diff --git a/.github/workflows/clangify.yml b/.github/workflows/desktop-lint.yml
similarity index 93%
rename from .github/workflows/clangify.yml
rename to .github/workflows/desktop-lint.yml
index 668a1f44..af04ec27 100644
--- a/.github/workflows/clangify.yml
+++ b/.github/workflows/desktop-lint.yml
@@ -7,6 +7,7 @@ on:
paths-ignore:
- '**.md'
- 'webclient/**'
+ - '.github/workflows/web-*.yml'
jobs:
clang-format:
diff --git a/.github/workflows/web-build.yml b/.github/workflows/web-build.yml
new file mode 100644
index 00000000..10cc95f7
--- /dev/null
+++ b/.github/workflows/web-build.yml
@@ -0,0 +1,55 @@
+name: Build Web
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - '.github/workflows/web-*.yml'
+ - 'webclient/**'
+ - '!**.md'
+ pull_request:
+ branches:
+ - master
+ paths:
+ - '.github/workflows/web-*.yml'
+ - 'webclient/**'
+ - '!**.md'
+
+jobs:
+ build-web:
+ name: React (Node ${{matrix.node_version}})
+
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ working-directory: webclient
+
+ strategy:
+ fail-fast: false
+ matrix:
+ node_version:
+ - 12
+ - lts/*
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: ${{matrix.node_version}}
+ cache: 'npm'
+ cache-dependency-path: 'webclient/package-lock.json'
+
+ - name: Install dependencies
+ run: npm install
+
+ - name: Test app
+ run: npm run test
+
+ - name: Build app
+ if: always()
+ run: npm run build
diff --git a/.github/workflows/web-lint.yml b/.github/workflows/web-lint.yml
new file mode 100644
index 00000000..491bcf14
--- /dev/null
+++ b/.github/workflows/web-lint.yml
@@ -0,0 +1,34 @@
+name: Code Style (TypeScript)
+
+on:
+ pull_request:
+ branches:
+ - master
+ paths:
+ - '.github/workflows/web-*.yml'
+ - 'webclient/**'
+ - '!**.md'
+
+jobs:
+ ESLint:
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ working-directory: webclient
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v2
+ with:
+ cache: 'npm'
+ cache-dependency-path: 'webclient/package-lock.json'
+
+ - name: Install ESLint
+ run: npm install --ignore-scripts
+
+ - name: Run ESLint
+ run: npm run lint
diff --git a/README.md b/README.md
index 94fa916b..06ec7ed5 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
Get Involved |
Community |
Translations |
- Build |
+ Build |
Run |
License
@@ -78,7 +78,7 @@ Cockatrice uses Transifex for translations. You can help us bring Cockatrice and
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about contributing!
-# Build [](https://github.com/Cockatrice/Cockatrice/actions/workflows/ci-builds.yml?query=branch%3Amaster+event%3Apush)
+# Build [](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml?query=branch%3Amaster+event%3Apush) [](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml?query=branch%3Amaster+event%3Apush)
**Detailed compiling instructions can be found on the Cockatrice wiki under [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)**