Skip to content

Commit

Permalink
build(tests): run them in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
syldium committed Mar 16, 2024
1 parent f008df9 commit 948bf60
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Build and Deploy
name: Build
on:
push:
branches:
- main
- v1
pull_request:

jobs:
build-and-deploy:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
persist-credentials: false
version: 8

- name: Install and build
run: |
yarn
yarn build
pnpm install
pnpm build
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
- name: Test
run: |
pnpm test run
2 changes: 1 addition & 1 deletion dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"json": {
},
"includes": ["src/**/*.{ts,tsx,js,jsx,cjs,mjs,json}"],
"includes": ["src/**/*.{ts,tsx,js,jsx,cjs,mjs,json}", "*.js", "*.ts"],
"excludes": [
"**/node_modules",
"**/*-lock.json",
Expand Down
16 changes: 11 additions & 5 deletions src/main/context/GameRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export function GameRegistryProvider({
if (holder && (version === fetched.current || import.meta.env.SSR)) {
holder.withVanilla(vanilla);
}
if (states) {
const registry = new Registry(Object.keys(states).map(labelizeOption));
holder!.game.block = registry;
holder!.game.block_state = registry;
}

useEffect(() => {
if (!window.indexedDB || !holder) {
Expand Down Expand Up @@ -154,11 +159,12 @@ export function GameRegistryProvider({
const entries: [string, Schema][] = [];
for (const [registryKey, registry] of holder.entries) {
entries.push(
// @ts-ignore
...Object.entries(registry.entries).map(([key, schema]) => [
resourcePath(registryKey, key),
schema
])
...Object.entries(registry.entries).map(([key, schema]) =>
[
resourcePath(registryKey, key),
schema
] as [string, Schema]
)
);
}
setMany(entries).then(() =>
Expand Down
5 changes: 3 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/setupTests.ts'
setupFiles: './src/setupTests.ts',
isolate: false
},
plugins: [
react(),
react()
],
ssr: {
noExternal: [
Expand Down

0 comments on commit 948bf60

Please sign in to comment.