Skip to content

Commit

Permalink
ci(): upgrade to electron@19 + add e2e tests (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Dec 9, 2024
1 parent 7d04ec9 commit 0a0d7d7
Show file tree
Hide file tree
Showing 18 changed files with 5,006 additions and 31 deletions.
84 changes: 58 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build
on:
push:
# enable next line to limit branches to run
branches: [ "master" ]
branches: ["master"]
pull_request:
# enable next line to limit branches to run
# branches: [ "master" ]
Expand All @@ -14,30 +14,62 @@ jobs:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [windows-2022, ubuntu-22.04]
flavor: [test, prod]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

# not needed currently, but leaving here for future use
# - uses: actions/setup-python@v4
# with:
# python-version: '2.7.18'

- name: boost
if: startsWith(matrix.os,'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq libboost-dev

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
npm run build
- name: Package
run: |
npm run dist
- uses: actions/checkout@v4
with:
submodules: recursive

# not needed currently, but leaving here for future use
# - uses: actions/setup-python@v4
# with:
# python-version: '2.7.18'

- name: boost
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq libboost-dev

- uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}

- name: Change entry point
if: matrix.flavor == 'test'
run: |
json=$(node -p "JSON.stringify({...require('./package.json'), main: 'main.test.js' }, null, 2)")
echo $json > package.json
- name: Build
run: |
npm ci
npm run build
- name: Package
run: |
npx @electron/packager . deepnest --out dist
- name: Upload
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.flavor }}-${{ matrix.os }}
path: dist/
retention-days: 1

- name: Run app
if: matrix.flavor == 'test'
run: |
appName=$(ls dist | head -1)
# copy input files
# cp -R ./input ./dist/$appName/resources/app
# make executable and run
chmod +x ./dist/$appName/deepnest
xvfb-run ./dist/$appName/deepnest
- name: Upload results
if: matrix.flavor == 'test'
uses: actions/upload-artifact@v4
with:
name: nesting-results-${{ matrix.os }}
path: /home/runner/nesting-*/
retention-days: 1
35 changes: 35 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
if: false
strategy:
matrix:
os: [ubuntu-latest]
timeout-minutes: 5
runs-on: ${{ matrix.os }}
steps:
- name: boost
if: startsWith(matrix.os,'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq libboost-dev
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
# with:
# node-version: 14
# - run: npm i -g npm@8
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: xvfb-run npm test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 1
34 changes: 34 additions & 0 deletions .github/workflows/robot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Robot
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
exec:
if: false
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 5
steps:
- name: boost
run: sudo apt-get update && sudo apt-get install -yq libboost-dev
# - name: Install chromium
# if: matrix.os == 'ubuntu-20.04'
# # https://launchpad.net/ubuntu/+source/chromium-browser/101.0.4951.64-0ubuntu0.18.04.1
# run: sudo apt-get install chromium-browser=101.0.4951.64
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Run robot
run: xvfb-run npm run exec
- uses: actions/upload-artifact@v4
with:
name: nesting
path: /home/runner/
retention-days: 1
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
/bin
/minkowski
/deepnest-*win32-x64
package-lock.json
/output
# package-lock.json
git_token.rtf
.idea
*.zip
.python-version
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# *
# !/tests/*
main/
main.js
16 changes: 16 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"input": "./input",
"output": null,
"timeout": 60000,
"sheet": {
"width": 3000,
"height": 1000
},
"units": "mm",
"spacing": 4,
"rotations": 4,
"threads": 4,
"populationSize": 10,
"mutationRate": 10,
"placementType": "gravity"
}
Loading

0 comments on commit 0a0d7d7

Please sign in to comment.