Merge pull request #239 from mcorino/develop #47
Workflow file for this run
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
# CI wxRuby release workflow | |
name: Release build | |
on: | |
push: | |
tags: | |
- v* | |
paths-ignore: | |
- '.github/workflows/**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
release: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
ruby: '3.2' | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} wxRuby Release (${{ github.ref_name }}) | |
env: | |
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
outputs: | |
version: ${{ steps.version_var.outputs.WXRUBY_VERSION }} | |
prerelease: ${{ steps.version_var.outputs.WXRUBY_PRERELEASE }} | |
steps: | |
- name: Checkout wxRuby3 | |
uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Setup Ruby gems | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle install | |
- name: Build wxRuby3 gem | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle exec rake gem | |
- name: Upload gem to release | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: pkg/*.gem | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
- name: Publish Gem on RubyGems | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
gem push pkg/*.gem | |
- name: Set version variables | |
id: version_var | |
run: | | |
echo "WXRUBY_VERSION=${GITHUB_REF_NAME/#v/}" >> "$GITHUB_OUTPUT" | |
if grep -q "\-[a-zA-Z]" <<< "$GITHUB_REF_NAME" ; then | |
echo "WXRUBY_PRERELEASE=1" >> "$GITHUB_OUTPUT" | |
else | |
echo "WXRUBY_PRERELEASE=0" >> "$GITHUB_OUTPUT" | |
fi | |
verify-gem: | |
needs: release | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
gtk_version: 3 | |
CC: gcc-12 | |
CXX: g++-12 | |
ruby: '3.2' | |
wxWidgets: '3.2.4' | |
swig: '4' | |
configure_flags: | |
use_xvfb: true | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} wxRuby Gem Test (${{ github.ref_name }}) | |
env: | |
WXWIDGETS_ROOT: ${{ github.workspace }}/ext/wxWidgets | |
WXWIN_INSTALL: ${{ github.workspace }}/ext/wxWidgets/install | |
wxGTK_VERSION: ${{ matrix.gtk_version && matrix.gtk_version || 3 }} | |
wxCONFIGURE_FLAGS: ${{ matrix.configure_flags }} | |
wxUSE_ASAN: ${{ matrix.use_asan && 1 || 0 }} | |
wxUSE_XVFB: ${{ matrix.use_xvfb && 1 || 0 }} | |
WX_EXTRA_PACKAGES: doxygen patchelf | |
CC: ${{ matrix.CC }} | |
CXX: ${{ matrix.CXX }} | |
WXRUBY_VERSION: ${{ needs.release.outputs.version }} | |
WXRUBY_PRERELEASE: ${{ needs.release.outputs.prerelease }} | |
steps: | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: checkout wxWidgets | |
uses: actions/checkout@v4 | |
with: | |
repository: wxWidgets/wxWidgets | |
path: ${{ env.WXWIDGETS_ROOT }} | |
ref: v${{ matrix.wxWidgets }} | |
submodules: 'recursive' | |
- name: Set up build environment | |
run: | | |
# Install locales used by our tests to run all the tests instead of | |
# skipping them. | |
sudo locale-gen de_DE.utf8 de_CH.utf8 en_US.utf8 fr_FR.utf8 sv_SE.utf8 | |
$WXWIDGETS_ROOT/build/tools/before_install.sh | |
- name: Display build environment | |
run: | | |
echo $PATH | |
ruby -v | |
doxygen -v | |
gcc -v | |
g++ -v | |
- name: Configuring wxWidgets | |
working-directory: ${{ env.WXWIDGETS_ROOT }} | |
run: | | |
wxCONFIGURE_OPTIONS="$wxCONFIGURE_FLAGS" | |
if [ -n "${{ matrix.gtk_version }}" ]; then | |
wxCONFIGURE_OPTIONS="--with-gtk=${{ matrix.gtk_version }} $wxCONFIGURE_OPTIONS" | |
fi | |
./configure $wxCONFIGURE_OPTIONS --disable-tests --without-subdirs --disable-debug_info || rc=$? | |
if [ -n "$rc" ]; then | |
echo '*** Configuring failed, contents of config.log follows: ***' | |
echo '-----------------------------------------------------------' | |
cat $WXWIDGETS_ROOT/config.log | |
echo '-----------------------------------------------------------' | |
exit $rc | |
fi | |
- name: Build and install wxWidgets | |
working-directory: ${{ env.WXWIDGETS_ROOT }} | |
run: | | |
make && sudo make install && sudo ldconfig | |
- name: Remove wxWidgets | |
run: | | |
rm -rf $WXWIDGETS_ROOT | |
- name: Install wxRuby3 gem | |
run: | | |
if [ "$WXRUBY_PRERELEASE" == "1" ]; then | |
BUILD_CMD="gem install wxruby3 -v $WXRUBY_VERSION --pre" | |
else | |
BUILD_CMD="gem install wxruby3 -v $WXRUBY_VERSION" | |
fi | |
/bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' $BUILD_CMD 2>&1 | tee -a gembuild.out" || rc=$? | |
if [ -n "$rc" ]; then | |
if fgrep -q '(core dumped)' gembuild.out; then | |
echo '*** Test crashed, trying to get more information ***' | |
gdb --quiet --core=core -ex 'where' -ex 'thread apply all bt' -ex 'q' --args $BUILD_CMD | |
fi | |
exit $rc | |
fi | |
- name: Run wxRuby3 regression tests | |
run: | | |
ulimit -c unlimited | |
TEST_CMD="wxruby test" | |
/bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' $TEST_CMD 2>&1 | tee -a wxtest.out" || rc=$? | |
if [ -n "$rc" ]; then | |
if fgrep -q '(core dumped)' wxtest.out; then | |
echo '*** Test crashed, trying to get more information ***' | |
gdb --quiet --core=core -ex 'where' -ex 'thread apply all bt' -ex 'q' --args $TEST_CMD | |
fi | |
exit $rc | |
fi | |
verify-gem-mac: | |
needs: release | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: wxMac macOS 13 | |
runner: macos-13 | |
arch: x86_64 | |
wxWidgets: '3.2.4' | |
ruby: '3.2' | |
swig: '4' | |
configure_flags: --disable-sys-libs | |
runs-on: ${{ matrix.runner }} | |
name: ${{ matrix.name }} wxRuby Gem Test (${{ github.ref_name }}) | |
env: | |
NSUnbufferedIO: YES | |
WXWIDGETS_ROOT: ${{ github.workspace }}/ext/wxWidgets | |
WXWIN_INSTALL: ${{ github.workspace }}/ext/wxWidgets/install | |
WXRUBY_VERSION: ${{ needs.release.outputs.version }} | |
WXRUBY_PRERELEASE: ${{ needs.release.outputs.prerelease }} | |
steps: | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: checkout wxWidgets | |
uses: actions/checkout@v4 | |
with: | |
repository: wxWidgets/wxWidgets | |
path: ${{ env.WXWIDGETS_ROOT }} | |
ref: v${{ matrix.wxWidgets }} | |
- name: Set environment variables | |
run: | | |
echo TZ=UTC >> $GITHUB_ENV | |
echo LD_LIBRARY_PATH=`pwd`/lib >> $GITHUB_ENV | |
- name: Before install | |
working-directory: ${{ env.WXWIDGETS_ROOT }} | |
run: | | |
./build/tools/before_install.sh | |
- name: Install SWIG | |
run: | | |
brew install swig | |
- name: Install doxygen | |
run: | | |
brew install doxygen | |
- name: Show build environment | |
run: | | |
echo "Environment:" | |
env | sort | |
echo | |
echo "Ruby version:" | |
ruby -v | |
echo | |
echo "SWIG version:" | |
swig -version | |
echo | |
echo "Doxygen version:" | |
doxygen -v | |
echo | |
echo "Compiler version:" | |
${CXX-g++} --version | |
echo | |
- name: Remove wxWidgets | |
run: | | |
rm -rf $WXWIDGETS_ROOT | |
- name: Install wxRuby3 gem | |
run: | | |
if [ "$WXRUBY_PRERELEASE" == "1" ]; then | |
gem install wxruby3 -v $WXRUBY_VERSION --pre -- WITH_WXWIN=1 | |
else | |
gem install wxruby3 -v $WXRUBY_VERSION -- WITH_WXWIN=1 | |
fi | |
- name: Run wxRuby3 regression tests | |
run: | | |
wxruby test | |
release-bingem: | |
needs: release | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} wxRuby Bingem Release (${{ github.ref_name }}) | |
env: | |
DOXYGEN_ROOT: ${{ github.workspace }}\doxygen | |
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2022 | |
platform: 'x64' | |
CXX: g++-12 | |
ruby: '3.2' | |
wxWidgets: '3.2.4' | |
swig: '4' | |
steps: | |
- name: Checkout wxRuby3 | |
uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Setup Ruby gems | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle install | |
- name: Cache Doxygen | |
id: cache-doxygen | |
uses: actions/cache@v3 | |
with: | |
path: doxygen-1.10.0.windows.x64.bin.zip | |
key: ${{ runner.os }}-doxygen | |
- name: Download Doxygen tool | |
if: steps.cache-doxygen.outputs.cache-hit != 'true' | |
run: | | |
wget.exe https://www.doxygen.nl/files/doxygen-1.10.0.windows.x64.bin.zip | |
$hash = '2135c1d5bdd6e067b3d0c40a4daac5d63d0fee1b3f4d6ef1e4f092db0d632d5b' | |
if ((Get-FileHash doxygen-1.10.0.windows.x64.bin.zip -Algorithm SHA256).Hash -ne $hash) { | |
del doxygen-1.10.0.windows.x64.bin.zip | |
throw "Doxygen Hash doesn't match!" | |
} | |
- name: Install Doxygen package | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
Expand-Archive -LiteralPath '.\doxygen-1.10.0.windows.x64.bin.zip' -DestinationPath $env:DOXYGEN_ROOT -Force | |
echo "$env:DOXYGEN_ROOT" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Display build environment | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
echo "$env:PATH" | |
ruby -v | |
doxygen -v | |
ridk exec bash -c 'gcc -v' | |
ridk exec bash -c 'g++ -v' | |
- name: Configure wxRuby3 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle exec rake configure[--with-wxwin] | |
- name: Build wxRuby3 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle exec rake build | |
- name: Build wxRuby3 gem | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
bundle exec rake bingem | |
- name: Publish Gem on RubyGems | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
gem push pkg/*.gem | |
verify-bingem: | |
needs: [release, release-bingem] | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} wxRuby Bingem Test (${{ github.ref_name }}) | |
env: | |
WXRUBY_VERSION: ${{ needs.release.outputs.version }} | |
WXRUBY_PRERELEASE: ${{ needs.release.outputs.prerelease }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2022 | |
platform: 'x64' | |
CXX: g++-12 | |
ruby: '3.2' | |
wxWidgets: '3.2.4' | |
swig: '4' | |
steps: | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Wait for RubyGems | |
run: | | |
Start-Sleep -Seconds 300 | |
- name: Install wxRuby3 gem | |
if: matrix.wxr_type != 'develop' | |
run: | | |
If ("$env:WXRUBY_PRERELEASE" -eq "1") { | |
gem install wxruby3 -v $env:WXRUBY_VERSION --pre | |
} | |
Else { | |
gem install wxruby3 -v $env:WXRUBY_VERSION | |
} | |
- name: Run wxRuby3 regression tests | |
run: | | |
wxruby test |