Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Fix automated build #36

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
on:
release:
types: [created]
push:
branches:
- fix-build
jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
strategy:
matrix:
arch: ['x64']
steps:
- uses: actions/setup-node@master
with:
Expand All @@ -12,36 +16,37 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Ubuntu dependencies
run: sudo apt-get install libgtk-3-dev
run: sudo apt-get install libgtk-3-dev g++ build-essential ninja-build gcc-aarch64-linux-gnu g++-aarch64-linux-gnu build-essential autoconf libtool cmake pkg-config git python-dev swig3.0 libpcre3-dev nodejs-dev

- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Build Qode binary
run: node build.js
run: TARGET_ARCH=${{ matrix.arch }} node build.js
env:
SYNC_GIT_SUBMODULE: 1

- name: Compress files
uses: a7ul/tar-action@v1.0.2
with:
command: c
cwd: ./node/out/Release
cwd: ./out/Release
files: |
./qode
outPath: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz
outPath: qode-linux-${{ matrix.arch }}-test.tar.gz

- uses: actions/upload-artifact@v1
with:
name: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz
path: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz
name: qode-linux-${{ matrix.arch }}-test.tar.gz
path: qode-linux-${{ matrix.arch }}-test.tar.gz

- name: Release
uses: softprops/action-gh-release@master
with:
files: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Release
# uses: softprops/action-gh-release@master
# with:
# files: qode-linux-${{ matrix.arch }}-test.tar.gz
# tag_name: ${{ github.event.release.tag_name }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 18 additions & 14 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
release:
types: [created]
push:
branches:
- fix-build2
jobs:
build:
runs-on: macos-latest
Expand All @@ -19,7 +20,10 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}


- name: Install dependencies
run: brew install ninja

- name: Build Qode binary
run: TARGET_ARCH=${{ matrix.arch }} node build.js
env:
Expand All @@ -29,20 +33,20 @@ jobs:
uses: a7ul/tar-action@v1.0.2
with:
command: c
cwd: ./node/out/Release
cwd: ./out/Release
files: |
./qode
outPath: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz
outPath: qode-darwin-${{ matrix.arch }}-test.tar.gz

- uses: actions/upload-artifact@v1
with:
name: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz
path: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz
name: qode-darwin-${{ matrix.arch }}-test.tar.gz
path: qode-darwin-${{ matrix.arch }}-test.tar.gz

- name: Release
uses: softprops/action-gh-release@master
with:
files: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Release
# uses: softprops/action-gh-release@master
# with:
# files: qode-darwin-${{ matrix.arch }}-test.tar.gz
# tag_name: ${{ github.event.release.tag_name }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 18 additions & 14 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
on:
release:
types: [created]
push:
branches:
- fix-build2
jobs:
build:
runs-on: windows-2016
runs-on: windows-2019
steps:
- uses: actions/setup-node@master
with:
Expand All @@ -14,6 +15,9 @@ jobs:
python-version: 3.8
- name: "Setup NASM for windows"
uses: ilammy/setup-nasm@v1

- name: "Install deps"
run: choco install ninja

- uses: actions/checkout@v2
with:
Expand All @@ -29,22 +33,22 @@ jobs:
id: compress
with:
command: c
cwd: ./node/out/Release
cwd: ./out/Release
files: |
./qode.exe
./qode.lib
./qode.exp
outPath: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz
outPath: qode-win32-x64-test.tar.gz

- uses: actions/upload-artifact@v1
with:
name: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz
path: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz
name: qode-win32-x64-test.tar.gz
path: qode-win32-x64-test.tar.gz

- name: Release
uses: softprops/action-gh-release@master
with:
files: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Release
# uses: softprops/action-gh-release@master
# with:
# files: qode-win32-x64-test.tar.gz
# tag_name: ${{ github.event.release.tag_name }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.swp
/out
/out2
.vscode
*.vcproj
arch.gypi
98 changes: 65 additions & 33 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const path = require("path");
const os = require("os");
const cp = require('child_process');
const fs = require('fs');
const cp = require("child_process");
const fs = require("fs");
const HOST_ARCH = os.arch();

//==================================
Expand Down Expand Up @@ -44,57 +44,89 @@ if (process.env.SYNC_GIT_SUBMODULE) {
}

