Some dev updates

* Bump electron version to 22.2.1
* Fix npm run electron command (needed the electron-packager-all command which I had removed)
* Improve the npm run format command, no longer floods terminal with all file names
* Updated start command to serve the built version of the game in .app
* Remove some unused commands and unused workflows. Combined the ci and ci-pr workflows.
* Modify check for generated files logic. Attempt to fix so it will edit its own comment instead of posting a new one on every commit.
This commit is contained in:
omuretsu 2023-02-11 15:12:55 -05:00
parent 6a6043c509
commit e9bdc29c8c
7 changed files with 22 additions and 189 deletions

@ -1,85 +0,0 @@
name: Build
on:
workflow_dispatch:
inputs:
buildApp:
description: "Include Application Build"
type: boolean
default: "true"
required: true
buildDoc:
description: "Include Documentation Build"
type: boolean
default: "true"
required: true
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16.13.1
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: "npm"
- name: Install NPM dependencies
run: npm ci
- name: Build Production App
if: ${{ github.event.inputs.buildApp == 'true' }}
run: npm run build
- uses: actions/upload-artifact@v3
if: ${{ github.event.inputs.buildApp == 'true' }}
with:
name: app
path: |
dist/main.bundle.js
dist/main.bundle.js.map
dist/vendor.bundle.js
dist/vendor.bundle.js.map
index.html
expire-on: never
- name: Build Documentation
if: ${{ github.event.inputs.buildDoc == 'true' }}
run: npm run doc
- uses: actions/upload-artifact@v3
if: ${{ github.event.inputs.buildDoc == 'true' }}
with:
name: markdown
path: markdown/
expire-on: never
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
with:
artifact_name: app

