Package Test #15
This file contains hidden or 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: Package Test | |
on: workflow_dispatch | |
jobs: | |
package: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-13, macos-13-xlarge, windows-2022] | |
version: [ | |
{ node: 22.18.0, electron: 38.0.0, openssl: 1.1.1w } | |
] | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version.node }} | |
cache: 'npm' | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup (linux) | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget zlib1g-dev | |
echo "npm_config_openssl_dir=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build" >> "$GITHUB_ENV" | |
- name: Cache Openssl (linux) | |
if: matrix.os == 'ubuntu-22.04' | |
id: cache-openssl | |
uses: actions/cache@v4 | |
with: | |
path: openssl-${{ matrix.version.openssl }} | |
key: ${{ runner.os }}-openssl-${{ matrix.version.openssl }} | |
- name: Build Openssl (linux) | |
if: matrix.os == 'ubuntu-22.04' && steps.cache-openssl.outputs.cache-hit != 'true' | |
run: | | |
wget -qO- https://www.openssl.org/source/openssl-${{ matrix.version.openssl }}.tar.gz | tar -xz | |
cd openssl-${{ matrix.version.openssl }} | |
./config --prefix=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build --openssldir=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build | |
make | |
make install | |
- name: Setup (macos) | |
if: matrix.os == 'macos-13' | |
run: | | |
echo "npm_config_openssl_dir=/usr/local/opt/[email protected]" >> "$GITHUB_ENV" | |
- name: Setup (macos arm64) | |
if: matrix.os == 'macos-13-xlarge' | |
run: | | |
OPENSSL_LOCATION="npm_config_openssl_dir=$(brew --cellar [email protected])/${{ matrix.version.openssl }}" | |
echo $OPENSSL_LOCATION | |
echo $OPENSSL_LOCATION >> "$GITHUB_ENV" | |
- name: Setup (windows) | |
if: matrix.os == 'windows-2022' | |
run: | | |
choco install openssl --version 1.1.1.2100 --allow-downgrade -y --no-progress | |
echo "npm_config_msvs_version=2022" >> $env:GITHUB_ENV | |
echo "npm_config_openssl_dir=C:\Program Files\OpenSSL" >> $env:GITHUB_ENV | |
- name: Install | |
env: | |
NODEGIT_OPENSSL_STATIC_LINK: 1 | |
run: npm ci --runtime=electron --target=${{ matrix.version.electron }} --disturl=https://electronjs.org/headers --build_from_source=true | |
- name: Deploy | |
run: | | |
node lifecycleScripts/clean | |
npx node-pre-gyp package --runtime=electron --target=${{ matrix.version.electron }} | |
- name: Prepare artifact for upload | |
run: | | |
touch artifact.tar.gz | |
tar -zcf artifact.tar.gz --exclude=artifact.tar.gz . | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-package | |
path: ${{ matrix.os }}-artifact.tar.gz | |
if-no-files-found: error | |
retention-days: 5 |