Skip to content

Commit 50b57cb

Browse files
committed
Add continuous integration
1 parent 7220b4a commit 50b57cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+17229
-12421
lines changed

.github/workflows/engine-publish.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Engine - Version and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
newversion:
7+
description: 'Semantic Version Bump Type (major minor patch)'
8+
default: patch
9+
10+
env:
11+
node_version: 14
12+
13+
defaults:
14+
run:
15+
working-directory: engine
16+
17+
jobs:
18+
version_and_release:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ env.node_version }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ env.node_version }}
26+
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
27+
registry-url: 'https://registry.npmjs.org'
28+
- uses: pnpm/[email protected]
29+
with:
30+
version: 5.17.1
31+
- run: pnpm install
32+
- run: git config --global user.name github-actions
33+
- run: git config --global user.email [email protected]
34+
- run: yarn config set version-git-message "Engine v%s"
35+
- run: yarn version --${{ github.event.inputs.newversion }}
36+
- run: sed -i 's/container-engine/@boardgamers\\/container-engine/' package.json
37+
- run: pnpm publish --access public .
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
- run: git push --follow-tags

.github/workflows/engine-test.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Engine - Test
2+
on:
3+
push:
4+
paths:
5+
- '.github/workflows/engine-test.yml'
6+
- 'engine/**'
7+
pull_request:
8+
paths:
9+
- '.github/workflows/engine-test.yml'
10+
- 'engine/**'
11+
12+
defaults:
13+
run:
14+
working-directory: engine
15+
16+
jobs:
17+
lint_and_test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version: '12'
24+
- uses: pnpm/[email protected]
25+
with:
26+
version: 5.17.1
27+
- run: pnpm install
28+
- run: pnpm build
29+
- run: pnpm lint
30+
- run: pnpm test

.github/workflows/prettier.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: All
2+
on: [pull_request, push]
3+
4+
jobs:
5+
prettier:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: actions/setup-node@v1
10+
- uses: pnpm/[email protected]
11+
with:
12+
version: 5.17.1
13+
- run: pnpm install
14+
- run: pnpm run prettier-check

.github/workflows/viewer-publish.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Viewer - Version and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
newversion:
7+
description: 'Semantic Version Bump Type (major minor patch)'
8+
default: patch
9+
10+
env:
11+
node_version: 14
12+
13+
defaults:
14+
run:
15+
working-directory: viewer
16+
17+
jobs:
18+
version_and_release:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ env.node_version }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ env.node_version }}
26+
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
27+
registry-url: 'https://registry.npmjs.org'
28+
- uses: pnpm/[email protected]
29+
with:
30+
version: 5.17.1
31+
- run: pnpm install
32+
- run: git config --global user.name github-actions
33+
- run: git config --global user.email [email protected]
34+
- run: yarn config set version-git-message "Viewer v%s"
35+
- run: yarn version --${{ github.event.inputs.newversion }}
36+
- run: sed -i 's/container-viewer/@boardgamers\\/container-viewer/' package.json
37+
- run: pnpm publish --access public .
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
- run: git push --follow-tags

.github/workflows/viewer-test.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Viewer - Test
2+
on:
3+
push:
4+
paths:
5+
- '.github/workflows/viewer-test.yml'
6+
- 'viewer/**'
7+
branches:
8+
- master
9+
pull_request:
10+
paths:
11+
- '.github/workflows/viewer-test.yml'
12+
- 'viewer/**'
13+
14+
defaults:
15+
run:
16+
working-directory: viewer
17+
18+
jobs:
19+
test_and_build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-node@v2
24+
with:
25+
node-version: '14'
26+
- uses: pnpm/[email protected]
27+
with:
28+
version: 5.17.1
29+
- run: pnpm install
30+
# - run: pnpm lint
31+
# - run: pnpm test
32+
- run: pnpm build

.gitpod.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
image:
2-
file: .gitpod.dockerfile
2+
file: .gitpod.dockerfile
33

44
tasks:
5-
- init: pnpm install
6-
command: cd viewer && pnpm serve
5+
- init: pnpm install
6+
command: cd viewer && pnpm serve
77

88
ports:
9-
- port: 8080
10-
onOpen: open-preview
9+
- port: 8080
10+
onOpen: open-preview
1111

1212
github:
13-
prebuilds:
14-
# enable for the master/default branch (defaults to true)
15-
master: true
16-
# enable for pull requests coming from this repo (defaults to true)
17-
pullRequests: true
18-
# enable for pull requests coming from forks (defaults to false)
19-
pullRequestsFromForks: true
20-
# add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
21-
addComment: true
22-
# add a "Review in Gitpod" button to pull requests (defaults to false)
23-
addBadge: false
24-
# add a label once the prebuild is ready to pull requests (defaults to false)
25-
addLabel: prebuilt-in-gitpod
13+
prebuilds:
14+
# enable for the master/default branch (defaults to true)
15+
master: true
16+
# enable for pull requests coming from this repo (defaults to true)
17+
pullRequests: true
18+
# enable for pull requests coming from forks (defaults to false)
19+
pullRequestsFromForks: true
20+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
21+
addComment: true
22+
# add a "Review in Gitpod" button to pull requests (defaults to false)
23+
addBadge: false
24+
# add a label once the prebuild is ready to pull requests (defaults to false)
25+
addLabel: prebuilt-in-gitpod
2626

