From ef075489b40b7ec40da0730feaf510b0786e0daf Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 25 Apr 2022 18:58:34 +0100 Subject: [PATCH] Upgrade node-kaytar for modern Visual Studio support & CI native building (#347) --- .github/workflows/build.yaml | 125 +++++++++++++++++++++++++++++++++++ hak/matrix-seshat/build.ts | 8 +-- hak/matrix-seshat/check.ts | 1 + package.json | 4 +- 4 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..f1ead7c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,125 @@ +name: Build +on: + pull_request: { } + push: + branches: [ develop, master ] +jobs: + windows: + name: Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - name: Cache .hak + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-${{ hashFiles('./yarn.lock') }} + path: | + ./.hak + + - name: Install nmake + uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Microsoft Build Tools + uses: microsoft/setup-msbuild@v1.1 + + # ActiveTCL package on choco is from 2015, + # this one is newer but includes more than we need + - name: Choco install tclsh + shell: pwsh + run: | + choco install -y magicsplat-tcl-tk --no-progress + echo "${HOME}/AppData/Local/Apps/Tcl86/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Choco install NetWide Assembler + shell: pwsh + run: | + choco install -y nasm --no-progress + echo "C:/Program Files/NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions/setup-node@v3 + with: + cache: "yarn" + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install --pure-lockfile" + + - name: Build Natives + shell: pwsh + run: | + refreshenv + yarn build:native + + - name: Build App + run: "yarn build --publish never" + + linux: + name: Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Cache .hak + uses: actions/cache@v3 + with: + key: ${{ hashFiles('./yarn.lock') }} + path: | + ./.hak + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions/setup-node@v3 + with: + cache: "yarn" + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install --pure-lockfile" + + - name: Build Natives + run: "yarn build:native" + + - name: Build App + run: "yarn build --publish never" + + macos: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Cache .hak + uses: actions/cache@v3 + with: + key: ${{ hashFiles('./yarn.lock') }} + path: | + ./.hak + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-apple-darwin + + - uses: actions/setup-node@v3 + with: + cache: "yarn" + + # Does not need branch matching as only analyses this layer + - name: Install Deps + run: "yarn install --pure-lockfile" + + - name: Build Natives + run: "yarn build:native:universal" + + - name: Build App + run: "yarn build:universal --publish never" diff --git a/hak/matrix-seshat/build.ts b/hak/matrix-seshat/build.ts index 1558ada..3bd8601 100644 --- a/hak/matrix-seshat/build.ts +++ b/hak/matrix-seshat/build.ts @@ -32,7 +32,7 @@ export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promi await buildMatrixSeshat(hakEnv, moduleInfo); } -async function buildOpenSslWin(hakEnv, moduleInfo) { +async function buildOpenSslWin(hakEnv: HakEnv, moduleInfo: DependencyInfo) { const version = moduleInfo.cfg.dependencies.openssl; const openSslDir = path.join(moduleInfo.moduleTargetDotHakDir, `openssl-${version}`); @@ -134,7 +134,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) { }); } -async function buildSqlCipherWin(hakEnv, moduleInfo) { +async function buildSqlCipherWin(hakEnv: HakEnv, moduleInfo: DependencyInfo) { const version = moduleInfo.cfg.dependencies.sqlcipher; const sqlCipherDir = path.join(moduleInfo.moduleTargetDotHakDir, `sqlcipher-${version}`); const buildDir = path.join(sqlCipherDir, 'bld'); @@ -171,7 +171,7 @@ async function buildSqlCipherWin(hakEnv, moduleInfo) { ); } -async function buildSqlCipherUnix(hakEnv, moduleInfo) { +async function buildSqlCipherUnix(hakEnv: HakEnv, moduleInfo: DependencyInfo) { const version = moduleInfo.cfg.dependencies.sqlcipher; const sqlCipherDir = path.join(moduleInfo.moduleTargetDotHakDir, `sqlcipher-${version}`); @@ -264,7 +264,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) { }); } -async function buildMatrixSeshat(hakEnv, moduleInfo) { +async function buildMatrixSeshat(hakEnv: HakEnv, moduleInfo: DependencyInfo) { // seshat now uses n-api so we shouldn't need to specify a node version to // build against, but it does seems to still need something in here, so leaving // it for now: we should confirm how much of this it still actually needs. diff --git a/hak/matrix-seshat/check.ts b/hak/matrix-seshat/check.ts index ad6533a..1479418 100644 --- a/hak/matrix-seshat/check.ts +++ b/hak/matrix-seshat/check.ts @@ -42,6 +42,7 @@ export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promi ]; if (hakEnv.isWin()) { tools.push(['perl', '--version']); // for openssl configure + tools.push(['nasm', '-v']); // for openssl building tools.push(['patch', '--version']); // to patch sqlcipher Makefile.msc tools.push(['nmake', '/?']); } else { diff --git a/package.json b/package.json index 41ff920..a7f00f3 100644 --- a/package.json +++ b/package.json @@ -84,8 +84,8 @@ "typescript": "4.5.5" }, "hakDependencies": { - "matrix-seshat": "^2.3.0", - "keytar": "^5.6.0" + "matrix-seshat": "^2.3.3", + "keytar": "^7.9.0" }, "build": { "appId": "im.riot.app",