Try building samples in a matrix

This commit is contained in:
Caelan Sayler
2024-11-09 10:59:01 +00:00
committed by Caelan
parent 5d3455f0b8
commit 92ebe96d74
10 changed files with 143 additions and 92 deletions

View File

@@ -151,6 +151,7 @@ jobs:
test-bins:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
include:
@@ -166,6 +167,14 @@ jobs:
key: "rust-test-${{ matrix.os }}"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Check lib-rust
run: cargo check -p velopack -F async,delta
- name: Check lib-nodejs
working-directory: src/lib-nodejs
run: |
npm install
npm run build
npm run test
- name: Test Rust
run: cargo llvm-cov ${{ matrix.rust_flags }} --cobertura --output-path ./test/coverage.rust.${{ matrix.os }}.xml
- name: Upload Coverage
@@ -173,51 +182,92 @@ jobs:
with:
files: ./test/coverage.rust.${{ matrix.os }}.xml
check-libs:
# check-libs:
# strategy:
# fail-fast: false
# matrix:
# os: [macos-latest, windows-latest, ubuntu-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Check lib-rust
# run: cargo check -p velopack -F async,delta
# # - name: Check RustIced Sample
# # working-directory: samples/RustIced
# # run: cargo check
# - name: Check lib-nodejs
# working-directory: src/lib-nodejs
# run: |
# npm install
# npm run build
# npm run test
# # - name: Check NodeJSElectron Sample
# # working-directory: samples/NodeJSElectron
# # run: |
# # npm install
# # npm run typecheck
# # - name: Check CPlusPlusWin32 Sample
# # working-directory: samples/CPlusPlusWin32
# # run: |
# # dotnet tool install -g vpk
# # .\build.bat 1.0.0
# # if: ${{ matrix.os == 'windows-latest' }}
# # - name: Install CPlusPlusWidgets Dependencies
# # run: |
# # sudo apt-cache search libwxgt*
# # sudo apt install -y libwxgtk3.0-dev
# # if: ${{ matrix.os == 'ubuntu-latest' }}
# # - name: Check CPlusPlusWidgets Sample
# # working-directory: samples/CPlusPlusWidgets
# # run: |
# # cargo build -p velopack_libc
# # cmake -S . -B build-rel -D CMAKE_BUILD_TYPE=Release
# # cmake --build build-rel -j --config Release
check-samples:
strategy:
fail-fast: false
matrix:
sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpWpf, NodeJSElectron, RustIced]
os: [macos-latest, windows-latest, ubuntu-latest]
exclude:
- os: ubuntu-latest
sample: CPlusPlusWin32
- os: macos-latest
sample: CPlusPlusWin32
- os: ubuntu-latest
sample: CSharpWpf
- os: macos-latest
sample: CSharpWpf
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check lib-rust
run: cargo check -p velopack -F async,delta
- name: Check RustIced Sample
working-directory: samples/RustIced
run: cargo check
- name: Check lib-nodejs
working-directory: src/lib-nodejs
run: |
npm install
npm run build
npm run test
- name: Check NodeJSElectron Sample
working-directory: samples/NodeJSElectron
run: |
npm install
npm run typecheck
- name: Check CPlusPlusWin32 Sample
working-directory: samples/CPlusPlusWin32
run: |
dotnet tool install -g vpk
.\build.bat 1.0.0
if: ${{ matrix.os == 'windows-latest' }}
- name: Install CPlusPlusWidgets Dependencies
- name: Install GTK3
run: |
sudo apt-cache search libwxgt*
sudo apt install -y libwxgtk3.0-dev
sudo apt-cache search libgtk*
sudo apt install -y libwxgtk3.0-gtk3-dev libgtk-3-dev
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Check CPlusPlusWidgets Sample
working-directory: samples/CPlusPlusWidgets
- name: Install VPK
run: dotnet tool install -g vpk
- name: Pack Sample (Windows)
working-directory: samples/${{ matrix.sample }}
run: .\build.bat 1.0.0
if: ${{ matrix.os == 'windows-latest' }}
- name: Pack Sample (Unix)
working-directory: samples/${{ matrix.sample }}
run: |
cargo build -p velopack_libc
cmake -S. -Bbuild-rel -DCMAKE_BUILD_TYPE=Release
cmake --build build-rel -j --config Release
chmod 755 ./build.sh
./build.sh 1.0.0
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }}
test-vpk:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
@@ -387,7 +437,7 @@ jobs:
release:
runs-on: ubuntu-latest
needs: [package, test-vpk, test-bins, check-libs]
needs: [package, test-vpk, test-bins, check-samples]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Invoke Release Workflow