2727
vscode:
28-
extensions:
29-
- [email protected]:03mwRhlVpWDul4qBChcVUA==
30-
- [email protected]:iedq1JRjfM74CfhCoy3gJQ==
28+
extensions:
29+
- [email protected]:03mwRhlVpWDul4qBChcVUA==
30+
- [email protected]:iedq1JRjfM74CfhCoy3gJQ==

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm run lint-staged

.prettierrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"tabWidth": 4
2+
"tabWidth": 4,
3+
"singleQuote": true,
4+
"printWidth": 120
35
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Mono repo containing the viewer & the engine for Gaia Container
66

77
Checkout their READMEs:
88

9-
- [engine](./engine/README.md)
10-
- [viewer](./viewer/README.md)
9+
- [engine](./engine/README.md)
10+
- [viewer](./viewer/README.md)
1111

1212
## Demo
1313

engine/.eslintrc.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module.exports = {
22
root: true,
33
env: {
4-
node: true
4+
node: true,
55
},
66
parserOptions: {
7-
ecmaVersion: 2020
7+
ecmaVersion: 2020,
88
},
99
parser: '@typescript-eslint/parser',
10-
plugins: [
11-
'@typescript-eslint',
12-
],
10+
plugins: ['@typescript-eslint'],
1311
extends: [
1412
'eslint:recommended',
1513
'plugin:@typescript-eslint/eslint-recommended',
@@ -23,15 +21,14 @@ module.exports = {
2321
// '@typescript-eslint/consistent-type-assertions': 'off',
2422
// '@typescript-eslint/no-explicit-any': 'off',
2523
'@typescript-eslint/no-empty-function': 'off',
26-
'@typescript-eslint/no-unused-vars': ["warn", { "argsIgnorePattern": "^_" }],
24+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
2725
'@typescript-eslint/explicit-function-return-type': 'off',
2826
'@typescript-eslint/no-use-before-define': 'off',
2927
'@typescript-eslint/no-namespace': 'off',
3028
'no-inner-declarations': 'off',
3129
'no-return-assign': 'off',
3230
// 'no-fallthrough': 'off',
33-
quotes: 'off',
3431
'no-empty': 'off',
35-
'quotes': ['error', 'single']
36-
}
32+
quotes: ['error', 'single'],
33+
},
3734
};

engine/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

engine/.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: node_js
22

33
node_js:
4-
- node
4+
- node

engine/.vscode/launch.json

+4-8
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@
1414
"--slow",
1515
"5000",
1616
"--colors",
17-
"${workspaceFolder}/src/*.spec.ts",
17+
"${workspaceFolder}/src/*.spec.ts"
1818
],
1919
"internalConsoleOptions": "openOnSessionStart",
20-
"skipFiles": [
21-
"<node_internals>/**"
22-
]
20+
"skipFiles": ["<node_internals>/**"]
2321
},
2422
{
2523
"type": "node",
2624
"request": "launch",
2725
"name": "Launch Program",
28-
"skipFiles": [
29-
"<node_internals>/**"
30-
],
26+
"skipFiles": ["<node_internals>/**"],
3127
"program": "${workspaceFolder}/index.js"
3228
}
3329
]
34-
}
30+
}

engine/.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"editor.formatOnSave": true
3-
}
3+
}

engine/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export { setup, currentPlayers, move, stripSecret, ended, reconstructState } from './src/engine';
2-
export type { GameState, Player, PointCard } from './src/gamestate';
3-
export { MoveName, Move, Moves } from './src/move';
1+
export { availableMoves, AvailableMoves } from './src/available-moves';
2+
export { currentPlayers, ended, move, reconstructState, setup, stripSecret } from './src/engine';
43
export { Phase } from './src/gamestate';
4+
export type { GameState, Player, PointCard } from './src/gamestate';
55
export { GameEventName, LogItem } from './src/log';
6-
export { availableMoves, AvailableMoves } from './src/available-moves';
6+
export { Move, MoveName, Moves } from './src/move';

engine/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"prepublishOnly": "npm run test && npm run clean && tsc",
1616
"build": "npm run clean && tsc",
17-
"clean": "del /q dist",
17+
"clean": "rm -Rf dist",
1818
"lint": "eslint . --ext .ts",
1919
"test": "mocha -r ts-node/register src/**/*.spec.ts src/*.spec.ts"
2020
},
@@ -47,4 +47,4 @@
4747
"dist",
4848
"tsconfig.json"
4949
]
50-
}
50+
}

0 commit comments

Comments
 (0)