// Find out where VS is installed.
if (process.platform === 'win32') {
const vswhere = path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
const args = ['-format', 'json']
const result = JSON.parse(String(cp.execFileSync(vswhere, args)))
if (result.length == 0)
throw new Error('Unable to find Visual Studio')
const vs = result[0]
process.env.GYP_MSVS_VERSION = vs.displayName.match(/(\d+)$/)[1]
process.env.GYP_MSVS_OVERRIDE_PATH = vs.installationPath
if (process.platform === "win32") {
const vswhere = path.join(
process.env["ProgramFiles(x86)"],
"Microsoft Visual Studio",
"Installer",
"vswhere.exe"
);
const args = ["-format", "json"];
const result = JSON.parse(String(cp.execFileSync(vswhere, args)));
if (result.length == 0) throw new Error("Unable to find Visual Studio");
const vs = result[0];
process.env.GYP_MSVS_VERSION = vs.displayName.match(/(\d+)$/)[1];
process.env.GYP_MSVS_OVERRIDE_PATH = vs.installationPath;
}

// Required for cross compilation on macOS.
if (host_arch !== target_arch && process.platform === 'darwin') {
process.env.GYP_CROSSCOMPILE = '1'
if (host_arch !== target_arch && ["darwin"].includes(process.platform)) {
function archConvert(arch = "arm64") {
if (arch === "arm64") {
return "arm64";
}
return "x86_64";
}
process.env.GYP_CROSSCOMPILE = "1";
const compileTargetArch = archConvert(target_arch);
const compileHostArch = archConvert(host_arch);
Object.assign(process.env, {
CC: `cc -arch ${target_arch}`,
CXX: `c++ -arch ${target_arch}`,
CC_target: `cc -arch ${target_arch}`,
CXX_target: `c++ -arch ${target_arch}`,
CC_host: 'cc -arch x86_64',
CXX_host: 'c++ -arch x86_64',
})
CC: `cc -arch ${compileTargetArch}`,
CXX: `c++ -arch ${compileTargetArch}`,
CC_target: `cc -arch ${compileTargetArch}`,
CXX_target: `c++ -arch ${compileTargetArch}`,
CC_host: `cc -arch ${compileHostArch}`,
CXX_host: `c++ -arch ${compileHostArch}`,
});
}

// Required for cross compilation on linux.
if (host_arch !== target_arch && ["linux"].includes(process.platform)) {
process.env.GYP_CROSSCOMPILE = "1";
Object.assign(process.env, {
CC: `aarch64-linux-gnu-gcc`,
CXX: `aarch64-linux-gnu-g++`,
CC_target: `aarch64-linux-gnu-gcc`,
CXX_target: `aarch64-linux-gnu-g++`,
CC_host: `gcc`,
CXX_host: `g++`,
});
}

// Generate some dynamic gyp files.
execSync(`python3 configure --with-intl=small-icu --openssl-no-asm --dest-cpu=${target_arch}`, {
cwd: "node"
});
execSync(
`python3 configure --with-intl=small-icu --openssl-no-asm --dest-cpu=${target_arch}`,
{
cwd: "node",
}
);
// Update the build configuration.
const config = {
variables: {
target_arch,
host_arch,
want_separate_host_toolset: host_arch === target_arch ? 0 : 1
}
}
if (process.platform === 'darwin') {
want_separate_host_toolset: host_arch === target_arch ? 0 : 1,
},
};
if (process.platform === "darwin") {
// Set SDK version to the latest installed.
const sdks = String(execSync('xcodebuild -showsdks', {stdio: null})).trim()
const SDKROOT = sdks.match(/-sdk (macosx\d+\.\d+)/)[1]
config.xcode_settings = {SDKROOT}
const sdks = String(execSync("xcodebuild -showsdks", { stdio: null })).trim();
const SDKROOT = sdks.match(/-sdk (macosx\d+\.\d+)/)[1];
config.xcode_settings = { SDKROOT };
}
fs.writeFileSync(path.join(__dirname, 'arch.gypi'), JSON.stringify(config, null, ' '))
execSync('python3 node/tools/gyp/gyp_main.py qode.gyp --no-parallel -f ninja -Iarch.gypi -Icommon.gypi --depth .')
fs.writeFileSync(
path.join(__dirname, "arch.gypi"),
JSON.stringify(config, null, " ")
);
execSync(
"python3 node/tools/gyp/gyp_main.py qode.gyp --no-parallel -f ninja -Iarch.gypi -Icommon.gypi --depth ."
);

// Build.
const epath = `${path.join("..", "bin", "ninja")}${path.delimiter}${
process.env.PATH
}`;

execSync(`ninja -j${os.cpus().length} -C out/Release qode`, {
env: { PATH: epath }
env: { PATH: epath },
});
2 changes: 1 addition & 1 deletion node
Submodule node updated from af564e to 9aaac5
4 changes: 2 additions & 2 deletions qode.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
'src/integration/node_integration_linux.cc',
],
'libraries': [
'<!@(pkg-config gtk+-3.0 --libs)',
'<!@(pkg-config glib-2.0 --libs)',
],
'include_dirs': [
'<!@(pkg-config gtk+-3.0 --cflags-only-I | sed s/-I//g)',
'<!@(pkg-config glib-2.0 --cflags-only-I | sed s/-I//g)',
],
# Force loading all objects of node, otherwise some built-in modules
# won't load.
Expand Down
3 changes: 1 addition & 2 deletions src/integration/node_integration_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// Use of this source code is governed by the MIT license.

#include "src/integration/node_integration_linux.h"

#include <gtk/gtk.h>
#include <glib.h>
#include <sys/epoll.h>

namespace qode {
Expand Down