Skip to content

Commit

Permalink
Merge pull request #134 from aminya/release [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Oct 20, 2022
2 parents 61313e3 + 2785bdd commit add9524
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 70 deletions.
50 changes: 40 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- master
- main
- dev
tags:
- "*"

jobs:
Test:
Expand All @@ -23,7 +25,7 @@ jobs:
- macos-12
- macos-11
node:
- 14 # installed on the images
- 16
pnpm:
- 7
cache_reset_counter:
Expand Down Expand Up @@ -57,29 +59,57 @@ jobs:
run: |
pnpm install
# - name: Setup SSH debugging session
# uses: mxschmitt/action-tmate@v3

- name: Test
if: "!contains(github.event.head_commit.message, '[skip ci test]')"
run: |
pnpm run test
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}

# Create self-contained executable that bundles Nodejs
- name: Create Executable
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12')"
run: |
pnpm run pack.exe
- name: Upload Executable
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
- name: Upload Artifacts
if: ${{ (startsWith(github.ref, 'refs/tags/')) && contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}
uses: actions/upload-artifact@v3
with:
path: |
./exe
./dist
retention-days: 1

# - name: Setup SSH debugging session
# uses: mxschmitt/action-tmate@v3
Release:
needs: Test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3

- name: Test
if: "!contains(github.event.head_commit.message, '[skip ci test]')"
- name: Place Artifacts
run: |
pnpm run test
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}
mv -v artifact/* ./
chmod +x -R ./exe/
- name: Draft the release
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
gzip: folders
draft: true
files: >
./exe/setup_cpp_windows.exe
./exe/setup_cpp_linux
./exe/setup_cpp_mac
./dist/node12/setup_cpp.js
./dist/node12/setup_cpp.js.map
./dist/node12/
./dist/node16/
Docker:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }}
Expand Down
18 changes: 12 additions & 6 deletions dev/scripts/pack-exe.js → dev/scripts/pack-exe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { exec } = require("@actions/exec")
import { node } from "execa"

function getPlatformName() {
switch (process.platform) {
Expand Down Expand Up @@ -26,13 +26,19 @@ function main() {

return Promise.all(
exes.map((exe) =>
exec(
`./node_modules/.bin/caxa --input ./dist/node16 --output ./exe/setup_cpp_${getPlatformName()}${exe} -- "{{caxa}}/node_modules/.bin/node${exe}" "{{caxa}}/setup_cpp.js"`
)
node("./node_modules/caxa/build/index.mjs", [
"--input",
"./dist/node16",
"--output",
`./exe/setup_cpp_${getPlatformName()}${exe}`,
"--",
`{{caxa}}/node_modules/.bin/node${exe}`,
`{{caxa}}/setup_cpp.js`,
])
)
)
}

main().then((exit) => {
process.exit(exit)
main().catch((err) => {
throw err
})
3 changes: 3 additions & 0 deletions dev/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
1 change: 0 additions & 1 deletion ignored-error-codes.json

This file was deleted.

1 change: 0 additions & 1 deletion loosely-type-checked-files.json

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"lint.cspell": "cspell lint --no-progress --show-suggestions",
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
"lint.prettier": "prettier --write .",
"lint.tsc": "tsc --noEmit | loose-ts-check",
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.js",
"lint.tsc": "tsc --noEmit",
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && ts-node --esm ./dev/scripts/pack-exe.ts",
"prepare": "pnpm run -r build && pnpm run -w build",
"start.docker": "docker run -t setup_cpp .",
"start.docker.arch": "docker run -t setup_cpp:arch .",
Expand Down Expand Up @@ -88,7 +88,6 @@
"eslint-config-atomic": "^1.18.1",
"gen-readme": "^1.6.0",
"jest": "^29.2.1",
"loose-ts-check": "^1.2.0",
"npm-check-updates": "^16.3.14",
"npm-run-all2": "^6.0.2",
"parcel": "2.7.0",
Expand All @@ -98,6 +97,7 @@
"shx": "0.3.4",
"terser-config-atomic": "^0.1.1",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"ts-readme": "^1.1.3",
"typescript": "^4.8.4"
},
Expand Down
Loading

0 comments on commit add9524

Please sign in to comment.