@ -23,15 +23,6 @@ jobs:
files: | files: |
dist/* dist/*
index.html index.html
main.bundle.js
main.bundle.js.map
- name: Check documentation changes
id: changed-markdown-doc-files
uses: tj-actions/changed-files@v18.4
with:
files: |
markdown/*.md
- name: Warn when bundle files were changed - name: Warn when bundle files were changed
id: warn-bundles-changed id: warn-bundles-changed
@ -51,14 +42,14 @@ jobs:
echo "Forbidden files included, generating warning" echo "Forbidden files included, generating warning"
touch comment.txt touch comment.txt
echo "## Generated build or documentation files were included. PRs should not normally contain any generated files." >> comment.txt echo "## Generated build files were included. PRs should not normally contain generated files." >> comment.txt
echo "" >> comment.txt echo "" >> comment.txt
echo "Review the changes and ensure that including built files was necessary." >> comment.txt echo "Review the changes and ensure that including generated files was necessary." >> comment.txt
echo "Add pr label" echo "Add pr label"
gh --repo "${{ github.repository }}" \ gh --repo "${{ github.repository }}" \
pr edit "${{ github.event.number }}" --add-label "$LABEL" pr edit "${{ github.event.number }}" --add-label "$LABEL"
echo "And comment on the pr" echo "And comment on the pr"
gh --repo "${{ github.repository }}" \ gh --repo "${{ github.repository }}" \
pr comment "${{ github.event.number }}" --body-file comment.txt pr comment "${{ github.event.number }}" --body-file comment.txt --edit-last
fi fi

@ -1,71 +0,0 @@
name: CI Pull Request
on:
# Triggers the workflow on pull request events but only for the dev branch
pull_request:
branches: [dev]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.13.1
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Build the production app
run: npm run build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16.13.1
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Run linter
run: npm run lint:report
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16.13.1
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Run prettier check
run: npm run format:report
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.13.1
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Run tests
run: npm run test

@ -1,9 +1,11 @@
name: CI name: CI
on: on:
# Triggers the workflow on push events but only for the dev branch # Triggers the workflow on push events and pull requests but only for the dev branch
push: push:
branches: [dev] branches: [dev]
pull_request:
branches: [dev]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@ -13,7 +15,7 @@ jobs:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js 16.13.1 - name: Use Node.js 16.13.1
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
@ -27,7 +29,7 @@ jobs:
name: Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js 16.13.1 - name: Use Node.js 16.13.1
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
@ -41,7 +43,7 @@ jobs:
name: Prettier name: Prettier
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js 16.13.1 - name: Use Node.js 16.13.1
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
@ -55,7 +57,7 @@ jobs:
name: Test name: Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Use Node.js 16.13.1 - name: Use Node.js 16.13.1
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:

@ -1,4 +1,4 @@
name: "Deploy new dev build" name: "Deploy new pages build"
on: on:
workflow_dispatch: workflow_dispatch:
@ -20,8 +20,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16

14
package-lock.json generated

@ -67,7 +67,7 @@
"@typescript-eslint/parser": "^5.48.0", "@typescript-eslint/parser": "^5.48.0",
"babel-jest": "^29.3.1", "babel-jest": "^29.3.1",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"electron": "^22.0.0", "electron": "^22.2.1",
"electron-packager": "^17.1.1", "electron-packager": "^17.1.1",
"eslint": "^8.31.0", "eslint": "^8.31.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
@ -7088,9 +7088,9 @@
"dev": true "dev": true
}, },
"node_modules/electron": { "node_modules/electron": {
"version": "22.0.0", "version": "22.2.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.0.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-22.2.1.tgz",
"integrity": "sha512-cgRc4wjyM+81A0E8UGv1HNJjL1HBI5cWNh/DUIjzYvoUuiEM0SS0hAH/zaFQ18xOz2ced6Yih8SybpOiOYJhdg==", "integrity": "sha512-gPO9IYXCfG+BJnS9WRN/jkBSbnzrIU26IKfDpUAWgqDJNCCfSKHrQJ3kv55RW9gUtPdzYwmhVRHySXd6v9Rzmg==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@ -21258,9 +21258,9 @@
"dev": true "dev": true
}, },
"electron": { "electron": {
"version": "22.0.0", "version": "22.2.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.0.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-22.2.1.tgz",
"integrity": "sha512-cgRc4wjyM+81A0E8UGv1HNJjL1HBI5cWNh/DUIjzYvoUuiEM0SS0hAH/zaFQ18xOz2ced6Yih8SybpOiOYJhdg==", "integrity": "sha512-gPO9IYXCfG+BJnS9WRN/jkBSbnzrIU26IKfDpUAWgqDJNCCfSKHrQJ3kv55RW9gUtPdzYwmhVRHySXd6v9Rzmg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^2.0.0", "@electron/get": "^2.0.0",

@ -68,7 +68,7 @@
"@typescript-eslint/parser": "^5.48.0", "@typescript-eslint/parser": "^5.48.0",
"babel-jest": "^29.3.1", "babel-jest": "^29.3.1",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"electron": "^22.0.0", "electron": "^22.2.1",
"electron-packager": "^17.1.1", "electron-packager": "^17.1.1",
"eslint": "^8.31.0", "eslint": "^8.31.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
@ -100,22 +100,20 @@
}, },
"scripts": { "scripts": {
"doc": "npx api-extractor run && npx api-documenter markdown && rm input/bitburner.api.json && rm -r input && git add markdown/ && git add tsdoc-metadata.json", "doc": "npx api-extractor run && npx api-documenter markdown && rm input/bitburner.api.json && rm -r input && git add markdown/ && git add tsdoc-metadata.json",
"format": "prettier --write .", "format": "prettier -c --write .",
"format:report": "prettier -c .", "format:report": "prettier -c .",
"start": "http-server -p 8000", "start": "cd .app && http-server -p 8000",
"start:dev": "webpack serve --progress --env devServer --mode development", "start:dev": "webpack serve --progress --env devServer --mode development",
"build": "bash ./tools/build.sh production", "build": "bash ./tools/build.sh production",
"build:dev": "bash ./tools/build.sh development", "build:dev": "bash ./tools/build.sh development",
"lint": "eslint --fix --ext js,jsx,ts,tsx --max-warnings 0 src", "lint": "eslint --fix --ext js,jsx,ts,tsx --max-warnings 0 src",
"lint:report": "eslint --ext js,jsx,ts,tsx --max-warnings 0 src",
"preinstall": "node ./tools/engines-check/engines-check.js", "preinstall": "node ./tools/engines-check/engines-check.js",
"postinstall": "cd electron && npm install",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"watch": "webpack --watch --mode production", "watch": "webpack --watch --mode production",
"watch:dev": "webpack --watch --mode development", "watch:dev": "webpack --watch --mode development",
"electron": "bash ./tools/package-electron.sh", "electron": "bash ./tools/package-electron.sh",
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -u origin dev", "electron:packager-all": "electron-packager .package bitburner --platform all --arch x64,armv7l,arm64,mips64el --out .build --overwrite --icon .package/icon.png",
"preversion": "npm install && npm run test", "preversion": "npm install && npm run test",
"version": "sh ./tools/build-release.sh && git add --all", "version": "sh ./tools/build-release.sh && git add --all",
"postversion": "git push -u origin dev && git push --tags", "postversion": "git push -u origin dev && git push --tags",