diff --git a/.github/actions/get-electron-version/action.yml b/.github/actions/get-electron-version/action.yml new file mode 100644 index 0000000..3abc934 --- /dev/null +++ b/.github/actions/get-electron-version/action.yml @@ -0,0 +1,26 @@ +name: 'Get Electron version' +description: 'Get Electron version' +inputs: + electron: + description: 'Electron version' + required: true + +runs: + using: "composite" + steps: + + - name: Resolve Electron version from major + id: electron-test-version + shell: bash + run: | + if [[ ${{ inputs.electron }} == '29' ]]; then + echo "test-version=29.4.6" >> $GITHUB_OUTPUT + elif [[ ${{ inputs.electron }} == '30' ]]; then + echo "test-version=30.5.1" >> $GITHUB_OUTPUT + elif [[ ${{ inputs.electron }} == '31' ]]; then + echo "test-version=31.7.2" >> $GITHUB_OUTPUT + elif [[ ${{ inputs.electron }} == '32' ]]; then + echo "test-version=32.2.2" >> $GITHUB_OUTPUT + elif [[ ${{ inputs.electron }} == '33' ]]; then + echo "test-version=33.0.2" >> $GITHUB_OUTPUT + fi \ No newline at end of file diff --git a/.github/actions/test-build/action.yml b/.github/actions/test-build/action.yml new file mode 100644 index 0000000..e56e028 --- /dev/null +++ b/.github/actions/test-build/action.yml @@ -0,0 +1,64 @@ +name: 'Test built Windows binary' +description: 'Test built Windows binary' +inputs: + os: + description: 'runs-on' + required: false + default: 'windows-2022' + electron: + description: 'Electron version' + required: true + +runs: + using: "composite" + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup env + uses: ./.github/actions/setup-env + with: + electron: ${{ inputs.electron }} + os: ${{ inputs.os }} + replace-version: true + + - uses: agracio/github-substring-action@v1.0.0 + id: electron_version + with: + value: ${{ inputs.electron }} + length_from_start: 2 + + - name: Create release folder + shell: pwsh + 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 artifacts + uses: actions/download-artifact@v4 + with: + path: release + pattern: electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0* + + - name: List artifacts + shell: bash + run: ls -R release + + - name: Copy artifacts + shell: pwsh + run: | + cmd /c copy /y release\electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0\x64\${{ steps.electron_version.outputs.substring }}.0.0\edge_*.node lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0 + + - name: Test + uses: ./.github/actions/test-windows + with: + electron: ${{ inputs.electron }} + + - name: Test report + uses: ./.github/actions/create-test-report + with: + electron: ${{ inputs.electron }} + os: ${{ inputs.os }} + name: 'build-tests' diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 7dd5847..e018261 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -27,20 +27,9 @@ jobs: - name: Resolve Electron version for test id: electron-test-version - shell: bash - run: | - if [[ ${{ matrix.electron }} == '29' ]]; then - echo "test-version=29.4.6" >> $GITHUB_OUTPUT - elif [[ ${{ matrix.electron }} == '30' ]]; then - echo "test-version=30.5.1" >> $GITHUB_OUTPUT - elif [[ ${{ matrix.electron }} == '31' ]]; then - echo "test-version=31.7.2" >> $GITHUB_OUTPUT - elif [[ ${{ matrix.electron }} == '32' ]]; then - echo "test-version=32.2.2" >> $GITHUB_OUTPUT - elif [[ ${{ matrix.electron }} == '33' ]]; then - echo "test-version=33.0.2" >> $GITHUB_OUTPUT - fi - + uses: ./.github/actions/get-electron-version + with: + electron: '${{ matrix.electron }}' - name: Setup env uses: ./.github/actions/setup-env @@ -93,51 +82,11 @@ jobs: name: test ${{ matrix.os }}-v${{ needs.build.outputs.test-version }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup env - uses: ./.github/actions/setup-env - with: - electron: ${{ needs.build.outputs.test-version }} - os: ${{ matrix.os }} - replace-version: true - - - uses: agracio/github-substring-action@v1.0.0 - id: electron_version - with: - value: ${{ needs.build.outputs.test-version }} - 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 artifacts - uses: actions/download-artifact@v4 - with: - path: release - pattern: electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0* - - - run: ls -R release - - - name: Copy artifacts - run: | - cmd /c copy /y release\electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0\x64\${{ steps.electron_version.outputs.substring }}.0.0\edge_*.node lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0 - - - name: Test - timeout-minutes: 10 - uses: ./.github/actions/test-windows - with: - electron: ${{ needs.build.outputs.test-version }} - - - name: Test report - uses: ./.github/actions/create-test-report + + - name: Test build + uses: ./.github/actions/test-build with: electron: ${{ needs.build.outputs.test-version }} os: ${{ matrix.os }} - name: 'build-tests' \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30760b8..2cd4c2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,19 +47,9 @@ jobs: - name: Resolve Electron version for test id: electron-test-version - shell: bash - run: | - if [[ ${{ inputs.build-version }} == '29' ]]; then - echo "test-version=29.4.6" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '30' ]]; then - echo "test-version=30.5.1" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '31' ]]; then - echo "test-version=31.7.2" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '32' ]]; then - echo "test-version=32.2.2" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '33' ]]; then - echo "test-version=33.0.2" >> $GITHUB_OUTPUT - fi + uses: ./.github/actions/get-electron-version + with: + electron: '${{ inputs.build-version }}' - name: Setup env uses: ./.github/actions/setup-env @@ -70,7 +60,6 @@ jobs: - name: install node-gyp run: npm i -g node-gyp - - name: Create release folder run: | mkdir "release\ia32\${{ inputs.build-version }}.0.0" @@ -113,51 +102,10 @@ jobs: name: test ${{ matrix.os }}-v${{ needs.build.outputs.test-version }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup env - uses: ./.github/actions/setup-env - with: - electron: ${{ needs.build.outputs.test-version }} - os: ${{ matrix.os }} - replace-version: true - - - uses: agracio/github-substring-action@v1.0.0 - id: electron_version - with: - value: ${{ needs.build.outputs.test-version }} - 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 artifacts - uses: actions/download-artifact@v4 - with: - path: release - pattern: electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0* - - - run: ls -R release - - - name: Copy artifacts - run: | - cmd /c copy /y release\electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0\x64\${{ steps.electron_version.outputs.substring }}.0.0\edge_*.node lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0 - - - name: Test - timeout-minutes: 10 - uses: ./.github/actions/test-windows - with: - electron: ${{ needs.build.outputs.test-version }} - - - name: Test report - uses: ./.github/actions/create-test-report + - name: Test build + uses: ./.github/actions/test-build with: electron: ${{ needs.build.outputs.test-version }} os: ${{ matrix.os }} - name: 'build-tests' \ No newline at end of file