Skip to content

Commit

Permalink
updating GitHub pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Sep 16, 2024
1 parent 4ce3500 commit 494b6d7
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 155 deletions.
34 changes: 34 additions & 0 deletions .github/actions/create-test-report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Test report'
description: 'Create test report'
inputs:
electron:
description: 'Electron version'
required: true
os:
description: 'runs-on'
required: true

runs:
using: "composite"
steps:
- name: "Merge test files"
shell: bash
run: node tools/mergeTests.js

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ inputs.os }}-${{ inputs.electron }}
path: |
test/mochawesome-report/mochawesome.json
test/mochawesome-report/mochawesome.html
- name: Create test report
uses: phoenix-actions/test-reporting@v15
if: success()
with:
name: test-results-${{ inputs.os }}-v${{ inputs.electron }}
fail-on-error: true
path: test/mochawesome-report/mochawesome.json # Path to test results
reporter: mochawesome-json
65 changes: 23 additions & 42 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'Checkout and setup'
description: 'Checks out code and sets up environment'
name: 'Setup environment'
description: 'Sets up environment'
inputs:
node:
description: 'Node.js version'
required: false
default: '20'
runs-on:
description: 'Runner OS'
os:
description: 'runs-on'
required: false
default: 'windows-2022'
electron:
Expand All @@ -20,38 +20,16 @@ inputs:
runs:
using: "composite"
steps:
# - name: Checkout code
# uses: actions/checkout@v4

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node }}
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: ${{ inputs.runs-on }}-${{ inputs.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
shell: bash
run: |
node -v && npm -v && dotnet --version && node -p process.platform && node -p process.arch

- name: "Read JSON"
- name: Read package.json
uses: actions/github-script@v7
id: check-env
with:
result-encoding: string
script: |
Expand All @@ -70,25 +48,28 @@ runs:
if: ${{ inputs.replace-version == 'true' }}
run: |
sed -i -e 's/${{ env.json_electron_version}}/=${{ inputs.electron }}/g' package.json
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ inputs.os }}-${{ inputs.electron }}-${{ hashFiles('package.json') }}

# - if: runner.os == 'Windows'
# uses: agracio/[email protected]
# id: electron_version
# with:
# value: "${{ matrix.electron }}"
# length_from_start: 2
- 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

# - if: runner.os == 'Windows'
# name: Check electron-edge-js Windows pre-built files
# id: check_windows_build
# uses: andstor/file-existence-action@v3
# with:
# files: "lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_coreclr.node, lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_nativeclr.node"
# fail: true
# ignore_case: true
- name: Versions
shell: bash
run: |
node -v && npm -v && dotnet --version && node -p process.platform && node -p process.arch
- name: npm install
shell: bash
run: npm ci
run: npm i
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
33 changes: 33 additions & 0 deletions .github/actions/test-windows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Test Windows'
description: 'Runs Windows tests'
inputs:
electron:
description: 'Electron version'
required: true

runs:
using: "composite"
steps:
- uses: agracio/[email protected]
id: electron_version
with:
value: "${{ inputs.electron }}"
length_from_start: 2

- name: Check electron-edge-js Windows pre-built files
uses: andstor/file-existence-action@v3
with:
files: "lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_coreclr.node, lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_nativeclr.node"
fail: true
ignore_case: true

- name: Run .NET 4.5 tests Windows
shell: bash
run: node tools/test.js CI

- if: runner.os == 'Windows'
shell: bash
name: "Run .net core tests Windows"
run: node tools/test.js CI
env:
EDGE_USE_CORECLR: 1
54 changes: 29 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,7 @@ jobs:
uses: ./.github/actions/setup-env
with:
electron: ${{ matrix.electron }}
replace-version: true

- name: Read package.json
uses: actions/github-script@v7
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.toString())
} catch(err) {
core.error("Error while reading or parsing package.json")
core.setFailed(err)
}

- name: install node-gyp
run: npm i -g node-gyp

Expand All @@ -60,17 +44,19 @@ jobs:
- name: Build ia32
timeout-minutes: 30
shell: cmd
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
copy /y build\Release\edge_*.node release\ia32\${{ matrix.electron }}
rmdir /S /Q build
- name: Build x64
timeout-minutes: 30
shell: cmd
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
copy /y build\Release\edge_*.node release\x64\${{ matrix.electron }}
rmdir /S /Q build
- name: Build arm64
timeout-minutes: 30
Expand Down Expand Up @@ -123,17 +109,35 @@ jobs:
length_from_start: 2

- name: Create release folder
shell: cmd
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"
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"
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"
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 artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: ${{ steps.electron_version.outputs.substring }}.0.0*

- run: ls -R release
- run: ls -R

- name: Copy artifacts
shell: cmd
run: |
copy /y release\${{ steps.electron_version.outputs.substring }}.0.0\x64\${{ steps.electron_version.outputs.substring }}.0.0\edge_*.node lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0
- name: Test
timeout-minutes: 10
uses: ./.github/actions/test-windows
with:
electron: ${{ matrix.electron }}


- name: Test report
uses: ./.github/actions/create-test-report
with:
electron: ${{ matrix.electron }}


Loading

0 comments on commit 494b6d7

Please sign in to comment.