View File

@@ -1,23 +0,0 @@
#!/bin/bash
# Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check if version parameter is provided
if [ "$#" -ne 1 ]; then
echo "Version number is required."
echo "Usage: ./build.sh [version]"
exit 1
fi
BUILD_VERSION="$1"
RELEASE_DIR="$SCRIPT_DIR/releases"
PUBLISH_DIR="$SCRIPT_DIR/publish"
echo ""
echo "Compiling VelopackCSharpAvalonia with dotnet..."
dotnet publish -c Release --self-contained -r linux-x64 -o "$PUBLISH_DIR"
echo ""
echo "Building Velopack Release v$BUILD_VERSION"
vpk pack -u VelopackCSharpAvalonia -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR"

View File

@@ -1,23 +0,0 @@
#!/bin/bash
# Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check if version parameter is provided
if [ "$#" -ne 1 ]; then
echo "Version number is required."
echo "Usage: ./build.sh [version]"
exit 1
fi
BUILD_VERSION="$1"
RELEASE_DIR="$SCRIPT_DIR/releases"
PUBLISH_DIR="$SCRIPT_DIR/publish"
echo ""
echo "Compiling VelopackCSharpAvalonia with dotnet..."
dotnet publish -c Release --self-contained -r osx-x64 -o "$PUBLISH_DIR"
echo ""
echo "Building Velopack Release v$BUILD_VERSION"
vpk pack -u VelopackCSharpAvalonia -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR"

View File

@@ -0,0 +1,48 @@
#!/bin/bash
# Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check if version parameter is provided
if [ "$#" -ne 1 ]; then
echo "Version number is required."
echo "Usage: ./build.sh [version]"
exit 1
fi
# Determine the default RID for the platform
RID=""
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
RID="osx-x64"
elif [[ "$ARCH" == "arm64" ]]; then
RID="osx-arm64"
fi
elif [[ "$OSTYPE" == "linux"* ]]; then
# Linux
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
RID="linux-x64"
elif [[ "$ARCH" == "aarch64" ]]; then
RID="linux-arm64"
fi
else
echo "Unsupported OS type: $OSTYPE"
exit 1
fi
echo "Using RID: $RID"
BUILD_VERSION="$1"
RELEASE_DIR="$SCRIPT_DIR/releases"
PUBLISH_DIR="$SCRIPT_DIR/publish"
echo ""
echo "Compiling VelopackCSharpAvalonia with dotnet..."
dotnet publish -c Release --self-contained -r "$RID" -o "$PUBLISH_DIR"
echo ""
echo "Building Velopack Release v$BUILD_VERSION"
vpk pack -u VelopackCSharpAvalonia -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR"

View File

@@ -9,23 +9,32 @@ if "%~1"=="" (
set "version=%~1"
cd %~dp0..\..\src\lib-nodejs
echo.
echo Running npm install
call npm install
echo.
echo Cleaning lib-nodejs
cd %~dp0..\..\src\lib-nodejs
call npm run clean
echo.
echo Compiling lib-nodejs
cd %~dp0..\..\src\lib-nodejs
call npm run dev
echo.
echo Packing lib-nodejs
call npm pack
cd %~dp0
echo.
echo Running npm install
call npm install
echo.
echo Installing lib-nodejs package
cd %~dp0
call npm install ..\..\src\lib-nodejs\velopack-0.0.0.tgz
echo.
@@ -34,14 +43,4 @@ call npm run package
echo.
echo Creating Velopack Release
call vpk pack -u VelopackElectronSample -v %version% -o %~dp0releases -p %~dp0out\VelopackElectronSample-win32-x64
@REM echo.
@REM echo Compiling VelopackCSharpWpf with dotnet...
@REM dotnet publish -c Release -o %~dp0publish
@REM
@REM echo.
@REM echo Building Velopack Release v%version%
@REM vpk pack -u VelopackCSharpWpf -v %version% -o %~dp0releases -p %~dp0publish -f net8-x64-desktop
call vpk pack -u VelopackElectronSample -v %version% -o %~dp0releases -p %~dp0out\VelopackElectronSample-win32-x64

View File