Skip to content

Build

Build #12

Workflow file for this run

name: Build
on:
workflow_dispatch:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # required to setup CSC
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
runs-on: windows-2022
strategy:
fail-fast: true
matrix:
# electron: [29.0.0, 30.0.0, 31.0.0]
electron: [29.0.0]
name: build Electron-${{ matrix.electron }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: "Read JSON"
uses: actions/github-script@v7
id: check-env
with:
result-encoding: string
script: |
try {
const fs = require('fs')
const jsonString = fs.readFileSync('package.json')
var json = JSON.parse(jsonString);
core.setFailed(json.devDependencies.electron)
} catch(err) {
core.error("Error while reading or parsing the JSON")
core.setFailed(err)
}
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ matrix.electron }}-${{ hashFiles('package-lock.json') }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # SDK Version to use; x will use the latest version of the 8.0 channel
- name: Versions
run: |
node -v && npm -v && dotnet --version && node -p process.platform && node -p process.arch
- name: setup electron version
shell: bash
run: |
sed -i -e 's/"electron": "=31.6.0"/"electron": "=${{ matrix.electron }}"/g' package.json
- name: npm install
run: |
npm i
npm i -g node-gyp
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- uses: agracio/[email protected]
id: electron_version
with:
value: "${{ matrix.electron }}"
length_from_start: 2
- name: Create release folder
run: |
mkdir "release\ia32\${{ matrix.electron }}"
mkdir "release\x64\${{ matrix.electron }}"
mkdir "release\arm64\${{ matrix.electron }}"
cmd /c if not exist "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0"
- name: Build ia32
timeout-minutes: 30
run: |
node-gyp configure build --target=${{ matrix.electron }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=ia32
cmd /c copy /y build\Release\edge_*.node release\ia32\${{ matrix.electron }}
cmd /c rmdir /S /Q build
- name: Build x64
timeout-minutes: 30
run: |
node-gyp configure build --target=${{ matrix.electron }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=x64
cmd /c copy /y build\Release\edge_*.node release\x64\${{ matrix.electron }}
cmd /c rmdir /S /Q build
- name: Build arm64
timeout-minutes: 30
shell: pwsh
run: |
node-gyp configure --target=${{ matrix.electron }} --disturl=https://electronjs.org/headers --runtime=electron --release --arch=arm64
(Get-Content -Raw build/build_managed.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/build_managed.vcxproj
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
node-gyp build
cmd /c copy /y build\Release\edge_*.node release\arm64\${{ matrix.electron }}
cmd /c rmdir /S /Q build
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ matrix.electron }}
path: |
release
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
# electron: [29.4.6, 30.5.1, 31.6.0]
electron: [29.4.6]
os: [windows-2022]
fail-fast: false
name: test
steps:
- uses: agracio/[email protected]
id: electron_version
with:
value: ${{ matrix.electron }}
length_from_start: 2
- name: Create release folder
run: |
cmd /c if not exist "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0"
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: ${{ steps.electron_version.outputs.substring }}.0.0*
- run: ls -R release
- run: ls -R