adding GitHub CI pipeline #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'circleci' | ||
paths-ignore: | ||
- 'samples/*' | ||
- 'stress/*' | ||
- 'performance/*' | ||
- '.github/FUNDING.YML' | ||
- '**/*.md' | ||
- '**/*.d.ts' | ||
- '**/*.bat' | ||
- '.travis.yml' | ||
- 'Dockerfile' | ||
- '.gitconfig' | ||
- '.gitignore' | ||
- 'appveyor*.*' | ||
- 'LICENSE*' | ||
- '.idea/**' | ||
- '.vscode/**' | ||
- '*.bat' | ||
- '*.nuspec' | ||
- 'tools/nuget/*' | ||
- '.npmignore' | ||
- 'test/config.json' | ||
- 'test/double' | ||
- '.circleci' | ||
- '.circleci/*' | ||
- 'README.md' | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # required to setup CSC | ||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# os: [macos-14, macos-latest, ubuntu-latest, windows-2019] | ||
os: [ windows-2019] | ||
# electron: [29.4.6, 30.5.1, 31.6.0] | ||
electron: [32.1.0] | ||
name: test-${{ matrix.os }}-${{ matrix.electron }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- 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.os }}-${{ 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 | ||
echo "GITHUB_ARCH=$(echo node -p process.arch)" >> $GITHUB_ENV | ||
- name: setup electron version | ||
run: | | ||
sed -i -e 's/"electron": "=31.6.0"/"electron": "=${{ matrix.electron }}"/g' package.json | ||
echo $GITHUB_ARCH | ||
exit 1 | ||
- uses: bhowell2/[email protected] | ||
id: electron_version | ||
with: | ||
value: "${{ matrix.electron }}" | ||
length_from_start: 2 | ||
- if: runner.os == 'Windows' | ||
name: Check electron-edge-js build file | ||
id: check_windows_build | ||
uses: andstor/file-existence-action@v3 | ||
with: | ||
files: "lib/native/win32/${{ GITHUB_ARCH }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_coreclr.node, lib/native/win32/${{ GITHUB_ARCH }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_nativeclr.node" | ||
Check failure on line 98 in .github/workflows/main.yml GitHub Actions / TestInvalid workflow file
|
||
fail: true | ||
- name: npm install | ||
run: npm i --no-audit | ||
env: | ||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
- if: runner.os == 'macOS' || runner.os == 'Linux' | ||
name: Check electron-edge-js build file | ||
id: check_build | ||
uses: andstor/file-existence-action@v3 | ||
with: | ||
files: "build/Release/edge_coreclr.node" | ||
fail: true | ||
# - if: (runner.os == 'macOS' || runner.os == 'Linux') && steps.check_build.outputs.files_exists == 'false' | ||
# name: electron-edge-js build failed | ||
# run: | | ||
# echo "::error file=app.js::Failed to build electron-edge-js for Electron ${{ matrix.electron }}" | ||
# exit 1 | ||
# continue-on-error: true | ||
- if: runner.os == 'Windows' && steps.check_windows_build.outputs.files_exists == 'true' | ||
name: Run .NET 4.5 tests Windows | ||
run: | | ||
node tools/test.js CI | ||
echo "EDGE_USE_CORECLR=1" >> $GITHUB_ENV | ||
node tools/test.js CI | ||
# - if: runner.os == 'Windows' | ||
# name: "Run .net core tests Windows" | ||
# run: node tools/test.js CI | ||
# env: | ||
# EDGE_USE_CORECLR: 1 | ||
- if: runner.os == 'macOS' && steps.check_build.outputs.files_exists == 'true' | ||
name: "Run .net core tests macOS" | ||
run: node tools/test.js CI | ||
env: | ||
EDGE_USE_CORECLR: 1 | ||
- if: runner.os == 'Linux' && steps.check_build.outputs.files_exists == 'true' | ||
name: "Run .net core tests Linux" | ||
run: | | ||
export DISPLAY=:99 | ||
echo "DISPLAY=:99" >> $GITHUB_ENV | ||
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | ||
sleep 3 | ||
node tools/test.js CI | ||
env: | ||
EDGE_USE_CORECLR: 1 | ||
- if: steps.check_build.outputs.files_exists == 'true' || runner.os == 'Windows' | ||
name: "Merge test files" | ||
run: node tools/mergeTests.js | ||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
if: success() && (steps.check_build.outputs.files_exists == 'true' || runner.os == 'Windows') | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.electron }} | ||
path: | | ||
test/mochawesome-report/mochawesome.json | ||
test/mochawesome-report/mochawesome.html | ||
- name: Create test report | ||
uses: phoenix-actions/test-reporting@v15 | ||
if: success() && (steps.check_build.outputs.files_exists == 'true' || runner.os == 'Windows') | ||
with: | ||
name: test-results-${{ matrix.os }}-${{ matrix.electron }} | ||
fail-on-error: true | ||
path: test/mochawesome-report/mochawesome.json # Path to test results | ||
reporter: mochawesome-json | ||