From 0e63aea8f321527a7730a34baff4572c181e702a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 15:27:41 +0100 Subject: [PATCH 001/168] adding Cirrus CI --- .cirrus.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 2 ++ .github/workflows/mac.yml | 2 ++ .github/workflows/msw.yml | 2 ++ 4 files changed, 37 insertions(+) create mode 100644 .cirrus.yml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..3efe5402 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,31 @@ +# Continuous integration tasks running on Cirrus CI. +# + +task: + skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" + matrix: + - name: Cirrus CI / Fedora 39 + container: + image: fedora:39 + env: + osname: linux + distro: fedora + arch: amd64 + + before_script: | + + sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi + + curl -sSL https://rvm.io/mpapis.asc | gpg --import - + \curl -sSL https://get.rvm.io | bash -s head + export PATH="$PATH:$HOME/.rvm/bin" + . ~/.rvm/scripts/rvm && rvm install ruby-3.2 + . ~/.rvm/scripts/rvm && rvm alias create default ruby-3.2 + + # Show some information about the system. + uname -a + c++ --version + locale + locale -a + + ruby -v diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ff5a8dcc..82e5abf2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -12,6 +12,7 @@ on: - 'lib/wx/doc/**' - 'lib/wx/version.rb' - '**.md' + - '.cirrus.yml' pull_request: branches: - master @@ -26,6 +27,7 @@ on: - '.yardopts' - '.gitignore' - 'LICENSE' + - '.cirrus.yml' workflow_dispatch: concurrency: diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index ae7a35e1..fe404436 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -12,6 +12,7 @@ on: - 'lib/wx/doc/**' - 'lib/wx/version.rb' - '**.md' + - '.cirrus.yml' pull_request: branches: - master @@ -26,6 +27,7 @@ on: - '.yardopts' - '.gitignore' - 'LICENSE' + - '.cirrus.yml' workflow_dispatch: concurrency: diff --git a/.github/workflows/msw.yml b/.github/workflows/msw.yml index 5fcba111..ab6100da 100644 --- a/.github/workflows/msw.yml +++ b/.github/workflows/msw.yml @@ -13,6 +13,7 @@ on: - 'lib/wx/doc/**' - 'lib/wx/version.rb' - '**.md' + - '.cirrus.yml' pull_request: branches: - master @@ -27,6 +28,7 @@ on: - '.yardopts' - '.gitignore' - 'LICENSE' + - '.cirrus.yml' workflow_dispatch: concurrency: From e6ef770d3547abecd916439f999fe5cdf88d6994 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 15:35:03 +0100 Subject: [PATCH 002/168] update Cirrus CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3efe5402..c4f35685 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,7 @@ task: before_script: | - sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi + sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make curl -sSL https://rvm.io/mpapis.asc | gpg --import - \curl -sSL https://get.rvm.io | bash -s head From 7109205d45101d447f8f6579a858c2ff047bdb89 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 15:49:48 +0100 Subject: [PATCH 003/168] update Cirrus CI --- .cirrus.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c4f35685..2b1ac30f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -16,16 +16,23 @@ task: sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make - curl -sSL https://rvm.io/mpapis.asc | gpg --import - - \curl -sSL https://get.rvm.io | bash -s head - export PATH="$PATH:$HOME/.rvm/bin" - . ~/.rvm/scripts/rvm && rvm install ruby-3.2 - . ~/.rvm/scripts/rvm && rvm alias create default ruby-3.2 - # Show some information about the system. uname -a - c++ --version locale locale -a + + setup_ruby: | + curl -sSL https://rvm.io/mpapis.asc | gpg --import - + \curl -sSL https://get.rvm.io | bash -s head + export PATH="$PATH:$HOME/.rvm/bin" + . /usr/local/rvm/scripts/rvm && rvm install ruby-3.2 + . /usr/local/rvm/scripts/rvm && rvm alias create default ruby-3.2 ruby -v + + configure: | + bundle install + rake configure [--with-wxwin,--autoinstall] + + build: | + rake build From 837cd2ed12dd2a97b2dabd64ed0c0df4eddc644c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 16:02:05 +0100 Subject: [PATCH 004/168] update Cirrus CI --- .cirrus.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2b1ac30f..5b1e8f9e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -21,7 +21,7 @@ task: locale locale -a - setup_ruby: | + setup_ruby_script: | curl -sSL https://rvm.io/mpapis.asc | gpg --import - \curl -sSL https://get.rvm.io | bash -s head export PATH="$PATH:$HOME/.rvm/bin" @@ -30,9 +30,9 @@ task: ruby -v - configure: | + configure_script: | bundle install rake configure [--with-wxwin,--autoinstall] - build: | + build_script: | rake build From d2f0c6414cc11af88b7a6f86d6a757239148bdfd Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 16:07:19 +0100 Subject: [PATCH 005/168] update Cirrus CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 5b1e8f9e..3bfc6537 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,7 @@ task: before_script: | - sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make + sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng # Show some information about the system. uname -a From 18f1a53a9b9837dcd93ab4f4005b27333393a703 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 16:15:12 +0100 Subject: [PATCH 006/168] update Cirrus CI --- .cirrus.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3bfc6537..d111d2fe 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -21,7 +21,7 @@ task: locale locale -a - setup_ruby_script: | + build_script: | curl -sSL https://rvm.io/mpapis.asc | gpg --import - \curl -sSL https://get.rvm.io | bash -s head export PATH="$PATH:$HOME/.rvm/bin" @@ -30,9 +30,8 @@ task: ruby -v - configure_script: | bundle install - rake configure [--with-wxwin,--autoinstall] + + bundle exec rake configure [--with-wxwin,--autoinstall] - build_script: | - rake build + bundle exec rake build From 0978c7791fffe2b5a272d6cc8ff45b8230d221ff Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 17:03:43 +0100 Subject: [PATCH 007/168] update Cirrus CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index d111d2fe..d1b4e0d9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -32,6 +32,6 @@ task: bundle install - bundle exec rake configure [--with-wxwin,--autoinstall] + bundle exec rake configure[--with-wxwin,--autoinstall] bundle exec rake build From bf9cf9833bfaf77ded03f77f5a60ed657e772a82 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 6 Feb 2024 18:25:00 +0100 Subject: [PATCH 008/168] update Cirrus CI --- .cirrus.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index d1b4e0d9..b95ea16d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -35,3 +35,8 @@ task: bundle exec rake configure[--with-wxwin,--autoinstall] bundle exec rake build + + test_script: + . /usr/local/rvm/scripts/rvm + + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test From f8ec2d9e7b914116759ec9c4ff7aa9d284ef7a2f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 09:16:43 +0100 Subject: [PATCH 009/168] update Cirrus CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index b95ea16d..93d5441a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -39,4 +39,4 @@ task: test_script: . /usr/local/rvm/scripts/rvm - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" From fda1aef39379822cb872d525bbc839588c3441d1 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 10:25:52 +0100 Subject: [PATCH 010/168] update Cirrus CI --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 93d5441a..9cf2e96f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,6 +7,8 @@ task: - name: Cirrus CI / Fedora 39 container: image: fedora:39 + cpu: 4 + memory: 8G env: osname: linux distro: fedora From 5d87fcece88b8e1162a18a23e797da36cfc213a8 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 10:56:06 +0100 Subject: [PATCH 011/168] update Cirrus CI --- .cirrus.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9cf2e96f..ed188d65 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,6 +1,9 @@ # Continuous integration tasks running on Cirrus CI. # +env: + GITHUB_ACTION: 1 + task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" matrix: @@ -41,4 +44,9 @@ task: test_script: . /usr/local/rvm/scripts/rvm - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test WXRUBY_TEST_EXCLUDE=test_media_ctrl" + + bingem_script: + . /usr/local/rvm/scripts/rvm + + bundle exec rake bingem From a17d5609e4cf607574fcd6c4ebabf08cbb258391 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 12:01:56 +0100 Subject: [PATCH 012/168] update Cirrus CI --- .cirrus.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index ed188d65..1b7850af 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,6 +6,7 @@ env: task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" + only_if: $CIRRUS_BRANCH =~ 'pull/.*' || $CIRRUS_RELEASE != '' || $CIRRUS_API_CREATED == 'true matrix: - name: Cirrus CI / Fedora 39 container: @@ -44,7 +45,7 @@ task: test_script: . /usr/local/rvm/scripts/rvm - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test WXRUBY_TEST_EXCLUDE=test_media_ctrl" + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test WXRUBY_TEST_EXCLUDE=test_config;test_media_ctrl;test_intl" bingem_script: . /usr/local/rvm/scripts/rvm From c9b0a700762b090fb377119642990932a034397c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 12:03:02 +0100 Subject: [PATCH 013/168] create distro specific bingem name for Linux --- rakelib/gem.rb | 11 ++++++++++- rakelib/lib/config/pkgman/base.rb | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 5875382f..d0283b29 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -47,7 +47,7 @@ def self.manifest(gemtype = :src) end def self.define_spec(name, version, gemtype = :src, &block) - gemspec = ::Gem::Specification.new(name, version) + gemspec = ::Gem::Specification.new(make_gem_name(name, gemtype), version) if gemtype == :bin platform = ::Gem::Platform.local.to_s gemspec.platform = platform @@ -57,6 +57,15 @@ def self.define_spec(name, version, gemtype = :src, &block) gemspec end + def self.make_gem_name(name, gemtype) + if gemtype == :bin && WXRuby3.config.platform == :linux + distro = Config::Platform::PkgManager.distro + "#{name}-#{distro[:distro]}-#{distro[:release] || '0'}" + else + name + end + end + def self.gem_name(name, version, gemtype = :src) define_spec(name, version, gemtype).full_name end diff --git a/rakelib/lib/config/pkgman/base.rb b/rakelib/lib/config/pkgman/base.rb index 7a87380d..13a9f5df 100644 --- a/rakelib/lib/config/pkgman/base.rb +++ b/rakelib/lib/config/pkgman/base.rb @@ -18,11 +18,14 @@ module PkgManager class << self + def distro + @distro ||= get_distro + end + def install(pkgs) # do we need to install anything? if !pkgs.empty? || builds_wxwidgets? # determine the linux distro specs - distro = get_distro begin # load distro installation support require_relative "./#{distro[:type]}" From 6ac7284decc65621f5c4cece2d68dd5154f69900 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 12:06:22 +0100 Subject: [PATCH 014/168] update Cirrus CI --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1b7850af..c38e894b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,7 +6,7 @@ env: task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" - only_if: $CIRRUS_BRANCH =~ 'pull/.*' || $CIRRUS_RELEASE != '' || $CIRRUS_API_CREATED == 'true + only_if: $CIRRUS_BRANCH =~ 'pull/.*' || $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' matrix: - name: Cirrus CI / Fedora 39 container: From 05b3cf9dc17f28bc5b86242b7348a3a4352e19d2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 12:41:09 +0100 Subject: [PATCH 015/168] update Cirrus CI; add distro setup tool scripts --- .cirrus.yml | 19 ++++++++++++++----- tools/scripts/setup-debian.sh | 1 + tools/scripts/setup-fedora.sh | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 tools/scripts/setup-debian.sh create mode 100644 tools/scripts/setup-fedora.sh diff --git a/.cirrus.yml b/.cirrus.yml index c38e894b..cae7a5c2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -3,24 +3,33 @@ env: GITHUB_ACTION: 1 + WXRUBY_TEST_EXCLUDE: 'test_config;test_intl;test_media_ctrl' task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" only_if: $CIRRUS_BRANCH =~ 'pull/.*' || $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' matrix: - - name: Cirrus CI / Fedora 39 + - name: Cirrus CI / Fedora AMD64 container: - image: fedora:39 + image: fedora:latest cpu: 4 memory: 8G env: osname: linux distro: fedora - arch: amd64 + - name: Cirrus CI / Debian ARM64 + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + before_script: | - sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng + . tools/scripts/setup-$distro.sh # Show some information about the system. uname -a @@ -45,7 +54,7 @@ task: test_script: . /usr/local/rvm/scripts/rvm - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test WXRUBY_TEST_EXCLUDE=test_config;test_media_ctrl;test_intl" + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" bingem_script: . /usr/local/rvm/scripts/rvm diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh new file mode 100644 index 00000000..9d7a8b07 --- /dev/null +++ b/tools/scripts/setup-debian.sh @@ -0,0 +1 @@ +sudo apt-get -q -o=Dpkg::Use-Pty=0 install -y git make gcc gpg xvfb xfonts-75dpi diff --git a/tools/scripts/setup-fedora.sh b/tools/scripts/setup-fedora.sh new file mode 100644 index 00000000..e98cc3c9 --- /dev/null +++ b/tools/scripts/setup-fedora.sh @@ -0,0 +1 @@ +sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng From f8802f469e5aa8338a0cfd977ceaeb76a6354866 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 12:44:58 +0100 Subject: [PATCH 016/168] remove sudo (cirrus containers all run as root) --- tools/scripts/setup-debian.sh | 2 +- tools/scripts/setup-fedora.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh index 9d7a8b07..918b8b5c 100644 --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/setup-debian.sh @@ -1 +1 @@ -sudo apt-get -q -o=Dpkg::Use-Pty=0 install -y git make gcc gpg xvfb xfonts-75dpi +apt-get -q -o=Dpkg::Use-Pty=0 install -y git make gcc gpg xvfb xfonts-75dpi diff --git a/tools/scripts/setup-fedora.sh b/tools/scripts/setup-fedora.sh index e98cc3c9..45346844 100644 --- a/tools/scripts/setup-fedora.sh +++ b/tools/scripts/setup-fedora.sh @@ -1 +1 @@ -sudo dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng +dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng From 2ecb752f9bb02c784d19f2c8d69c4b4e44c0413f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 13:39:30 +0100 Subject: [PATCH 017/168] update debian setup --- tools/scripts/setup-debian.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh index 918b8b5c..a161d4e0 100644 --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/setup-debian.sh @@ -1 +1,2 @@ -apt-get -q -o=Dpkg::Use-Pty=0 install -y git make gcc gpg xvfb xfonts-75dpi +apt-get update +apt-get -y git make gcc gpg xvfb xfonts-75dpi From ec9db7d7103efe5eb4e696c0d674e529367b23a3 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 13:42:36 +0100 Subject: [PATCH 018/168] fix typo --- tools/scripts/setup-debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh index a161d4e0..7c4c4f66 100644 --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/setup-debian.sh @@ -1,2 +1,2 @@ apt-get update -apt-get -y git make gcc gpg xvfb xfonts-75dpi +apt-get install -y git make gcc gpg xvfb xfonts-75dpi From ef58c28451cdca1d60674cb13cb5a05d352148a4 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 13:49:30 +0100 Subject: [PATCH 019/168] add curl to debian setup --- tools/scripts/setup-debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh index 7c4c4f66..8a916696 100644 --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/setup-debian.sh @@ -1,2 +1,2 @@ apt-get update -apt-get install -y git make gcc gpg xvfb xfonts-75dpi +apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl From bd91d9d01e27962da627948f29fb1f53aa13a489 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 15:22:05 +0100 Subject: [PATCH 020/168] use proper separator for exclude list --- .cirrus.yml | 2 +- rakelib/lib/config.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index cae7a5c2..225c22cc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -3,7 +3,7 @@ env: GITHUB_ACTION: 1 - WXRUBY_TEST_EXCLUDE: 'test_config;test_intl;test_media_ctrl' + WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 8cda856e..63f08aa9 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -350,7 +350,7 @@ def sh(*cmd, fail_on_error: false, **kwargs) def test(*tests, **options) errors = 0 - excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(';') + excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(':') tests = Dir.glob(File.join(Config.instance.test_dir, '*.rb')) if tests.empty? tests.each do |test| unless excludes.include?(File.basename(test, '.*')) From 61cdf89d928565120eb432178b093242d409d414 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 15:37:38 +0100 Subject: [PATCH 021/168] extend cirrus builds --- .cirrus.yml | 32 ++++++++++++++++++++++++++++++++ tools/scripts/setup-opensuse.sh | 1 + tools/scripts/setup-ubuntu.sh | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 tools/scripts/setup-opensuse.sh create mode 100644 tools/scripts/setup-ubuntu.sh diff --git a/.cirrus.yml b/.cirrus.yml index 225c22cc..7c90de3f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -17,6 +17,38 @@ task: env: osname: linux distro: fedora + - name: Cirrus CI / OpenSuSE Leap AMD64 + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / Ubuntu AMD64 + container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Debian AMD64 + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian - name: Cirrus CI / Debian ARM64 arm_container: image: debian:latest diff --git a/tools/scripts/setup-opensuse.sh b/tools/scripts/setup-opensuse.sh new file mode 100644 index 00000000..b1779aa8 --- /dev/null +++ b/tools/scripts/setup-opensuse.sh @@ -0,0 +1 @@ +zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make diff --git a/tools/scripts/setup-ubuntu.sh b/tools/scripts/setup-ubuntu.sh new file mode 100644 index 00000000..8a916696 --- /dev/null +++ b/tools/scripts/setup-ubuntu.sh @@ -0,0 +1,2 @@ +apt-get update +apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl From 6790cc9beeeafd4d073a53da2964d60651a819e5 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 15:44:49 +0100 Subject: [PATCH 022/168] update distro setups --- tools/scripts/setup-debian.sh | 2 +- tools/scripts/setup-opensuse.sh | 2 +- tools/scripts/setup-ubuntu.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/setup-debian.sh index 8a916696..7ea01cc9 100644 --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/setup-debian.sh @@ -1,2 +1,2 @@ apt-get update -apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl +apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps diff --git a/tools/scripts/setup-opensuse.sh b/tools/scripts/setup-opensuse.sh index b1779aa8..10fbafc7 100644 --- a/tools/scripts/setup-opensuse.sh +++ b/tools/scripts/setup-opensuse.sh @@ -1 +1 @@ -zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make +zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make tar gzip diff --git a/tools/scripts/setup-ubuntu.sh b/tools/scripts/setup-ubuntu.sh index 8a916696..7ea01cc9 100644 --- a/tools/scripts/setup-ubuntu.sh +++ b/tools/scripts/setup-ubuntu.sh @@ -1,2 +1,2 @@ apt-get update -apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl +apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps From 05e20da2f349251d8ce6d47e54d66058c4e10b92 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 16:30:38 +0100 Subject: [PATCH 023/168] add github repo metadata for gemspec --- rakelib/gem.rake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 95bf3363..d8766c3b 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -93,6 +93,7 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m "source_code_uri" => "https://github.com/mcorino/wxRuby3", "documentation_uri" => "https://mcorino.github.io/wxRuby3", "homepage_uri" => "https://github.com/mcorino/wxRuby3", + "github_repo" => "https://github.com/mcorino/wxRuby3" } gem.post_install_message = <<~__MSG @@ -141,6 +142,7 @@ if WXRuby3.is_bootstrapped? "source_code_uri" => "https://github.com/mcorino/wxRuby3", "documentation_uri" => "https://mcorino.github.io/wxRuby3", "homepage_uri" => "https://github.com/mcorino/wxRuby3", + "github_repo" => "https://github.com/mcorino/wxRuby3" } gem.post_install_message = <<~__MSG From 24c4994bc944fa2b14db4699d0f795cdbb924e65 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 7 Feb 2024 16:31:11 +0100 Subject: [PATCH 024/168] add gem publishing and 2 more platforms --- .cirrus.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 7c90de3f..69b925c0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,6 +4,7 @@ env: GITHUB_ACTION: 1 WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' + GEM_HOST_API_KEY: ENCRYPTED[e8fcba782448025637b583db644f6e73f3707ea9b79a87ee5cab26f6358768159a2cc5cfe84dca92a11277a506767a5d] task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" @@ -17,6 +18,14 @@ task: env: osname: linux distro: fedora + - name: Cirrus CI / Fedora ARM64 + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora - name: Cirrus CI / OpenSuSE Leap AMD64 container: image: opensuse/leap:latest @@ -25,6 +34,14 @@ task: env: osname: linux distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse - name: Cirrus CI / Ubuntu AMD64 container: image: ubuntu:latest @@ -92,3 +109,5 @@ task: . /usr/local/rvm/scripts/rvm bundle exec rake bingem + + gem push --host https://rubygems.pkg.github.com/mcorino $(echo pkg/*.gem) From 2e92e5006c5deeeacfa975144232f153d32e010e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 13:39:46 +0100 Subject: [PATCH 025/168] add binpkg tasks and helpers --- rakelib/gem.rake | 56 +++++++----------------------------------------- rakelib/gem.rb | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index d8766c3b..3cf5ffa7 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -15,7 +15,7 @@ namespace :wxruby do task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)] if WXRuby3.is_bootstrapped? - task :bingem => ['bin:build', File.join(WXRuby3.config.rb_docgen_path, 'window.rb'), WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin)] + task :binpkg => ['bin:build', File.join(WXRuby3.config.rb_docgen_path, 'window.rb'), WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] end # this task only exists for installed source gems (where package tasks have been removed) @@ -113,59 +113,19 @@ task :gem => 'wxruby:gem:srcgem' if WXRuby3.is_bootstrapped? - # binary gem file - file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) => WXRuby3::Gem.manifest(:bin) + ['ext/mkrf_conf_bingem.rb'] do + # binary package file + file WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.bin_pkg_manifest do |t| WXRuby3::Install.install_wxwin_shlibs begin - # create gemspec - gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) do |gem| - gem.summary = %Q{wxWidgets extension for Ruby} - gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework} - gem.email = 'mcorino@m2c-software.nl' - gem.homepage = "https://github.com/mcorino/wxRuby3" - gem.authors = ['Martin Corino'] - gem.files = WXRuby3::Gem.manifest(:bin) - gem.require_paths = %w{lib} - gem.require_paths << 'ext' if WXRuby3.config.get_config('with-wxwin') - gem.bindir = 'bin' - gem.executables = WXRuby3::Bin.binaries - gem.extensions = ['ext/mkrf_conf_bingem.rb'] - gem.required_ruby_version = ">= #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor}", - "< #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor+1}" - gem.licenses = ['MIT'] - gem.add_dependency 'rake' - gem.add_dependency 'minitest', '~> 5.15' - gem.add_dependency 'test-unit', '~> 3.5' - gem.rdoc_options << '--exclude=\\.dll' << '--exclude=\\.so' - gem.metadata = { - "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues", - "source_code_uri" => "https://github.com/mcorino/wxRuby3", - "documentation_uri" => "https://mcorino.github.io/wxRuby3", - "homepage_uri" => "https://github.com/mcorino/wxRuby3", - "github_repo" => "https://github.com/mcorino/wxRuby3" - } - gem.post_install_message = <<~__MSG - - wxRuby3 has been successfully installed including the 'wxruby' utility. - - You can run the regression tests to verify the installation by executing: - - $ ./wxruby test - - The wxRuby3 sample selector can be run by executing: - - $ ./wxruby sampler - - Have fun using wxRuby3. - __MSG - end - WXRuby3::Gem.build_gem(gemspec) + # create bin package + WXRuby3::Gem.build_bin_pkg(t.name, WXRuby3::Gem.bin_pkg_manifest) ensure + # cleanup WXRuby3::Install.remove_wxwin_shlibs end end - desc 'Build wxRuby 3 binary gem' - task :bingem => 'wxruby:gem:bingem' + desc 'Build wxRuby 3 binary package' + task :binpkg => 'wxruby:gem:binpkg' end diff --git a/rakelib/gem.rb b/rakelib/gem.rb index d0283b29..c4bf55e3 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -46,6 +46,16 @@ def self.manifest(gemtype = :src) manifest end + def self.bin_pkg_manifest + # create MANIFEST list with included files + manifest = Rake::FileList.new + manifest.include "lib/*.#{WXRuby3.config.dll_mask}" + if WXRuby3.config.get_config('with-wxwin') + manifest.include "ext/*.#{WXRuby3.config.dll_mask}" + end + manifest + end + def self.define_spec(name, version, gemtype = :src, &block) gemspec = ::Gem::Specification.new(make_gem_name(name, gemtype), version) if gemtype == :bin @@ -86,6 +96,37 @@ def self.build_gem(gemspec) FileUtils.mv(gem_file_name, 'pkg') end + def self.make_bin_name + if WXRuby3.config.platform == :linux + distro = Config::Platform::PkgManager.distro + "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}" + else + "wxruby3_#{WXRuby3.config.platform}" + end + end + + def self.bin_pkg_name(version) + gemspec = ::Gem::Specification.new(make_bin_name, version) + gemspec.platform = ::Gem::Platform.local.to_s + gemspec.full_name + end + + def self.bin_pkg_ext + WXRuby3.config.windows? ? 'zip' : 'tar.gz' + end + + def self.bin_pkg_file(version) + File.join('pkg', "#{WXRuby3::Gem.bin_pkg_name(version)}.#{bin_pkg_ext}") + end + + def self.build_bin_pkg(fname, manifest) + if WXRuby3.config.windows? + WXRuby3.config.execute("powershell Compress-Archive #{manifest.collect { |p| "-Path '#{p}'"}}-DestinationPath #{fname} -Force") + else + WXRuby3.config.execute("tar -czf #{fname} #{manifest.to_s}") + end + end + end end From b229684cee9403de00c241a56b740321cae98d14 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 13:46:20 +0100 Subject: [PATCH 026/168] update task description --- rakelib/gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 3cf5ffa7..470b36fd 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -125,7 +125,7 @@ if WXRuby3.is_bootstrapped? end end - desc 'Build wxRuby 3 binary package' + desc 'Build wxRuby 3 binary release package' task :binpkg => 'wxruby:gem:binpkg' end From 9f1ec4be86cbb89224366bb5230e93bc5df7805c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 13:46:37 +0100 Subject: [PATCH 027/168] fix windows pkg ZIP creation --- rakelib/gem.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index c4bf55e3..bc308e32 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -121,7 +121,7 @@ def self.bin_pkg_file(version) def self.build_bin_pkg(fname, manifest) if WXRuby3.config.windows? - WXRuby3.config.execute("powershell Compress-Archive #{manifest.collect { |p| "-Path '#{p}'"}}-DestinationPath #{fname} -Force") + WXRuby3.config.execute("powershell Compress-Archive -Path #{manifest.join(',')} -DestinationPath #{fname} -Force") else WXRuby3.config.execute("tar -czf #{fname} #{manifest.to_s}") end From e35556e077fbfda3ef53db395b53804aa7f14829 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 15:44:41 +0100 Subject: [PATCH 028/168] add pure Ruby binary package builder/installer --- rakelib/gem.rb | 69 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index bc308e32..8952ff98 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -13,6 +13,9 @@ require 'rubygems/builder' rescue LoadError end +require 'zlib' +require 'tempfile' +require 'json' require_relative './lib/config' require_relative './install' @@ -111,19 +114,67 @@ def self.bin_pkg_name(version) gemspec.full_name end - def self.bin_pkg_ext - WXRuby3.config.windows? ? 'zip' : 'tar.gz' - end - def self.bin_pkg_file(version) - File.join('pkg', "#{WXRuby3::Gem.bin_pkg_name(version)}.#{bin_pkg_ext}") + File.join('pkg', "#{WXRuby3::Gem.bin_pkg_name(version)}.pkg") end def self.build_bin_pkg(fname, manifest) - if WXRuby3.config.windows? - WXRuby3.config.execute("powershell Compress-Archive -Path #{manifest.join(',')} -DestinationPath #{fname} -Force") - else - WXRuby3.config.execute("tar -czf #{fname} #{manifest.to_s}") + # package registry + registry = [] + # package temp deflate stream + deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true) + begin + # pack binaries into temp deflate stream + manifest.each do |path| + pack = true + entry = [path, File.stat(path).mode, 0] + unless WXRuby3.config.windows? + if File.symlink?(path) + pack = false + entry << File.readlink(path) + end + end + if pack + offs = deflate_stream.tell + deflate_stream.write(Zlib::Deflate.deflate(File.read(path, binmode: true))) + entry[2] = deflate_stream.tell - offs # packed data size + end + registry << entry + end + # convert registry to deflated json string + registry_json_z = Zlib::Deflate.deflate(registry.to_json) + # create final package archive + deflate_stream.rewind + File.open(fname, 'w', binmode: true) do |fout| + fout.write([registry_json_z.size].pack('Q')) + fout.write(registry_json_z) + registry.each do |entry| + fout.write(deflate_stream.read(entry[2])) if entry[2] > 0 + end + end + ensure + deflate_stream.close(true) + end + end + + def self.install_bin_pkg(fname) + File.open(fname, 'r', binmode: true) do |fin| + # get packed registry size + registry_size = fin.read(8).unpack('Q').shift + # unpack registry + registry = JSON.parse!(Zlib::Inflate.inflate(fin.read(registry_size))) + # unpack and create binaries + registry.each do |entry| + path, mode, size, symlink = entry + if symlink + FileUtils.ln_s(symlink, path) + else + File.open(path, 'w', binmode: true) do |fbin| + fbin << Zlib::Inflate.inflate(fin.read(size)) + end + File.chmod(mode, path) + end + end end end From c94735c7851c693782b0074e37aec09f18affe41 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 16:53:13 +0100 Subject: [PATCH 029/168] fix task dependency --- rakelib/gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 470b36fd..b3098bc8 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -15,7 +15,7 @@ namespace :wxruby do task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)] if WXRuby3.is_bootstrapped? - task :binpkg => ['bin:build', File.join(WXRuby3.config.rb_docgen_path, 'window.rb'), WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] + task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] end # this task only exists for installed source gems (where package tasks have been removed) From f870f09c261ffb7f16d687a62431e2c17858e9da Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 19:09:28 +0100 Subject: [PATCH 030/168] remove gem publish; add binary package release uploads --- .cirrus.yml | 6 ++--- tools/scripts/cirrus-upload-release-pkg.sh | 27 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 tools/scripts/cirrus-upload-release-pkg.sh diff --git a/.cirrus.yml b/.cirrus.yml index 69b925c0..089a89fc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ env: GITHUB_ACTION: 1 WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' - GEM_HOST_API_KEY: ENCRYPTED[e8fcba782448025637b583db644f6e73f3707ea9b79a87ee5cab26f6358768159a2cc5cfe84dca92a11277a506767a5d] + GITHUB_TOKEN: ENCRYPTED[2ce3914266dec78118dd9706c25d2e52fbd164f86713692efde9b8af5f0159099cb299934a8d6279e524da7a0790e025] task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" @@ -108,6 +108,6 @@ task: bingem_script: . /usr/local/rvm/scripts/rvm - bundle exec rake bingem + bundle exec rake binpkg - gem push --host https://rubygems.pkg.github.com/mcorino $(echo pkg/*.gem) + . tools/scripts/cirrus-upload-release-pkg.sh diff --git a/tools/scripts/cirrus-upload-release-pkg.sh b/tools/scripts/cirrus-upload-release-pkg.sh new file mode 100644 index 00000000..c65b4a73 --- /dev/null +++ b/tools/scripts/cirrus-upload-release-pkg.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +if [[ "$GITHUB_TOKEN" == "" ]]; then + echo "Please provide GitHub access token via GITHUB_TOKEN environment variable!" + exit 1 +fi + +if [[ "$CIRRUS_RELEASE" == "" ]]; then + CIRRUS_RELEASE=v$(ruby -r ./lib/wx/version.rb -e "puts Wx::WXRUBY_VERSION") +fi + +file_content_type="application/octet-stream" +files_to_upload=( + # relative paths of assets to upload +) + +for fpath in pkg/*.pkg +do + echo "Uploading $fpath..." + name=$(basename "$fpath") + url_to_upload="https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=$name" + curl -X POST \ + --data-binary @$fpath \ + --header "Authorization: token $GITHUB_TOKEN" \ + --header "Content-Type: $file_content_type" \ + $url_to_upload +done From b5ca3310e76d369e19e1f924a119149515fd228d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 19:38:06 +0100 Subject: [PATCH 031/168] rename step --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 089a89fc..5094712a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -105,7 +105,7 @@ task: /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" - bingem_script: + release_script: . /usr/local/rvm/scripts/rvm bundle exec rake binpkg From e404d58f858a0183c6200510555e97a7e282bb9d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 8 Feb 2024 19:38:34 +0100 Subject: [PATCH 032/168] refactor gem task and helpers; fix binpkg builder --- rakelib/gem.rake | 42 ++++++++++++++++++++++----------------- rakelib/gem.rb | 51 +++++++++++++++--------------------------------- 2 files changed, 40 insertions(+), 53 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index b3098bc8..8f4349dd 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -18,8 +18,8 @@ namespace :wxruby do task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] end - # this task only exists for installed source gems (where package tasks have been removed) - unless File.file?(File.join(__dir__, 'package.rake')) + # this task only exists for installed (source) gems (where run tasks have been removed) + unless File.file?(File.join(__dir__, 'run.rake')) task :setup => 'config:bootstrap' do |_t, args| begin @@ -65,13 +65,14 @@ namespace :wxruby do end # source gem file -file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do - gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION) do |gem| +file WXRuby3::Gem.gem_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do + gemspec = WXRuby3::Gem.define_spec(WXRuby3::WXRUBY_VERSION) do |gem| gem.summary = %Q{wxWidgets extension for Ruby} gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework} gem.email = 'mcorino@m2c-software.nl' gem.homepage = "https://github.com/mcorino/wxRuby3" gem.authors = ['Martin Corino'] + gem.extensions = ['ext/ext_conf.rb'] gem.files = WXRuby3::Gem.manifest gem.require_paths = %w{lib} gem.bindir = 'bin' @@ -111,21 +112,26 @@ end desc 'Build wxRuby 3 gem' task :gem => 'wxruby:gem:srcgem' -if WXRuby3.is_bootstrapped? - - # binary package file - file WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.bin_pkg_manifest do |t| - WXRuby3::Install.install_wxwin_shlibs - begin - # create bin package - WXRuby3::Gem.build_bin_pkg(t.name, WXRuby3::Gem.bin_pkg_manifest) - ensure - # cleanup - WXRuby3::Install.remove_wxwin_shlibs +# these tasks only exists for installed (source) gems (where run tasks have been removed) +unless File.file?(File.join(__dir__, 'run.rake')) + + if WXRuby3.is_bootstrapped? + + # binary package file + file WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.bin_pkg_manifest do |t| + WXRuby3::Install.install_wxwin_shlibs + begin + # create bin package + WXRuby3::Gem.build_bin_pkg(t.name, WXRuby3::Gem.bin_pkg_manifest) + ensure + # cleanup + WXRuby3::Install.remove_wxwin_shlibs + end end - end - desc 'Build wxRuby 3 binary release package' - task :binpkg => 'wxruby:gem:binpkg' + desc 'Build wxRuby 3 binary release package' + task :binpkg => 'wxruby:gem:binpkg' + + end end diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 8952ff98..f24031a0 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -24,27 +24,18 @@ module WXRuby3 module Gem - def self.manifest(gemtype = :src) + def self.manifest # create MANIFEST list with included files manifest = Rake::FileList.new manifest.include %w[bin/*] # *nix executables in bin/ manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows? manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*] - if gemtype == :bin - if WXRuby3.config.get_config('with-wxwin') - manifest.include "ext/*.#{WXRuby3.config.dll_mask}" - end - manifest.include 'ext/mkrf_conf_bingem.rb' - manifest.include %w[rakelib/prepost.* rakelib/install.rb rakelib/lib/config.rb rakelib/lib/config/**/* rakelib/lib/ext/**/* rakelib/yard/**/*] - manifest.include WXRuby3::BUILD_CFG - else - manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" - manifest.include 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' - manifest.exclude 'ext/wxruby3/swig/classes/**/*' - manifest.include 'rakelib/**/*' - manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] - manifest.include 'rakefile' - end + manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" + manifest.include 'ext/ext_conf.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' + manifest.exclude 'ext/wxruby3/swig/classes/**/*' + manifest.include 'rakelib/**/*' + manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] + manifest.include 'rakefile' manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts} manifest end @@ -59,32 +50,19 @@ def self.bin_pkg_manifest manifest end - def self.define_spec(name, version, gemtype = :src, &block) - gemspec = ::Gem::Specification.new(make_gem_name(name, gemtype), version) - if gemtype == :bin - platform = ::Gem::Platform.local.to_s - gemspec.platform = platform - end + def self.define_spec(version, &block) + gemspec = ::Gem::Specification.new('wxruby3', version) gemspec.required_rubygems_version = ::Gem::Requirement.new(">= 0") if gemspec.respond_to? :required_rubygems_version= block.call(gemspec) if block_given? gemspec end - def self.make_gem_name(name, gemtype) - if gemtype == :bin && WXRuby3.config.platform == :linux - distro = Config::Platform::PkgManager.distro - "#{name}-#{distro[:distro]}-#{distro[:release] || '0'}" - else - name - end - end - - def self.gem_name(name, version, gemtype = :src) - define_spec(name, version, gemtype).full_name + def self.gem_name(version) + define_spec(version).full_name end - def self.gem_file(name, version, gemtype = :src) - File.join('pkg', "#{WXRuby3::Gem.gem_name(name, version, gemtype)}.gem") + def self.gem_file(version) + File.join('pkg', "#{WXRuby3::Gem.gem_name(version)}.gem") end def self.build_gem(gemspec) @@ -119,6 +97,9 @@ def self.bin_pkg_file(version) end def self.build_bin_pkg(fname, manifest) + # make sure pkg directory exists + FileUtils.mkdir_p('pkg') + # package registry registry = [] # package temp deflate stream From 9cb97c33fade8bf1680d1b39e23532788a8f37e9 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 09:53:35 +0100 Subject: [PATCH 033/168] remove deprecated argument --- rakelib/gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 8f4349dd..ce7c87d8 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -12,7 +12,7 @@ namespace :wxruby do namespace :gem do - task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)] + task :srcgem => ['bin:build', WXRuby3::Gem.gem_file(WXRuby3::WXRUBY_VERSION)] if WXRuby3.is_bootstrapped? task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] From 0bd266106719c596ff41d40e5ecc0a9ad46835ea Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 10:19:29 +0100 Subject: [PATCH 034/168] fix typo --- rakelib/gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index ce7c87d8..02692259 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -113,7 +113,7 @@ desc 'Build wxRuby 3 gem' task :gem => 'wxruby:gem:srcgem' # these tasks only exists for installed (source) gems (where run tasks have been removed) -unless File.file?(File.join(__dir__, 'run.rake')) +if File.file?(File.join(__dir__, 'run.rake')) if WXRuby3.is_bootstrapped? From ab40dd82f33dbe9991ef42c794b5ba1a12b4ac4c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 11:17:31 +0100 Subject: [PATCH 035/168] fix cirrus release upload script REST call --- tools/scripts/cirrus-upload-release-pkg.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/scripts/cirrus-upload-release-pkg.sh b/tools/scripts/cirrus-upload-release-pkg.sh index c65b4a73..7f59df58 100644 --- a/tools/scripts/cirrus-upload-release-pkg.sh +++ b/tools/scripts/cirrus-upload-release-pkg.sh @@ -18,10 +18,12 @@ for fpath in pkg/*.pkg do echo "Uploading $fpath..." name=$(basename "$fpath") - url_to_upload="https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=$name" - curl -X POST \ + url_to_upload="https://uploads.github.com/repos/mcorino/wxruby3/releases/$CIRRUS_RELEASE/assets?name=$name" + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -H "Content-Type: $file_content_type" \ + $url_to_upload \ --data-binary @$fpath \ - --header "Authorization: token $GITHUB_TOKEN" \ - --header "Content-Type: $file_content_type" \ - $url_to_upload done From 39d0fec9aee25844972551c1b6650462d6b48f67 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 11:48:31 +0100 Subject: [PATCH 036/168] fix typo --- tools/scripts/cirrus-upload-release-pkg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus-upload-release-pkg.sh b/tools/scripts/cirrus-upload-release-pkg.sh index 7f59df58..d39802cb 100644 --- a/tools/scripts/cirrus-upload-release-pkg.sh +++ b/tools/scripts/cirrus-upload-release-pkg.sh @@ -25,5 +25,5 @@ do -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Content-Type: $file_content_type" \ $url_to_upload \ - --data-binary @$fpath \ + --data-binary @$fpath done From 2d41ce1e144feb2ac0e253938ea15310d6a77c11 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 14:05:20 +0100 Subject: [PATCH 037/168] refactor cirrus release upload script --- tools/scripts/cirrus-upload-release-pkg.rb | 49 ++++++++++++++++++++++ tools/scripts/cirrus-upload-release-pkg.sh | 29 ------------- 2 files changed, 49 insertions(+), 29 deletions(-) create mode 100644 tools/scripts/cirrus-upload-release-pkg.rb delete mode 100644 tools/scripts/cirrus-upload-release-pkg.sh diff --git a/tools/scripts/cirrus-upload-release-pkg.rb b/tools/scripts/cirrus-upload-release-pkg.rb new file mode 100644 index 00000000..e7ea963c --- /dev/null +++ b/tools/scripts/cirrus-upload-release-pkg.rb @@ -0,0 +1,49 @@ + +require 'uri' +require 'net/https' +require 'json' + +$GITHUB_TOKEN = ENV['GITHUB_TOKEN'] || '' +if $GITHUB_TOKEN.empty? + $stderr.puts 'Please provide GitHub access token via GITHUB_TOKEN environment variable!' + exit(1) +end + +$CIRRUS_RELEASE = ENV['CIRRUS_RELEASE'] || '' +if $CIRRUS_RELEASE.empty? + uri = URI('https://api.github.com/repos/mcorino/wxruby3/releases/latest') + headers = { + 'Accept' => 'application/vnd.github+json', + 'X-GitHub-Api-Version' => '2022-11-28', + 'Authorization' => "Bearer #{ENV['GITHUB_TOKEN']}" + } + rest_response = Net::HTTP.get_response(uri, headers) + if rest_response.code.to_i == 200 + data = JSON.parse!(rest_response.body) + $CIRRUS_RELEASE = data['id'] + else + $stderr.puts "Cannot determine latest release [#{rest_response}]!" + exit(1) + end +end + +file_content_type="application/octet-stream" +Dir.glob(File.join('pkg', '*.pkg')).each do |fpath| + name = File.basename(fpath) + url_to_upload = "https://uploads.github.com/repos/mcorino/wxruby3/releases/#{$CIRRUS_RELEASE}/assets?name=#{name}" + puts "Uploading #{fpath} for release #{$CIRRUS_RELEASE} to #{url_to_upload}..." + cmd = "curl -L -X POST -H \"Accept: application/vnd.github+json\" " + + "-H \"Authorization: token #{$GITHUB_TOKEN}\" " + + "-H \"X-GitHub-Api-Version: 2022-11-28\" " + + "-H \"Content-Type: #{file_content_type}\" " + + "#{url_to_upload} --data-binary @#{fpath}" + result = `#{cmd}` + if $?.success? + data = JSON.parse!(result) + exit(0) if data['browser_download_url'] + $stderr.puts "Failed to upload release asset [#{result}]!" + else + $stderr.puts "Curl failed to upload release asset!" + end + exit(1) +end diff --git a/tools/scripts/cirrus-upload-release-pkg.sh b/tools/scripts/cirrus-upload-release-pkg.sh deleted file mode 100644 index d39802cb..00000000 --- a/tools/scripts/cirrus-upload-release-pkg.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -if [[ "$GITHUB_TOKEN" == "" ]]; then - echo "Please provide GitHub access token via GITHUB_TOKEN environment variable!" - exit 1 -fi - -if [[ "$CIRRUS_RELEASE" == "" ]]; then - CIRRUS_RELEASE=v$(ruby -r ./lib/wx/version.rb -e "puts Wx::WXRUBY_VERSION") -fi - -file_content_type="application/octet-stream" -files_to_upload=( - # relative paths of assets to upload -) - -for fpath in pkg/*.pkg -do - echo "Uploading $fpath..." - name=$(basename "$fpath") - url_to_upload="https://uploads.github.com/repos/mcorino/wxruby3/releases/$CIRRUS_RELEASE/assets?name=$name" - curl -L -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - -H "Content-Type: $file_content_type" \ - $url_to_upload \ - --data-binary @$fpath -done From cf1dc40ce89fcfaaf95626c3dc3671f6cf611999 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 14:05:46 +0100 Subject: [PATCH 038/168] refactor cirrus release upload script --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 5094712a..5a52baa8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -110,4 +110,4 @@ task: bundle exec rake binpkg - . tools/scripts/cirrus-upload-release-pkg.sh + ruby tools/scripts/cirrus-upload-release-pkg.rb From d1a771aeddcc89c26c9ff9d27b5314fb511e4163 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 16:50:22 +0100 Subject: [PATCH 039/168] update binary package building and installing --- ext/mkrf_conf_bingem.rb | 21 --- ext/mkrf_conf_ext.rb | 23 +++ rakelib/gem.rake | 67 +++++++-- rakelib/gem.rb | 273 +++++++++++++++++++++------------- rakelib/lib/config.rb | 4 + rakelib/lib/config/mingw.rb | 2 +- rakelib/lib/config/unixish.rb | 4 + rakelib/prepost.rake | 7 +- 8 files changed, 256 insertions(+), 145 deletions(-) delete mode 100644 ext/mkrf_conf_bingem.rb create mode 100644 ext/mkrf_conf_ext.rb diff --git a/ext/mkrf_conf_bingem.rb b/ext/mkrf_conf_bingem.rb deleted file mode 100644 index 2133852e..00000000 --- a/ext/mkrf_conf_bingem.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 extension configuration file for binary gem -### - -# generate Rakefile with appropriate default task (all actual task in rakelib) -File.open('../Rakefile', 'w') do |f| - f.puts < ['bin:build', WXRuby3::Gem.gem_file(WXRuby3::WXRUBY_VERSION)] - - if WXRuby3.is_bootstrapped? - task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION)] - end + task :srcgem => ['bin:build', WXRuby3::Gem.gem_file] # this task only exists for installed (source) gems (where run tasks have been removed) unless File.file?(File.join(__dir__, 'run.rake')) @@ -65,14 +61,14 @@ namespace :wxruby do end # source gem file -file WXRuby3::Gem.gem_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do - gemspec = WXRuby3::Gem.define_spec(WXRuby3::WXRUBY_VERSION) do |gem| +file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do + gemspec = WXRuby3::Gem.define_spec do |gem| gem.summary = %Q{wxWidgets extension for Ruby} gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework} gem.email = 'mcorino@m2c-software.nl' gem.homepage = "https://github.com/mcorino/wxRuby3" gem.authors = ['Martin Corino'] - gem.extensions = ['ext/ext_conf.rb'] + gem.extensions = ['ext/mkrf_conf_ext.rb'] gem.files = WXRuby3::Gem.manifest gem.require_paths = %w{lib} gem.bindir = 'bin' @@ -98,11 +94,27 @@ file WXRuby3::Gem.gem_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do } gem.post_install_message = <<~__MSG - The wxRuby3 Gem has been successfully installed. - Before being able to use wxRuby3 you need to run the post-install setup process - by executing the command 'wxruby setup'. + The wxRuby3 Gem has been successfully installed including the 'wxruby' utility. + + In case no suitable binary release package was available for your platform you + will need to run the post-install setup process by executing: + + $ wxruby setup + + Otherwise (or after you have successfully run the setup procedure) you can start + using wxRuby3. + + You can run the regression tests to verify the installation by executing: + + $ wxruby test - Run 'wxruby setup -h' to see information on the available commandline options. + The wxRuby3 sample selector can be run by executing: + + $ wxruby sampler + + Have fun using wxRuby3. + + Run 'wxruby -h' to see information on the available commands. __MSG end @@ -112,17 +124,25 @@ end desc 'Build wxRuby 3 gem' task :gem => 'wxruby:gem:srcgem' -# these tasks only exists for installed (source) gems (where run tasks have been removed) +# these tasks do not exist for installed (source) gems (where run tasks have been removed) if File.file?(File.join(__dir__, 'run.rake')) if WXRuby3.is_bootstrapped? + namespace :wxruby do + + namespace :gem do + task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file] + end + + end + # binary package file - file WXRuby3::Gem.bin_pkg_file(WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.bin_pkg_manifest do |t| + file WXRuby3::Gem.bin_pkg_file => WXRuby3::Gem.bin_pkg_manifest do |t| WXRuby3::Install.install_wxwin_shlibs begin # create bin package - WXRuby3::Gem.build_bin_pkg(t.name, WXRuby3::Gem.bin_pkg_manifest) + WXRuby3::Gem.build_bin_pkg(t.name) ensure # cleanup WXRuby3::Install.remove_wxwin_shlibs @@ -134,4 +154,21 @@ if File.file?(File.join(__dir__, 'run.rake')) end +else # in case of installed source gem the following tasks exist + + namespace :wxruby do + + namespace :gem do + + task :install do + if WXRuby3::Gem.install_gem + # binaries have been installed -> finish install + Rake::Task['wxruby:post:binpkg'].invoke + end + end + + end + + end + end diff --git a/rakelib/gem.rb b/rakelib/gem.rb index f24031a0..7f4ff1ea 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -16,6 +16,8 @@ require 'zlib' require 'tempfile' require 'json' +require 'uri' +require 'net/https' require_relative './lib/config' require_relative './install' @@ -24,139 +26,196 @@ module WXRuby3 module Gem - def self.manifest - # create MANIFEST list with included files - manifest = Rake::FileList.new - manifest.include %w[bin/*] # *nix executables in bin/ - manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows? - manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*] - manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" - manifest.include 'ext/ext_conf.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' - manifest.exclude 'ext/wxruby3/swig/classes/**/*' - manifest.include 'rakelib/**/*' - manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] - manifest.include 'rakefile' - manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts} - manifest - end + class << self + + # Gem helpers + + def manifest + unless @gem_manifest + # create MANIFEST list with included files + @gem_manifest = Rake::FileList.new + @gem_manifest.include %w[bin/*] # *nix executables in bin/ + @gem_manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows? + @gem_manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*] + @gem_manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" + @gem_manifest.include 'ext/mkrf_conf_ext.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' + @gem_manifest.exclude 'ext/wxruby3/swig/classes/**/*' + @gem_manifest.include 'rakelib/**/*' + @gem_manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] + @gem_manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts} + end + @gem_manifest + end - def self.bin_pkg_manifest - # create MANIFEST list with included files - manifest = Rake::FileList.new - manifest.include "lib/*.#{WXRuby3.config.dll_mask}" - if WXRuby3.config.get_config('with-wxwin') - manifest.include "ext/*.#{WXRuby3.config.dll_mask}" + def define_spec(&block) + gemspec = ::Gem::Specification.new('wxruby3', WXRuby3::WXRUBY_VERSION) + gemspec.required_rubygems_version = ::Gem::Requirement.new(">= 0") if gemspec.respond_to? :required_rubygems_version= + block.call(gemspec) if block_given? + gemspec end - manifest - end - def self.define_spec(version, &block) - gemspec = ::Gem::Specification.new('wxruby3', version) - gemspec.required_rubygems_version = ::Gem::Requirement.new(">= 0") if gemspec.respond_to? :required_rubygems_version= - block.call(gemspec) if block_given? - gemspec - end + def gem_name + define_spec.full_name + end + private :gem_name - def self.gem_name(version) - define_spec(version).full_name - end + def gem_file + File.join('pkg', "#{gem_name}.gem") + end - def self.gem_file(version) - File.join('pkg', "#{WXRuby3::Gem.gem_name(version)}.gem") - end + def build_gem(gemspec) + if defined?(::Gem::Package) && ::Gem::Package.respond_to?(:build) + gem_file_name = ::Gem::Package.build(gemspec) + else + gem_file_name = ::Gem::Builder.new(gemspec).build + end - def self.build_gem(gemspec) - if defined?(::Gem::Package) && ::Gem::Package.respond_to?(:build) - gem_file_name = ::Gem::Package.build(gemspec) - else - gem_file_name = ::Gem::Builder.new(gemspec).build + FileUtils.mkdir_p('pkg') + + FileUtils.mv(gem_file_name, 'pkg') end - FileUtils.mkdir_p('pkg') + # Binary package helpers - FileUtils.mv(gem_file_name, 'pkg') - end + def bin_pkg_manifest + unless @binpkg_manifest + # create MANIFEST list with included files + @binpkg_manifest = Rake::FileList.new + @binpkg_manifest.include "lib/*.#{WXRuby3.config.dll_mask}" + @binpkg_manifest.include "lib/wx/doc/gen/**/*.rb" + if WXRuby3.config.get_config('with-wxwin') + @binpkg_manifest.include "ext/*.#{WXRuby3.config.dll_mask}" + end + end + @binpkg_manifest + end - def self.make_bin_name - if WXRuby3.config.platform == :linux - distro = Config::Platform::PkgManager.distro - "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}" - else - "wxruby3_#{WXRuby3.config.platform}" + def make_bin_name + if WXRuby3.config.platform == :linux + distro = Config::Platform::PkgManager.distro + "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}" + else + "wxruby3_#{WXRuby3.config.platform}" + end end - end + private :make_bin_name - def self.bin_pkg_name(version) - gemspec = ::Gem::Specification.new(make_bin_name, version) - gemspec.platform = ::Gem::Platform.local.to_s - gemspec.full_name - end + def bin_pkg_name + gemspec = ::Gem::Specification.new(make_bin_name, WXRuby3::WXRUBY_VERSION) + gemspec.platform = ::Gem::Platform.local.to_s + gemspec.full_name + end + private :bin_pkg_name - def self.bin_pkg_file(version) - File.join('pkg', "#{WXRuby3::Gem.bin_pkg_name(version)}.pkg") - end + def bin_pkg_file + File.join('pkg', "#{bin_pkg_name}.pkg") + end - def self.build_bin_pkg(fname, manifest) - # make sure pkg directory exists - FileUtils.mkdir_p('pkg') - - # package registry - registry = [] - # package temp deflate stream - deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true) - begin - # pack binaries into temp deflate stream - manifest.each do |path| - pack = true - entry = [path, File.stat(path).mode, 0] - unless WXRuby3.config.windows? - if File.symlink?(path) - pack = false - entry << File.readlink(path) - end + def build_bin_pkg(fname) + # make sure pkg directory exists + FileUtils.mkdir_p('pkg') + + # package registry + registry = [] + # package temp deflate stream + deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true) + begin + # pack binaries into temp deflate stream + bin_pkg_manifest.each do |path| + registry << pack_file(deflate_stream, path) end - if pack - offs = deflate_stream.tell - deflate_stream.write(Zlib::Deflate.deflate(File.read(path, binmode: true))) - entry[2] = deflate_stream.tell - offs # packed data size + # convert registry to deflated json string + registry_json_z = Zlib::Deflate.deflate(registry.to_json) + # create final package archive + deflate_stream.rewind + File.open(fname, 'w', binmode: true) do |fout| + fout.write([registry_json_z.size].pack('Q')) + fout.write(registry_json_z) + registry.each do |entry| + fout.write(deflate_stream.read(entry[2])) if entry[2] > 0 + end end - registry << entry + ensure + deflate_stream.close(true) end - # convert registry to deflated json string - registry_json_z = Zlib::Deflate.deflate(registry.to_json) - # create final package archive - deflate_stream.rewind - File.open(fname, 'w', binmode: true) do |fout| - fout.write([registry_json_z.size].pack('Q')) - fout.write(registry_json_z) - registry.each do |entry| - fout.write(deflate_stream.read(entry[2])) if entry[2] > 0 + end + + def pack_file(os, path) + pack = true + entry = [path, File.stat(path).mode, 0] + unless WXRuby3.config.windows? + if File.symlink?(path) + pack = false + entry << File.readlink(path) end end - ensure - deflate_stream.close(true) + if pack + offs = os.tell + os.write(Zlib::Deflate.deflate(File.read(path, binmode: true))) + entry[2] = os.tell - offs # packed data size + end + entry end - end + private :pack_file + + # Gem installation helpers - def self.install_bin_pkg(fname) - File.open(fname, 'r', binmode: true) do |fin| - # get packed registry size - registry_size = fin.read(8).unpack('Q').shift - # unpack registry - registry = JSON.parse!(Zlib::Inflate.inflate(fin.read(registry_size))) - # unpack and create binaries - registry.each do |entry| - path, mode, size, symlink = entry - if symlink - FileUtils.ln_s(symlink, path) + def install_gem + # check if there exists a pre-built binary release package for the current platform + if has_release_package? + # download the binary release package + $stdout.puts "Downloading #{bin_pkg_url}..." + if WXRuby3.config.download_file(bin_pkg_url, bin_pkg_name+'.pkg') + install_bin_pkg(bin_pkg_name+'.pkg') else - File.open(path, 'w', binmode: true) do |fbin| - fbin << Zlib::Inflate.inflate(fin.read(size)) + $stdout.puts "WARNING: Unable to download binary release package (#{bin_pkg_name})! Reverting to source install." + end + end + end + + def bin_pkg_url + # which package are we looking for + pkg_name = bin_pkg_name + "https://github.com/mcorino/wxRuby3/releases/download/v#{WXRuby3::WXRUBY_VERSION}/#{pkg_name}.pkg" + end + private :bin_pkg_url + + def has_release_package? + # check if the release package exists on Github + uri = URI(bin_pkg_url) + $stdout.print "Checking #{uri.to_s}..." if WXRuby3.config.verbose? + response = Net::HTTP.start('github.com', use_ssl: true) do |http| + request = Net::HTTP::Head.new(uri) + http.request(request) + end + $stdout.puts "response #{response}" if WXRuby3.config.verbose? + # directly found or with redirect + response.code.to_i == 200 || response.code.to_i == 302 + end + private :has_release_package? + + def install_bin_pkg(fname) + File.open(fname, 'r', binmode: true) do |fin| + # get packed registry size + registry_size = fin.read(8).unpack('Q').shift + # unpack registry + registry = JSON.parse!(Zlib::Inflate.inflate(fin.read(registry_size))) + # unpack and create binaries + registry.each do |entry| + path, mode, size, symlink = entry + if symlink + FileUtils.ln_s(symlink, path) + else + File.open(path, 'w', binmode: true) do |fbin| + fbin << Zlib::Inflate.inflate(fin.read(size)) + end + File.chmod(mode, path) end - File.chmod(mode, path) end end end + private :install_bin_pkg + end end diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 63f08aa9..5deec55e 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -381,6 +381,10 @@ def check_tool_pkgs [] end + def download_file(_url, _dest) + raise NoMethodError + end + def install_prerequisites pkg_deps = check_tool_pkgs if get_config('autoinstall') == false diff --git a/rakelib/lib/config/mingw.rb b/rakelib/lib/config/mingw.rb index 6c61b478..2f789800 100644 --- a/rakelib/lib/config/mingw.rb +++ b/rakelib/lib/config/mingw.rb @@ -171,7 +171,7 @@ def download_and_install(url, zip, exe, unpack_to=nil) mkdir(tmp_tool_root) unless File.directory?(tmp_tool_root) # download chdir(tmp_tool_root) do - unless sh("curl -L #{url} --output #{zip}") + unless download_file(url, zip) STDERR.puts "ERROR: Failed to download installation package for #{exe}" exit(1) end diff --git a/rakelib/lib/config/unixish.rb b/rakelib/lib/config/unixish.rb index b6aed2ba..68c73403 100644 --- a/rakelib/lib/config/unixish.rb +++ b/rakelib/lib/config/unixish.rb @@ -74,6 +74,10 @@ def expand(cmd) s end + def download_file(url, dest) + sh("curl -L #{url} --output #{dest}") + end + private def wx_checkout diff --git a/rakelib/prepost.rake b/rakelib/prepost.rake index bd2bf785..26f49871 100644 --- a/rakelib/prepost.rake +++ b/rakelib/prepost.rake @@ -29,14 +29,19 @@ namespace 'wxruby' do $stdout.puts 'done!' if WXRuby3.config.run_silent? # cleanup rm_rf('rakelib', verbose: !WXRuby3.config.run_silent?) + rm_f('Rakefile') + rm_f('ext/mkrf_conf_ext.rb') rm_rf('ext/wxruby3', verbose: !WXRuby3.config.run_silent?) WXRuby3.config.cleanup_bootstrap File.open(File.join(WXRuby3::Config.wxruby_root, 'ext', 'wxruby.setup.done'), 'w') { |f| f << '1' } end - task :bingem => 'gem:install' do + task :binpkg => 'gem:install' do # cleanup rm_rf('rakelib') + rm_f('Rakefile') + rm_f('ext/mkrf_conf_ext.rb') + rm_f('*.pkg') File.open(File.join(WXRuby3::Config.wxruby_root, 'ext', 'wxruby.setup.done'), 'w') { |f| f << '1' } end From 4c59f19aba4bd4d994a83830a111b9f40484d427 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 16:57:50 +0100 Subject: [PATCH 040/168] make sure to generate docs before packaging --- rakelib/gem.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index a67eefb0..2365f7be 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -132,7 +132,7 @@ if File.file?(File.join(__dir__, 'run.rake')) namespace :wxruby do namespace :gem do - task :binpkg => ['wxruby:build', 'bin:build', WXRuby3::Gem.bin_pkg_file] + task :binpkg => ['wxruby:build', 'wxruby:doc', 'bin:build', WXRuby3::Gem.bin_pkg_file] end end From 608fa88a15729c83858fd107aeca67f8ea336c70 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 18:28:37 +0100 Subject: [PATCH 041/168] update post install cleanups --- rakelib/prepost.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rakelib/prepost.rake b/rakelib/prepost.rake index 26f49871..1289f8c0 100644 --- a/rakelib/prepost.rake +++ b/rakelib/prepost.rake @@ -29,8 +29,8 @@ namespace 'wxruby' do $stdout.puts 'done!' if WXRuby3.config.run_silent? # cleanup rm_rf('rakelib', verbose: !WXRuby3.config.run_silent?) - rm_f('Rakefile') - rm_f('ext/mkrf_conf_ext.rb') + rm_f('Rakefile', verbose: !WXRuby3.config.run_silent?) + rm_f('ext/mkrf_conf_ext.rb', verbose: !WXRuby3.config.run_silent?) rm_rf('ext/wxruby3', verbose: !WXRuby3.config.run_silent?) WXRuby3.config.cleanup_bootstrap File.open(File.join(WXRuby3::Config.wxruby_root, 'ext', 'wxruby.setup.done'), 'w') { |f| f << '1' } @@ -41,6 +41,7 @@ namespace 'wxruby' do rm_rf('rakelib') rm_f('Rakefile') rm_f('ext/mkrf_conf_ext.rb') + rm_rf('ext/wxruby3') rm_f('*.pkg') File.open(File.join(WXRuby3::Config.wxruby_root, 'ext', 'wxruby.setup.done'), 'w') { |f| f << '1' } end From 4de1ee3b83163bbe70ec349959db3e6140823857 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 9 Feb 2024 18:28:50 +0100 Subject: [PATCH 042/168] do not cache manifests --- rakelib/gem.rb | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 7f4ff1ea..dd766e21 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -31,20 +31,18 @@ class << self # Gem helpers def manifest - unless @gem_manifest - # create MANIFEST list with included files - @gem_manifest = Rake::FileList.new - @gem_manifest.include %w[bin/*] # *nix executables in bin/ - @gem_manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows? - @gem_manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*] - @gem_manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" - @gem_manifest.include 'ext/mkrf_conf_ext.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' - @gem_manifest.exclude 'ext/wxruby3/swig/classes/**/*' - @gem_manifest.include 'rakelib/**/*' - @gem_manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] - @gem_manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts} - end - @gem_manifest + # create MANIFEST list with included files + manifest = Rake::FileList.new + manifest.include %w[bin/*] # *nix executables in bin/ + manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows? + manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*] + manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}" + manifest.include 'ext/mkrf_conf_ext.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*' + manifest.exclude 'ext/wxruby3/swig/classes/**/*' + manifest.include 'rakelib/**/*' + manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*] + manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts} + manifest end def define_spec(&block) @@ -78,16 +76,14 @@ def build_gem(gemspec) # Binary package helpers def bin_pkg_manifest - unless @binpkg_manifest - # create MANIFEST list with included files - @binpkg_manifest = Rake::FileList.new - @binpkg_manifest.include "lib/*.#{WXRuby3.config.dll_mask}" - @binpkg_manifest.include "lib/wx/doc/gen/**/*.rb" - if WXRuby3.config.get_config('with-wxwin') - @binpkg_manifest.include "ext/*.#{WXRuby3.config.dll_mask}" - end + # create MANIFEST list with included files + manifest = Rake::FileList.new + manifest.include "lib/*.#{WXRuby3.config.dll_mask}" + manifest.include "lib/wx/doc/gen/**/*.rb" + if WXRuby3.config.get_config('with-wxwin') + manifest.include "ext/*.#{WXRuby3.config.dll_mask}" end - @binpkg_manifest + manifest end def make_bin_name From db4c70ebef749f8eede7b7a1dae561ee74fb5e89 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 09:04:41 +0100 Subject: [PATCH 043/168] use response class types --- rakelib/gem.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index dd766e21..496cd111 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -186,7 +186,7 @@ def has_release_package? end $stdout.puts "response #{response}" if WXRuby3.config.verbose? # directly found or with redirect - response.code.to_i == 200 || response.code.to_i == 302 + Net::HTTPOK === response || Net::HTTPRedirection === response end private :has_release_package? From 8e4d03e94faaaa506b8df48b4196f2ee401433d0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 10:37:43 +0100 Subject: [PATCH 044/168] encode ruby major+minor version in bin pkg name for ABI compatibility --- rakelib/gem.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 496cd111..197d2808 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -89,9 +89,9 @@ def bin_pkg_manifest def make_bin_name if WXRuby3.config.platform == :linux distro = Config::Platform::PkgManager.distro - "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}" + "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3.config.rb_ver_major}#{WXRuby3.config.rb_ver_minor}" else - "wxruby3_#{WXRuby3.config.platform}" + "wxruby3_#{WXRuby3.config.platform}_ruby#{WXRuby3.config.rb_ver_major}#{WXRuby3.config.rb_ver_minor}" end end private :make_bin_name From e23d23ffe2d8f97f25d23720e76badf1612d4ef8 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 12:26:31 +0100 Subject: [PATCH 045/168] extend and improve cirrus tasks --- .cirrus.yml | 122 +++++++++++++++--- tools/scripts/cirrus/build-wxruby3.sh | 9 ++ .../cirrus/setup-debian-system-ruby.sh | 7 + tools/scripts/{ => cirrus}/setup-debian.sh | 2 + .../cirrus/setup-fedora-system-ruby.sh | 7 + tools/scripts/{ => cirrus}/setup-fedora.sh | 2 + .../cirrus/setup-opensuse-system-ruby.sh | 7 + tools/scripts/{ => cirrus}/setup-opensuse.sh | 2 + .../cirrus/setup-ruby-install-latest.sh | 20 +++ .../cirrus/setup-ubuntu-system-ruby.sh | 7 + tools/scripts/{ => cirrus}/setup-ubuntu.sh | 2 + .../upload-release-pkg.rb} | 0 12 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 tools/scripts/cirrus/build-wxruby3.sh create mode 100755 tools/scripts/cirrus/setup-debian-system-ruby.sh rename tools/scripts/{ => cirrus}/setup-debian.sh (79%) mode change 100644 => 100755 create mode 100755 tools/scripts/cirrus/setup-fedora-system-ruby.sh rename tools/scripts/{ => cirrus}/setup-fedora.sh (80%) mode change 100644 => 100755 create mode 100755 tools/scripts/cirrus/setup-opensuse-system-ruby.sh rename tools/scripts/{ => cirrus}/setup-opensuse.sh (81%) mode change 100644 => 100755 create mode 100755 tools/scripts/cirrus/setup-ruby-install-latest.sh create mode 100755 tools/scripts/cirrus/setup-ubuntu-system-ruby.sh rename tools/scripts/{ => cirrus}/setup-ubuntu.sh (79%) mode change 100644 => 100755 rename tools/scripts/{cirrus-upload-release-pkg.rb => cirrus/upload-release-pkg.rb} (100%) diff --git a/.cirrus.yml b/.cirrus.yml index 5a52baa8..a4c69eeb 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,9 +6,9 @@ env: WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' GITHUB_TOKEN: ENCRYPTED[2ce3914266dec78118dd9706c25d2e52fbd164f86713692efde9b8af5f0159099cb299934a8d6279e524da7a0790e025] -task: +verify_task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" - only_if: $CIRRUS_BRANCH =~ 'pull/.*' || $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' + only_if: $CIRRUS_BRANCH =~ 'master' matrix: - name: Cirrus CI / Fedora AMD64 container: @@ -75,10 +75,10 @@ task: osname: linux distro: debian - before_script: | + ./tools/scripts/cirrus/setup-$distro.sh - . tools/scripts/setup-$distro.sh + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh # Show some information about the system. uname -a @@ -86,28 +86,108 @@ task: locale -a build_script: | - curl -sSL https://rvm.io/mpapis.asc | gpg --import - - \curl -sSL https://get.rvm.io | bash -s head - export PATH="$PATH:$HOME/.rvm/bin" - . /usr/local/rvm/scripts/rvm && rvm install ruby-3.2 - . /usr/local/rvm/scripts/rvm && rvm alias create default ruby-3.2 - - ruby -v + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - bundle install - - bundle exec rake configure[--with-wxwin,--autoinstall] + test_script: + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" - bundle exec rake build +release_task: + only_if: $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' + matrix: + - name: Cirrus CI / Fedora AMD64 + container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / Fedora ARM64 + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / OpenSuSE Leap AMD64 + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / Ubuntu AMD64 + container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Debian AMD64 + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / Debian ARM64 + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian - test_script: - . /usr/local/rvm/scripts/rvm + before_script: | + ./tools/scripts/cirrus/setup-$distro.sh - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + # Show some information about the system. + uname -a + locale + locale -a - release_script: - . /usr/local/rvm/scripts/rvm + system_build_script: | + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh + + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log + + bundle exec rake binpkg + + system_cleanup_script: | + bundle exec rake clean + rm -rf ext/wxWidgets + rm -f .wxconfig + + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove + + latest_build_script: + ./tools/scripts/setup-ruby-install-latest.sh + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log + bundle exec rake binpkg - ruby tools/scripts/cirrus-upload-release-pkg.rb + release_script: + + ruby tools/scripts/cirrus/upload-release-pkg.rb diff --git a/tools/scripts/cirrus/build-wxruby3.sh b/tools/scripts/cirrus/build-wxruby3.sh new file mode 100644 index 00000000..9c914ba4 --- /dev/null +++ b/tools/scripts/cirrus/build-wxruby3.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ruby -v + +bundle install + +bundle exec rake configure[--with-wxwin,--autoinstall] + +bundle exec rake build diff --git a/tools/scripts/cirrus/setup-debian-system-ruby.sh b/tools/scripts/cirrus/setup-debian-system-ruby.sh new file mode 100755 index 00000000..876c38b8 --- /dev/null +++ b/tools/scripts/cirrus/setup-debian-system-ruby.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ "$1" == "remove" ]; then + apt-get remove -y ruby ruby-dev +else + apt-get install -y ruby ruby-dev +fi diff --git a/tools/scripts/setup-debian.sh b/tools/scripts/cirrus/setup-debian.sh old mode 100644 new mode 100755 similarity index 79% rename from tools/scripts/setup-debian.sh rename to tools/scripts/cirrus/setup-debian.sh index 7ea01cc9..4e64838d --- a/tools/scripts/setup-debian.sh +++ b/tools/scripts/cirrus/setup-debian.sh @@ -1,2 +1,4 @@ +#!/usr/bin/env bash + apt-get update apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps diff --git a/tools/scripts/cirrus/setup-fedora-system-ruby.sh b/tools/scripts/cirrus/setup-fedora-system-ruby.sh new file mode 100755 index 00000000..fc392f48 --- /dev/null +++ b/tools/scripts/cirrus/setup-fedora-system-ruby.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ "$1" == "remove" ]; then + dnf remove -y ruby ruby-devel +else + dnf install -y ruby ruby-devel +fi diff --git a/tools/scripts/setup-fedora.sh b/tools/scripts/cirrus/setup-fedora.sh old mode 100644 new mode 100755 similarity index 80% rename from tools/scripts/setup-fedora.sh rename to tools/scripts/cirrus/setup-fedora.sh index 45346844..bbac7ee4 --- a/tools/scripts/setup-fedora.sh +++ b/tools/scripts/cirrus/setup-fedora.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh new file mode 100755 index 00000000..c05c9251 --- /dev/null +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ "$1" == "remove" ]; then + zypper remove -y ruby ruby-devel +else + zypper install -y ruby ruby-devel +fi diff --git a/tools/scripts/setup-opensuse.sh b/tools/scripts/cirrus/setup-opensuse.sh old mode 100644 new mode 100755 similarity index 81% rename from tools/scripts/setup-opensuse.sh rename to tools/scripts/cirrus/setup-opensuse.sh index 10fbafc7..851fe0d0 --- a/tools/scripts/setup-opensuse.sh +++ b/tools/scripts/cirrus/setup-opensuse.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make tar gzip diff --git a/tools/scripts/cirrus/setup-ruby-install-latest.sh b/tools/scripts/cirrus/setup-ruby-install-latest.sh new file mode 100755 index 00000000..cf10911d --- /dev/null +++ b/tools/scripts/cirrus/setup-ruby-install-latest.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +curl -s -L https://raw.github.com/postmodern/postmodern.github.io/main/postmodern.asc --output postmodern.asc +gpg --import postmodern.asc + +RUBY_INSTALL_LATEST_URL=$(curl -s https://api.github.com/repos/postmodern/ruby-install/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep '.tar.gz$') +RUBY_INSTALL_LATEST_FILE=$(basename $RUBY_INSTALL_LATEST_URL) +RUBY_INSTALL_LATEST_DIR=$(basename -s .tar.gz $RUBY_INSTALL_LATEST_FILE) + +curl -s -L $RUBY_INSTALL_LATEST_URL --output $RUBY_INSTALL_LATEST_FILE +curl -s -L $RUBY_INSTALL_LATEST_URL.asc --output $RUBY_INSTALL_LATEST_FILE.asc + +gpg --verify $RUBY_INSTALL_LATEST_FILE.asc $RUBY_INSTALL_LATEST_FILE || exit 1 + +tar -xzf $RUBY_INSTALL_LATEST_FILE +cd $RUBY_INSTALL_LATEST_DIR +make install +cd .. + +ruby-install --system ruby -- --disable-install-rdoc diff --git a/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh b/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh new file mode 100755 index 00000000..876c38b8 --- /dev/null +++ b/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ "$1" == "remove" ]; then + apt-get remove -y ruby ruby-dev +else + apt-get install -y ruby ruby-dev +fi diff --git a/tools/scripts/setup-ubuntu.sh b/tools/scripts/cirrus/setup-ubuntu.sh old mode 100644 new mode 100755 similarity index 79% rename from tools/scripts/setup-ubuntu.sh rename to tools/scripts/cirrus/setup-ubuntu.sh index 7ea01cc9..4e64838d --- a/tools/scripts/setup-ubuntu.sh +++ b/tools/scripts/cirrus/setup-ubuntu.sh @@ -1,2 +1,4 @@ +#!/usr/bin/env bash + apt-get update apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps diff --git a/tools/scripts/cirrus-upload-release-pkg.rb b/tools/scripts/cirrus/upload-release-pkg.rb similarity index 100% rename from tools/scripts/cirrus-upload-release-pkg.rb rename to tools/scripts/cirrus/upload-release-pkg.rb From 40de6d1772a599cc0862d0abc24ff75d0bf6b308 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 13:21:18 +0100 Subject: [PATCH 046/168] force script update to commit executable bit --- tools/scripts/cirrus/build-wxruby3.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/scripts/cirrus/build-wxruby3.sh b/tools/scripts/cirrus/build-wxruby3.sh index 9c914ba4..0a3a8586 100644 --- a/tools/scripts/cirrus/build-wxruby3.sh +++ b/tools/scripts/cirrus/build-wxruby3.sh @@ -3,7 +3,5 @@ ruby -v bundle install - bundle exec rake configure[--with-wxwin,--autoinstall] - bundle exec rake build From 5cfd8de1cb73062eb2eb3ea93970db395a45977c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 15:39:52 +0100 Subject: [PATCH 047/168] force script update to commit executable bit --- tools/scripts/cirrus/build-wxruby3.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/scripts/cirrus/build-wxruby3.sh diff --git a/tools/scripts/cirrus/build-wxruby3.sh b/tools/scripts/cirrus/build-wxruby3.sh old mode 100644 new mode 100755 From 218b882533e17fce3d6aaf60a45d1847b751998a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 16:01:38 +0100 Subject: [PATCH 048/168] add bundler to system ruby install --- tools/scripts/cirrus/setup-debian-system-ruby.sh | 2 +- tools/scripts/cirrus/setup-fedora-system-ruby.sh | 2 +- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- tools/scripts/cirrus/setup-ubuntu-system-ruby.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/scripts/cirrus/setup-debian-system-ruby.sh b/tools/scripts/cirrus/setup-debian-system-ruby.sh index 876c38b8..56dba9a5 100755 --- a/tools/scripts/cirrus/setup-debian-system-ruby.sh +++ b/tools/scripts/cirrus/setup-debian-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then apt-get remove -y ruby ruby-dev else - apt-get install -y ruby ruby-dev + apt-get install -y ruby ruby-dev ruby-bundler fi diff --git a/tools/scripts/cirrus/setup-fedora-system-ruby.sh b/tools/scripts/cirrus/setup-fedora-system-ruby.sh index fc392f48..f2a0e65b 100755 --- a/tools/scripts/cirrus/setup-fedora-system-ruby.sh +++ b/tools/scripts/cirrus/setup-fedora-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then dnf remove -y ruby ruby-devel else - dnf install -y ruby ruby-devel + dnf install -y ruby ruby-devel rubygem-bundler fi diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index c05c9251..3fd92ed3 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel else - zypper install -y ruby ruby-devel + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler fi diff --git a/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh b/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh index 876c38b8..56dba9a5 100755 --- a/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh +++ b/tools/scripts/cirrus/setup-ubuntu-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then apt-get remove -y ruby ruby-dev else - apt-get install -y ruby ruby-dev + apt-get install -y ruby ruby-dev ruby-bundler fi From 9fbb75a9ce97f783551e229b0751629408aaec98 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 16:12:28 +0100 Subject: [PATCH 049/168] fix typos --- rakelib/gem.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 197d2808..a61e51c3 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -89,9 +89,9 @@ def bin_pkg_manifest def make_bin_name if WXRuby3.config.platform == :linux distro = Config::Platform::PkgManager.distro - "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3.config.rb_ver_major}#{WXRuby3.config.rb_ver_minor}" + "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" else - "wxruby3_#{WXRuby3.config.platform}_ruby#{WXRuby3.config.rb_ver_major}#{WXRuby3.config.rb_ver_minor}" + "wxruby3_#{WXRuby3.config.platform}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" end end private :make_bin_name From d616ee1a8473302e6b62c74d7004fe028fa53e10 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 16:41:09 +0100 Subject: [PATCH 050/168] fix typos --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index a4c69eeb..425eac7e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -182,7 +182,7 @@ release_task: ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove latest_build_script: - ./tools/scripts/setup-ruby-install-latest.sh + ./tools/scripts/cirrus/setup-ruby-install-latest.sh ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log From 7de916e40f30736682b2657fca3c9973e243b276 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 17:24:24 +0100 Subject: [PATCH 051/168] use proper build config --- tools/scripts/cirrus/setup-ruby-install-latest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-ruby-install-latest.sh b/tools/scripts/cirrus/setup-ruby-install-latest.sh index cf10911d..06fafff1 100755 --- a/tools/scripts/cirrus/setup-ruby-install-latest.sh +++ b/tools/scripts/cirrus/setup-ruby-install-latest.sh @@ -17,4 +17,4 @@ cd $RUBY_INSTALL_LATEST_DIR make install cd .. -ruby-install --system ruby -- --disable-install-rdoc +ruby-install --system ruby -- --disable-install-rdoc --enable-shared From 3eb128f860ea942a90fc36f80371e500de8afe52 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 17:24:45 +0100 Subject: [PATCH 052/168] add release signing --- .cirrus.yml | 3 ++ tools/scripts/cirrus/upload-release-pkg.rb | 39 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 425eac7e..bbb00556 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -93,6 +93,9 @@ verify_task: release_task: only_if: $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' + env: + PGP_KEY: ENCRYPTED[7c3f8ed70455ee2b41ed3b2a0d012bd524a983666915491dc8fd5d460eec2b7b8c851656f36fa0b97dee836a38ee0d2a] + PGP_PASSPHRASE: ENCRYPTED[a6134f1d2c9813f1a8ae4ced6f185f2bad5ca0c434bb31618e0ab87824e7884025708c2580b128f7eda730b5deae8baf] matrix: - name: Cirrus CI / Fedora AMD64 container: diff --git a/tools/scripts/cirrus/upload-release-pkg.rb b/tools/scripts/cirrus/upload-release-pkg.rb index e7ea963c..fb3a9f08 100644 --- a/tools/scripts/cirrus/upload-release-pkg.rb +++ b/tools/scripts/cirrus/upload-release-pkg.rb @@ -27,8 +27,27 @@ end end +$PGP_KEY = ENV['PGP_KEY'] || '' +$PGP_PASSPHRASE = ENV['PGP_PASSPHRASE'] +if $PGP_KEY.empty? + $stderr.puts 'Provide PGP key for release signing via PGP_KEY environment variable!' + exit(1) +end + +# import signing key +unless system(%Q{echo -n "#{$PGP_KEY}" | base64 --decode | gpg --pinentry-mode loopback --batch --passphrase #{$PGP_PASSPHRASE} --import}) + exit(1) +end + file_content_type="application/octet-stream" Dir.glob(File.join('pkg', '*.pkg')).each do |fpath| + + # sign release + unless system(%Q{gpg --detach-sign --pinentry-mode loopback --batch --passphrase #{$PGP_PASSPHRASE} --armor #{fpath}}) + $stderr.puts "Failed to sign release asset #{fpath}!" + exit(1) + end + name = File.basename(fpath) url_to_upload = "https://uploads.github.com/repos/mcorino/wxruby3/releases/#{$CIRRUS_RELEASE}/assets?name=#{name}" puts "Uploading #{fpath} for release #{$CIRRUS_RELEASE} to #{url_to_upload}..." @@ -38,12 +57,18 @@ "-H \"Content-Type: #{file_content_type}\" " + "#{url_to_upload} --data-binary @#{fpath}" result = `#{cmd}` - if $?.success? - data = JSON.parse!(result) - exit(0) if data['browser_download_url'] - $stderr.puts "Failed to upload release asset [#{result}]!" - else - $stderr.puts "Curl failed to upload release asset!" + rc = $?.success? && JSON.parse!(result)['browser_download_url'] + if rc + cmd = "curl -L -X POST -H \"Accept: application/vnd.github+json\" " + + "-H \"Authorization: token #{$GITHUB_TOKEN}\" " + + "-H \"X-GitHub-Api-Version: 2022-11-28\" " + + "-H \"Content-Type: #{file_content_type}\" " + + "#{url_to_upload}.asc --data-binary @#{fpath}.asc" + result = `#{cmd}` + rc = $?.success? && JSON.parse!(result)['browser_download_url'] + end + unless rc + $stderr.puts "Failed to upload release asset!" + exit(1) end - exit(1) end From 83de946530c02db6b31e662d9981bb165c549120 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 18:01:55 +0100 Subject: [PATCH 053/168] revert release signing --- .cirrus.yml | 3 --- tools/scripts/cirrus/upload-release-pkg.rb | 28 ---------------------- 2 files changed, 31 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index bbb00556..425eac7e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -93,9 +93,6 @@ verify_task: release_task: only_if: $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' - env: - PGP_KEY: ENCRYPTED[7c3f8ed70455ee2b41ed3b2a0d012bd524a983666915491dc8fd5d460eec2b7b8c851656f36fa0b97dee836a38ee0d2a] - PGP_PASSPHRASE: ENCRYPTED[a6134f1d2c9813f1a8ae4ced6f185f2bad5ca0c434bb31618e0ab87824e7884025708c2580b128f7eda730b5deae8baf] matrix: - name: Cirrus CI / Fedora AMD64 container: diff --git a/tools/scripts/cirrus/upload-release-pkg.rb b/tools/scripts/cirrus/upload-release-pkg.rb index fb3a9f08..56ee2d03 100644 --- a/tools/scripts/cirrus/upload-release-pkg.rb +++ b/tools/scripts/cirrus/upload-release-pkg.rb @@ -27,27 +27,8 @@ end end -$PGP_KEY = ENV['PGP_KEY'] || '' -$PGP_PASSPHRASE = ENV['PGP_PASSPHRASE'] -if $PGP_KEY.empty? - $stderr.puts 'Provide PGP key for release signing via PGP_KEY environment variable!' - exit(1) -end - -# import signing key -unless system(%Q{echo -n "#{$PGP_KEY}" | base64 --decode | gpg --pinentry-mode loopback --batch --passphrase #{$PGP_PASSPHRASE} --import}) - exit(1) -end - file_content_type="application/octet-stream" Dir.glob(File.join('pkg', '*.pkg')).each do |fpath| - - # sign release - unless system(%Q{gpg --detach-sign --pinentry-mode loopback --batch --passphrase #{$PGP_PASSPHRASE} --armor #{fpath}}) - $stderr.puts "Failed to sign release asset #{fpath}!" - exit(1) - end - name = File.basename(fpath) url_to_upload = "https://uploads.github.com/repos/mcorino/wxruby3/releases/#{$CIRRUS_RELEASE}/assets?name=#{name}" puts "Uploading #{fpath} for release #{$CIRRUS_RELEASE} to #{url_to_upload}..." @@ -58,15 +39,6 @@ "#{url_to_upload} --data-binary @#{fpath}" result = `#{cmd}` rc = $?.success? && JSON.parse!(result)['browser_download_url'] - if rc - cmd = "curl -L -X POST -H \"Accept: application/vnd.github+json\" " + - "-H \"Authorization: token #{$GITHUB_TOKEN}\" " + - "-H \"X-GitHub-Api-Version: 2022-11-28\" " + - "-H \"Content-Type: #{file_content_type}\" " + - "#{url_to_upload}.asc --data-binary @#{fpath}.asc" - result = `#{cmd}` - rc = $?.success? && JSON.parse!(result)['browser_download_url'] - end unless rc $stderr.puts "Failed to upload release asset!" exit(1) From b8df0477fe215bf7bf6707d2fae28c46183d0ac1 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 18:14:40 +0100 Subject: [PATCH 054/168] add gem GPG signing --- .github/workflows/release.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2d40b4e..61375eb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,6 +50,12 @@ jobs: run: | bundle exec rake gem + - name: Create GPG signature for wxRuby3 gem + if: ${{ github.event_name != 'workflow_dispatch' }} + run: | + echo -n "${{ secrets.GPG_KEY }}" | base64 --decode | gpg --pinentry-mode loopback --batch --passphrase ${{ secrets.GPG_PASSPHRASE }} --import + gpg --detach-sign --pinentry-mode loopback --batch --passphrase ${{ secrets.GPG_PASSPHRASE }} --armor pkg/*.gem + - name: Upload gem to release if: ${{ github.event_name != 'workflow_dispatch' }} uses: svenstaro/upload-release-action@v2 @@ -60,6 +66,16 @@ jobs: overwrite: true file_glob: true + - name: Upload gem GPG signature to release + if: ${{ github.event_name != 'workflow_dispatch' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.gem.asc + tag: ${{ github.ref }} + overwrite: true + file_glob: true + - name: Publish Gem on RubyGems if: ${{ github.event_name != 'workflow_dispatch' }} run: | From 37b8103f043ad4071e8863b46693fcf16e08c476 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 18:29:29 +0100 Subject: [PATCH 055/168] fix compatibility issue for 'old' rubies (2.5 on opensuse) --- rakelib/lib/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 5deec55e..1745791b 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -280,7 +280,7 @@ def do_run(*cmd, capture: nil) end begin # setup ENV for child execution - ENV.merge!(Config.instance.exec_env) + ENV.update(Config.instance.exec_env) output = `#{cmd.join(' ')}` ensure # restore ENV From 535153339c6ac7cc664671befdad6db911bad5a4 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 18:50:58 +0100 Subject: [PATCH 056/168] add zlib-devel which seems to be missing for ARM docker image --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index 3fd92ed3..e5f1ed93 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel else - zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler zlib-devel fi From b30963d96883e955d57e02d92ba2bb20ba05d948 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 10 Feb 2024 18:52:52 +0100 Subject: [PATCH 057/168] add Gemfile.lock removal --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 425eac7e..3b4f25b7 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -178,6 +178,7 @@ release_task: bundle exec rake clean rm -rf ext/wxWidgets rm -f .wxconfig + rm -f Gemfile.lock ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove From 3097f68cda2bcd1b228c5f596c1e78754d5c80af Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 10:48:19 +0100 Subject: [PATCH 058/168] add more dependencies --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index e5f1ed93..a7d709d4 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel else - zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler zlib-devel + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler zlib-devel libopenssl-devel readline-devel fi From cd82a9b76359570a2007b3c6acb95ce813c4bdc0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 12:06:06 +0100 Subject: [PATCH 059/168] create test_release task; run release_task only on proper release --- .cirrus.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3b4f25b7..908b636d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -92,7 +92,7 @@ verify_task: /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" release_task: - only_if: $CIRRUS_RELEASE != '' || $CIRRUS_BUILD_SOURCE == 'api' + only_if: $CIRRUS_RELEASE != '' matrix: - name: Cirrus CI / Fedora AMD64 container: @@ -192,3 +192,57 @@ release_task: release_script: ruby tools/scripts/cirrus/upload-release-pkg.rb + +test_release_task: + only_if: $CIRRUS_BUILD_SOURCE == 'api' + matrix: + - name: Cirrus CI / OpenSuSE Leap AMD64 + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + + before_script: | + ./tools/scripts/cirrus/setup-$distro.sh + + # Show some information about the system. + uname -a + locale + locale -a + + system_build_script: | + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh + + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log + + bundle exec rake binpkg + + system_cleanup_script: | + bundle exec rake clean + rm -rf ext/wxWidgets + rm -f .wxconfig + rm -f Gemfile.lock + + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove + + latest_build_script: + ./tools/scripts/cirrus/setup-ruby-install-latest.sh + + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log + + bundle exec rake binpkg + + release_script: + + ruby tools/scripts/cirrus/upload-release-pkg.rb From 5a7f7e24cc075df9fcf6aa956932479e1914c6be Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 12:31:32 +0100 Subject: [PATCH 060/168] add another dependency --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index a7d709d4..dfd3f91b 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -3,5 +3,5 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel else - zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler zlib-devel libopenssl-devel readline-devel + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler libffi-devel zlib-devel libopenssl-devel readline-devel fi From 43e85ed486dcb9648e1f3e8fc0e8147f51be4a4a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 14:09:19 +0100 Subject: [PATCH 061/168] fix platform setup --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index dfd3f91b..c66f3d0b 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash if [ "$1" == "remove" ]; then - zypper remove -y ruby ruby-devel + zypper remove -y ruby ruby-devel ruby2.5-rubygem-bundler libopenssl-1_1-devel + zypper install -y libopenssl-devel else - zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler libffi-devel zlib-devel libopenssl-devel readline-devel + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler fi From 8143e2704e7c650dcc5df340631b799f928bd49c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 14:37:02 +0100 Subject: [PATCH 062/168] trying to fix platform setup --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index c66f3d0b..ab1e36be 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash if [ "$1" == "remove" ]; then - zypper remove -y ruby ruby-devel ruby2.5-rubygem-bundler libopenssl-1_1-devel - zypper install -y libopenssl-devel + zypper remove -y ruby ruby-devel ruby2.5-rubygem-bundler + zypper install -y libyaml-devel else zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler fi From 73ae62a5c8f306d3e8f504d711acb93e670fb79a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 15:10:57 +0100 Subject: [PATCH 063/168] keep trying to fix platform setup --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index ab1e36be..0ecfc835 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -2,7 +2,7 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel ruby2.5-rubygem-bundler - zypper install -y libyaml-devel + zypper install -y libyaml-devel libopenssl-devel else zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler fi From 7705796e6376ddc19fd10034d6a8ccd990990948 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 15:17:08 +0100 Subject: [PATCH 064/168] keep trying to fix platform setup --- tools/scripts/cirrus/setup-opensuse-system-ruby.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh index 0ecfc835..56abc4ea 100755 --- a/tools/scripts/cirrus/setup-opensuse-system-ruby.sh +++ b/tools/scripts/cirrus/setup-opensuse-system-ruby.sh @@ -4,5 +4,5 @@ if [ "$1" == "remove" ]; then zypper remove -y ruby ruby-devel ruby2.5-rubygem-bundler zypper install -y libyaml-devel libopenssl-devel else - zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler + zypper install -y ruby ruby-devel ruby2.5-rubygem-bundler zlib-devel fi From eeb589d252ebf8f7156af91c6d64c8af09249b4b Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 16:27:37 +0100 Subject: [PATCH 065/168] make sure nested paths exist before creating install files --- rakelib/gem.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index a61e51c3..33db0055 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -18,6 +18,7 @@ require 'json' require 'uri' require 'net/https' +require 'fileutils' require_relative './lib/config' require_relative './install' @@ -200,8 +201,10 @@ def install_bin_pkg(fname) registry.each do |entry| path, mode, size, symlink = entry if symlink + FileUtils.mkdir_p(File.dirname(symlink)) FileUtils.ln_s(symlink, path) else + FileUtils.mkdir_p(File.dirname(path)) File.open(path, 'w', binmode: true) do |fbin| fbin << Zlib::Inflate.inflate(fin.read(size)) end From ecc772ba9b83bbc20b3bc24ffb474cf43350b89f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 16:39:24 +0100 Subject: [PATCH 066/168] add generated event lists, ext modules and font encodings to bin pkg --- rakelib/gem.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 33db0055..3400b21c 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -80,6 +80,7 @@ def bin_pkg_manifest # create MANIFEST list with included files manifest = Rake::FileList.new manifest.include "lib/*.#{WXRuby3.config.dll_mask}" + manifest.include 'lib/wx/**/events/*.rb', 'lib/wx/**/ext/*.rb', 'lib/wx/core/font/*.rb' manifest.include "lib/wx/doc/gen/**/*.rb" if WXRuby3.config.get_config('with-wxwin') manifest.include "ext/*.#{WXRuby3.config.dll_mask}" From 92f41aa0a857f3617232822c3f205aa0934ab662 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 16:42:26 +0100 Subject: [PATCH 067/168] rebuild all AMD64 pkgs --- .cirrus.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 908b636d..e572b342 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -196,6 +196,14 @@ release_task: test_release_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: + - name: Cirrus CI / Fedora AMD64 + container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora - name: Cirrus CI / OpenSuSE Leap AMD64 container: image: opensuse/leap:latest @@ -204,14 +212,22 @@ test_release_task: env: osname: linux distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 - arm_container: - image: opensuse/leap:latest + - name: Cirrus CI / Ubuntu AMD64 + container: + image: ubuntu:latest cpu: 4 memory: 8G env: osname: linux - distro: opensuse + distro: ubuntu + - name: Cirrus CI / Debian AMD64 + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian before_script: | ./tools/scripts/cirrus/setup-$distro.sh From cc72f06d5798f829b4e89a46f800f21ce5ac55e4 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 18:29:47 +0100 Subject: [PATCH 068/168] add missing require --- samples/sampler/sample.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/sampler/sample.rb b/samples/sampler/sample.rb index 83737c3b..98383a65 100644 --- a/samples/sampler/sample.rb +++ b/samples/sampler/sample.rb @@ -6,6 +6,8 @@ # wxRuby3 sampler application ### +require 'set' + module WxRuby ART_FOLDER = File.join(__dir__, '..', 'art') From 15a629d0ae013b594ed01d4a8064633914dd99e2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 18:47:41 +0100 Subject: [PATCH 069/168] update binpkg build for macosx --- rakelib/gem.rb | 3 +++ rakelib/lib/config/pkgman/macosx.rb | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 3400b21c..bc25b2a9 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -92,6 +92,9 @@ def make_bin_name if WXRuby3.config.platform == :linux distro = Config::Platform::PkgManager.distro "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" + elsif WXRuby3.config.platform == :macosx + distro = Config::Platform::PkgManager.distro + "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" else "wxruby3_#{WXRuby3.config.platform}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" end diff --git a/rakelib/lib/config/pkgman/macosx.rb b/rakelib/lib/config/pkgman/macosx.rb index 0e8fb7c3..f67e3f7c 100644 --- a/rakelib/lib/config/pkgman/macosx.rb +++ b/rakelib/lib/config/pkgman/macosx.rb @@ -16,6 +16,14 @@ module PkgManager class << self + def distro + @distro ||= { + type: 'darwin', + distro: 'macosx', + release: WXRuby3.config.expand('sw_vers -productVersion').strip.split('.').first + } + end + def install(pkgs) # do we need to install anything? if !pkgs.empty? From 9f08dc4cc2afb2750579545c0c9955c013f50b60 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 11 Feb 2024 18:47:58 +0100 Subject: [PATCH 070/168] add release test workflow --- .github/workflows/release-test.yml | 148 +++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..d0ea75e8 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,148 @@ +# CI wxRuby test release workflow +name: Testing Release builds + +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + release-windows-binpkg: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} wxRuby Binpkg 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.3' + swig: '4' + + steps: + - name: Checkout wxRuby3 + uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Setup Ruby gems + run: | + bundle install + + - name: Cache Doxygen + id: cache-doxygen + uses: actions/cache@v4 + 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 + 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 + run: | + echo "$env:PATH" + ruby -v + doxygen -v + ridk exec bash -c 'gcc -v' + ridk exec bash -c 'g++ -v' + + - name: Configure wxRuby3 + run: | + bundle exec rake configure[--with-wxwin,--autoinstall] + + - name: Build wxRuby3 + run: | + bundle exec rake build + + - name: Build wxRuby3 binpkg + run: | + bundle exec rake binpkg + + - name: Upload bin pkg as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.pkg + tag: v0.9.7 + overwrite: true + file_glob: true + release-macosx-binpkg: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) + env: + DOXYGEN_ROOT: ${{ github.workspace }}\doxygen + GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + strategy: + fail-fast: false + matrix: + include: + - name: macOS 13 + runner: macos-13 + arch: x86_64 + ruby: '3.3' + - name: macOS 14 + runner: macos-14 + arch: m1 + ruby: '3.3' + + steps: + - name: Checkout wxRuby3 + uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Setup Ruby gems + run: | + bundle install + + - name: Display build environment + run: | + echo "$env:PATH" + ruby -v + + - name: Configure wxRuby3 + run: | + bundle exec rake configure[--with-wxwin,--autoinstall] + + - name: Build wxRuby3 + run: | + bundle exec rake build + + - name: Build wxRuby3 binpkg + run: | + bundle exec rake binpkg + + - name: Upload bin pkg as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.pkg + tag: v0.9.7 + overwrite: true + file_glob: true From a0de43b30a06fa327cbb101a01df4c7ae7cadd0a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 08:49:31 +0100 Subject: [PATCH 071/168] fix release test workflow --- .github/workflows/release-test.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index d0ea75e8..2fd52b2f 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -15,9 +15,6 @@ jobs: release-windows-binpkg: runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) - env: - DOXYGEN_ROOT: ${{ github.workspace }}\doxygen - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} strategy: fail-fast: false matrix: @@ -91,11 +88,8 @@ jobs: overwrite: true file_glob: true release-macosx-binpkg: - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.runner }} name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) - env: - DOXYGEN_ROOT: ${{ github.workspace }}\doxygen - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} strategy: fail-fast: false matrix: From 82cdea91e6ee72ec4cd9b2665b792831aa1b589c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 09:08:38 +0100 Subject: [PATCH 072/168] fix release test workflow --- .github/workflows/release-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 2fd52b2f..84498596 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -15,6 +15,8 @@ jobs: release-windows-binpkg: runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) + env: + DOXYGEN_ROOT: ${{ github.workspace }}\doxygen strategy: fail-fast: false matrix: From c0071f986f0284765f0f4c90347ea942c3fc117f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 11:54:19 +0100 Subject: [PATCH 073/168] add macOS 12 platform --- .github/workflows/release-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 84498596..cf29f24f 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -96,6 +96,10 @@ jobs: fail-fast: false matrix: include: + - name: macOS 12 + runner: macos-12 + arch: x86_64 + ruby: '3.3' - name: macOS 13 runner: macos-13 arch: x86_64 From 06c2abaa98f15b23dfab5c3ad5516e1d8c5ab555 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 12:14:54 +0100 Subject: [PATCH 074/168] minimize dependencies --- rakelib/lib/config/macosx.rb | 2 +- rakelib/lib/config/unixish.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rakelib/lib/config/macosx.rb b/rakelib/lib/config/macosx.rb index b44000eb..26da73fd 100644 --- a/rakelib/lib/config/macosx.rb +++ b/rakelib/lib/config/macosx.rb @@ -104,7 +104,7 @@ def do_link(pkg) private def wx_configure - bash('./configure --disable-optimise --disable-sys-libs --without-liblzma --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info CFLAGS="-Wno-unused-but-set-variable"') + bash('./configure --disable-optimise --disable-sys-libs --without-liblzma --without-regex --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info CFLAGS="-Wno-unused-but-set-variable"') end def wx_make diff --git a/rakelib/lib/config/unixish.rb b/rakelib/lib/config/unixish.rb index 68c73403..3249cb44 100644 --- a/rakelib/lib/config/unixish.rb +++ b/rakelib/lib/config/unixish.rb @@ -105,7 +105,7 @@ def wx_checkout end def wx_configure - bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info') + bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --without-regex --disable-debug_info') end def wx_make From e913a55b902036c31517f3f26033b58ec7778b65 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 13:55:22 +0100 Subject: [PATCH 075/168] add MacOSX release test and improve scripts --- .cirrus.yml | 20 ++++++------ tools/scripts/cirrus/build-wxruby3.sh | 32 ++++++++++++++++--- .../cirrus/setup-ruby-install-latest.sh | 30 +++++++++-------- 3 files changed, 55 insertions(+), 27 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e572b342..8c6c3f75 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -228,6 +228,13 @@ test_release_task: env: osname: linux distro: debian + - name: Cirrus CI / MacOSX Ventura M1 + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true before_script: | ./tools/scripts/cirrus/setup-$distro.sh @@ -240,24 +247,17 @@ test_release_task: system_build_script: | ./tools/scripts/cirrus/setup-$distro-system-ruby.sh - ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - - bundle exec rake binpkg + ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log system_cleanup_script: | - bundle exec rake clean - rm -rf ext/wxWidgets - rm -f .wxconfig - rm -f Gemfile.lock + ./tools/scripts/cirrus/cleanup-wxruby.sh ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove latest_build_script: ./tools/scripts/cirrus/setup-ruby-install-latest.sh - ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - - bundle exec rake binpkg + ./tools/scripts/cirrus/build-wxruby3.sh --latest --binpkg 2>&1 | tee -a build-wxruby3.log release_script: diff --git a/tools/scripts/cirrus/build-wxruby3.sh b/tools/scripts/cirrus/build-wxruby3.sh index 0a3a8586..f66d6508 100755 --- a/tools/scripts/cirrus/build-wxruby3.sh +++ b/tools/scripts/cirrus/build-wxruby3.sh @@ -1,7 +1,31 @@ #!/usr/bin/env bash -ruby -v +_ruby="system" +_binpkg=0 -bundle install -bundle exec rake configure[--with-wxwin,--autoinstall] -bundle exec rake build +for a in "$@" +do +case $a in + --latest) + _ruby="latest" + ;; + --binpkg) + _binpkg=1 + ;; + *) + # unknown option + ;; +esac +done + +if [ "$latest_only" == "" ] || [ "$_ruby" == "latest" ]; then + ruby -v + + bundle install + bundle exec rake 'configure[--with-wxwin,--autoinstall]' + bundle exec rake build + + if [ "$_binpkg" == "1" ]; then + bundle exec rake binpkg + fi +fi diff --git a/tools/scripts/cirrus/setup-ruby-install-latest.sh b/tools/scripts/cirrus/setup-ruby-install-latest.sh index 06fafff1..308d4fa2 100755 --- a/tools/scripts/cirrus/setup-ruby-install-latest.sh +++ b/tools/scripts/cirrus/setup-ruby-install-latest.sh @@ -1,20 +1,24 @@ #!/usr/bin/env bash -curl -s -L https://raw.github.com/postmodern/postmodern.github.io/main/postmodern.asc --output postmodern.asc -gpg --import postmodern.asc +if [ "$distro" == "macosx" ]; then + brew install ruby +else + curl -s -L https://raw.github.com/postmodern/postmodern.github.io/main/postmodern.asc --output postmodern.asc + gpg --import postmodern.asc -RUBY_INSTALL_LATEST_URL=$(curl -s https://api.github.com/repos/postmodern/ruby-install/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep '.tar.gz$') -RUBY_INSTALL_LATEST_FILE=$(basename $RUBY_INSTALL_LATEST_URL) -RUBY_INSTALL_LATEST_DIR=$(basename -s .tar.gz $RUBY_INSTALL_LATEST_FILE) + RUBY_INSTALL_LATEST_URL=$(curl -s https://api.github.com/repos/postmodern/ruby-install/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep '.tar.gz$') + RUBY_INSTALL_LATEST_FILE=$(basename $RUBY_INSTALL_LATEST_URL) + RUBY_INSTALL_LATEST_DIR=$(basename -s .tar.gz $RUBY_INSTALL_LATEST_FILE) -curl -s -L $RUBY_INSTALL_LATEST_URL --output $RUBY_INSTALL_LATEST_FILE -curl -s -L $RUBY_INSTALL_LATEST_URL.asc --output $RUBY_INSTALL_LATEST_FILE.asc + curl -s -L $RUBY_INSTALL_LATEST_URL --output $RUBY_INSTALL_LATEST_FILE + curl -s -L $RUBY_INSTALL_LATEST_URL.asc --output $RUBY_INSTALL_LATEST_FILE.asc -gpg --verify $RUBY_INSTALL_LATEST_FILE.asc $RUBY_INSTALL_LATEST_FILE || exit 1 + gpg --verify $RUBY_INSTALL_LATEST_FILE.asc $RUBY_INSTALL_LATEST_FILE || exit 1 -tar -xzf $RUBY_INSTALL_LATEST_FILE -cd $RUBY_INSTALL_LATEST_DIR -make install -cd .. + tar -xzf $RUBY_INSTALL_LATEST_FILE + cd $RUBY_INSTALL_LATEST_DIR + make install + cd .. -ruby-install --system ruby -- --disable-install-rdoc --enable-shared + ruby-install --system ruby -- --disable-install-rdoc --enable-shared +fi From 81b2fc8fe30a2048cc6de643bc821ac6a6989d33 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 13:55:54 +0100 Subject: [PATCH 076/168] add MacOSX release test and improve scripts --- tools/scripts/cirrus/cleanup-wxruby3.sh | 8 ++++++++ tools/scripts/cirrus/setup-macosx-system-ruby.sh | 3 +++ tools/scripts/cirrus/setup-macosx.sh | 3 +++ 3 files changed, 14 insertions(+) create mode 100755 tools/scripts/cirrus/cleanup-wxruby3.sh create mode 100755 tools/scripts/cirrus/setup-macosx-system-ruby.sh create mode 100755 tools/scripts/cirrus/setup-macosx.sh diff --git a/tools/scripts/cirrus/cleanup-wxruby3.sh b/tools/scripts/cirrus/cleanup-wxruby3.sh new file mode 100755 index 00000000..45e29a48 --- /dev/null +++ b/tools/scripts/cirrus/cleanup-wxruby3.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [ "$latest_only" == "" ]; then + bundle exec rake clean + rm -rf ext/wxWidgets + rm -f .wxconfig + rm -f Gemfile.lock +fi diff --git a/tools/scripts/cirrus/setup-macosx-system-ruby.sh b/tools/scripts/cirrus/setup-macosx-system-ruby.sh new file mode 100755 index 00000000..5a71cecc --- /dev/null +++ b/tools/scripts/cirrus/setup-macosx-system-ruby.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +# system Ruby not supported for MacOSX so do nothing to install or remove diff --git a/tools/scripts/cirrus/setup-macosx.sh b/tools/scripts/cirrus/setup-macosx.sh new file mode 100755 index 00000000..b394cd2f --- /dev/null +++ b/tools/scripts/cirrus/setup-macosx.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" From 68957861f3bddbf954af422577a34fe8890430eb Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 14:00:52 +0100 Subject: [PATCH 077/168] fix typo --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8c6c3f75..98e9c5e1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -250,7 +250,7 @@ test_release_task: ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log system_cleanup_script: | - ./tools/scripts/cirrus/cleanup-wxruby.sh + ./tools/scripts/cirrus/cleanup-wxruby3.sh ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove From 999eef486c9093f27fdefd5634d30acac48cd63d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 14:01:59 +0100 Subject: [PATCH 078/168] detect cirrus CI as well --- tests/lib/wxapp_runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/wxapp_runner.rb b/tests/lib/wxapp_runner.rb index ccc37d5c..b287ed25 100644 --- a/tests/lib/wxapp_runner.rb +++ b/tests/lib/wxapp_runner.rb @@ -67,7 +67,7 @@ def initialize(*args) class TestCase def self.is_ci_build? - !!ENV['GITHUB_ACTION'] + (ENV['GITHUB_ACTION'] || ENV['CI']) end def is_ci_build? From 58601522a80cc51496f2804f517bb6d4c4327ad1 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 14:52:40 +0100 Subject: [PATCH 079/168] update verify task; add test script --- .cirrus.yml | 60 ++++++++++++++++++++-------- tools/scripts/cirrus/test-wxruby3.sh | 7 ++++ 2 files changed, 50 insertions(+), 17 deletions(-) create mode 100755 tools/scripts/cirrus/test-wxruby3.sh diff --git a/.cirrus.yml b/.cirrus.yml index 98e9c5e1..ab8f369d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -2,13 +2,12 @@ # env: - GITHUB_ACTION: 1 WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' GITHUB_TOKEN: ENCRYPTED[2ce3914266dec78118dd9706c25d2e52fbd164f86713692efde9b8af5f0159099cb299934a8d6279e524da7a0790e025] verify_task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" - only_if: $CIRRUS_BRANCH =~ 'master' + only_if: $CIRRUS_BRANCH =~ 'master' || $CIRRUS_BUILD_SOURCE == 'api' matrix: - name: Cirrus CI / Fedora AMD64 container: @@ -78,17 +77,30 @@ verify_task: before_script: | ./tools/scripts/cirrus/setup-$distro.sh - ./tools/scripts/cirrus/setup-$distro-system-ruby.sh - # Show some information about the system. uname -a locale locale -a - build_script: | + system_build_script: | + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh + ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - test_script: + system_cleanup_script: | + ./tools/scripts/cirrus/cleanup-wxruby3.sh + + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove + + system_test_script: + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + + latest_build_script: + ./tools/scripts/cirrus/setup-ruby-install-latest.sh + + ./tools/scripts/cirrus/build-wxruby3.sh --latest 2>&1 | tee -a build-wxruby3.log + + latest_test_script: /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" release_task: @@ -158,6 +170,27 @@ release_task: env: osname: linux distro: debian + - name: Cirrus CI / MacOSX Monterey M1 + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true + - name: Cirrus CI / MacOSX Ventura M1 + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true + - name: Cirrus CI / MacOSX Sonoma M1 + macos_instance: + image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true before_script: | ./tools/scripts/cirrus/setup-$distro.sh @@ -170,31 +203,24 @@ release_task: system_build_script: | ./tools/scripts/cirrus/setup-$distro-system-ruby.sh - ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - - bundle exec rake binpkg + ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log system_cleanup_script: | - bundle exec rake clean - rm -rf ext/wxWidgets - rm -f .wxconfig - rm -f Gemfile.lock + ./tools/scripts/cirrus/cleanup-wxruby3.sh ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove latest_build_script: ./tools/scripts/cirrus/setup-ruby-install-latest.sh - ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log - - bundle exec rake binpkg + ./tools/scripts/cirrus/build-wxruby3.sh --latest --binpkg 2>&1 | tee -a build-wxruby3.log release_script: ruby tools/scripts/cirrus/upload-release-pkg.rb test_release_task: - only_if: $CIRRUS_BUILD_SOURCE == 'api' + only_if: $CIRRUS_BUILD_SOURCE == 'XXX' matrix: - name: Cirrus CI / Fedora AMD64 container: diff --git a/tools/scripts/cirrus/test-wxruby3.sh b/tools/scripts/cirrus/test-wxruby3.sh new file mode 100755 index 00000000..6e94394a --- /dev/null +++ b/tools/scripts/cirrus/test-wxruby3.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ "$distro" == "macosx" ]; then + bundle exec rake test +else + xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test +fi From 4b48efcef2f7c8fa742b652b17a992d8f310a94d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 15:07:44 +0100 Subject: [PATCH 080/168] fix verify task --- .cirrus.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ab8f369d..f5e3421a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -87,14 +87,14 @@ verify_task: ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log + system_test_script: + /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + system_cleanup_script: | ./tools/scripts/cirrus/cleanup-wxruby3.sh ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove - system_test_script: - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" - latest_build_script: ./tools/scripts/cirrus/setup-ruby-install-latest.sh From 32afef56c0cf0f605cf819d159e68fa32d9ad651 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 12 Feb 2024 15:08:48 +0100 Subject: [PATCH 081/168] fix verify task --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index f5e3421a..a77c4154 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -88,7 +88,7 @@ verify_task: ./tools/scripts/cirrus/build-wxruby3.sh 2>&1 | tee -a build-wxruby3.log system_test_script: - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + ./tools/scripts/cirrus/test-wxruby3.sh system_cleanup_script: | ./tools/scripts/cirrus/cleanup-wxruby3.sh @@ -101,7 +101,7 @@ verify_task: ./tools/scripts/cirrus/build-wxruby3.sh --latest 2>&1 | tee -a build-wxruby3.log latest_test_script: - /bin/bash -o pipefail -c "xvfb-run -a -s '-screen 0 1600x1200x24' bundle exec rake test" + ./tools/scripts/cirrus/test-wxruby3.sh release_task: only_if: $CIRRUS_RELEASE != '' From 76e3ddbaab7c91c00bae4162cddfa3a97b34c844 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 11:58:58 +0100 Subject: [PATCH 082/168] added bin pkg digest signatures and support for user supplied bin pkg --- rakelib/gem.rake | 2 +- rakelib/gem.rb | 76 ++++++++++++++++++---- rakelib/prepost.rake | 1 + tools/scripts/cirrus/upload-release-pkg.rb | 17 ++++- 4 files changed, 82 insertions(+), 14 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 2365f7be..2e560917 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -142,7 +142,7 @@ if File.file?(File.join(__dir__, 'run.rake')) WXRuby3::Install.install_wxwin_shlibs begin # create bin package - WXRuby3::Gem.build_bin_pkg(t.name) + WXRuby3::Gem.build_bin_pkg ensure # cleanup WXRuby3::Install.remove_wxwin_shlibs diff --git a/rakelib/gem.rb b/rakelib/gem.rb index bc25b2a9..e6445406 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -19,6 +19,7 @@ require 'uri' require 'net/https' require 'fileutils' +require 'digest/sha2' require_relative './lib/config' require_relative './install' @@ -27,6 +28,9 @@ module WXRuby3 module Gem + BINPKG_EXT = '.pkg' + DIGEST_EXT = '.sha' + class << self # Gem helpers @@ -109,13 +113,15 @@ def bin_pkg_name private :bin_pkg_name def bin_pkg_file - File.join('pkg', "#{bin_pkg_name}.pkg") + File.join('pkg', bin_pkg_name+BINPKG_EXT) end - def build_bin_pkg(fname) + def build_bin_pkg # make sure pkg directory exists FileUtils.mkdir_p('pkg') + fname = bin_pkg_file + # package registry registry = [] # package temp deflate stream @@ -129,13 +135,23 @@ def build_bin_pkg(fname) registry_json_z = Zlib::Deflate.deflate(registry.to_json) # create final package archive deflate_stream.rewind + digest = Digest::SHA256.new File.open(fname, 'w', binmode: true) do |fout| - fout.write([registry_json_z.size].pack('Q')) + data = [registry_json_z.size].pack('Q') + digest << data + fout.write(data) + digest << registry_json_z fout.write(registry_json_z) registry.each do |entry| - fout.write(deflate_stream.read(entry[2])) if entry[2] > 0 + if entry[2] > 0 + data = deflate_stream.read(entry[2]) + digest << data + fout.write(data) + end end end + sha_file = File.join('pkg', bin_pkg_name+DIGEST_EXT) + File.open(sha_file, 'w') { |fsha| fsha << digest.hexdigest! } ensure deflate_stream.close(true) end @@ -162,28 +178,48 @@ def pack_file(os, path) # Gem installation helpers def install_gem + # check if a user specified binary package is to be used + if ENV['WXRUBY_BINPKG'] + if File.file?(ENV['WXRUBY_BINPKG']) + $stdout.puts "Installing user package #{ENV['WXRUBY_BINPKG']}..." + exit(1) unless install_bin_pkg(ENV['WXRUBY_BINPKG']) + $stdout.puts 'Done!' + true + else + $stderr.puts "ERROR: Cannot access file #{ENV['WXRUBY_BINPKG']}. Reverting to source install." + exit(1) + false + end # check if there exists a pre-built binary release package for the current platform - if has_release_package? + elsif has_release_package? # download the binary release package - $stdout.puts "Downloading #{bin_pkg_url}..." - if WXRuby3.config.download_file(bin_pkg_url, bin_pkg_name+'.pkg') - install_bin_pkg(bin_pkg_name+'.pkg') + $stdout.puts "Downloading #{bin_pkg_url(BINPKG_EXT)}..." + if WXRuby3.config.download_file(bin_pkg_url(BINPKG_EXT), bin_pkg_name+BINPKG_EXT) + unless WXRuby3.config.download_file(bin_pkg_url(DIGEST_EXT), bin_pkg_name+DIGEST_EXT) + $stderr.puts "ERROR: Unable to download digest signature for binary release package : #{bin_pkg_name}" + exit(1) + end + exit(1) unless install_bin_pkg(bin_pkg_name+BINPKG_EXT) + true else $stdout.puts "WARNING: Unable to download binary release package (#{bin_pkg_name})! Reverting to source install." + false end + else + false end end - def bin_pkg_url + def bin_pkg_url(ext) # which package are we looking for pkg_name = bin_pkg_name - "https://github.com/mcorino/wxRuby3/releases/download/v#{WXRuby3::WXRUBY_VERSION}/#{pkg_name}.pkg" + "https://github.com/mcorino/wxRuby3/releases/download/v#{WXRuby3::WXRUBY_VERSION}/#{pkg_name}#{ext}" end private :bin_pkg_url def has_release_package? # check if the release package exists on Github - uri = URI(bin_pkg_url) + uri = URI(bin_pkg_url(BINPKG_EXT)) $stdout.print "Checking #{uri.to_s}..." if WXRuby3.config.verbose? response = Net::HTTP.start('github.com', use_ssl: true) do |http| request = Net::HTTP::Head.new(uri) @@ -196,7 +232,24 @@ def has_release_package? private :has_release_package? def install_bin_pkg(fname) + # first get digest signature (if available) + sha_file = File.join(File.dirname(fname), File.basename(fname, '.*')+DIGEST_EXT) + unless File.file?(sha_file) + $stderr.puts "ERROR: Cannot access package digest signature file : #{sha_file}." + return false + end + sha_sig = File.read(sha_file) File.open(fname, 'r', binmode: true) do |fin| + # check digest signature + digest = Digest::SHA256.new + while (data = fin.read(1024*1024)) + digest << data + end + if sha_sig != digest.hexdigest! + $stderr.puts 'ERROR: Package digest signature does NOT match.' + return false + end + fin.rewind # get packed registry size registry_size = fin.read(8).unpack('Q').shift # unpack registry @@ -216,6 +269,7 @@ def install_bin_pkg(fname) end end end + true end private :install_bin_pkg diff --git a/rakelib/prepost.rake b/rakelib/prepost.rake index 1289f8c0..cb1d6e8b 100644 --- a/rakelib/prepost.rake +++ b/rakelib/prepost.rake @@ -43,6 +43,7 @@ namespace 'wxruby' do rm_f('ext/mkrf_conf_ext.rb') rm_rf('ext/wxruby3') rm_f('*.pkg') + rm_f('*.sha') File.open(File.join(WXRuby3::Config.wxruby_root, 'ext', 'wxruby.setup.done'), 'w') { |f| f << '1' } end diff --git a/tools/scripts/cirrus/upload-release-pkg.rb b/tools/scripts/cirrus/upload-release-pkg.rb index 56ee2d03..2b5b2bbf 100644 --- a/tools/scripts/cirrus/upload-release-pkg.rb +++ b/tools/scripts/cirrus/upload-release-pkg.rb @@ -40,7 +40,20 @@ result = `#{cmd}` rc = $?.success? && JSON.parse!(result)['browser_download_url'] unless rc - $stderr.puts "Failed to upload release asset!" - exit(1) + name = File.basename(name, '.*')+'.sha' + fpath = File.join(File.dirname(fpath), name) + url_to_upload = "https://uploads.github.com/repos/mcorino/wxruby3/releases/#{$CIRRUS_RELEASE}/assets?name=#{name}" + puts "Uploading #{fpath} for release #{$CIRRUS_RELEASE} to #{url_to_upload}..." + cmd = "curl -L -X POST -H \"Accept: application/vnd.github+json\" " + + "-H \"Authorization: token #{$GITHUB_TOKEN}\" " + + "-H \"X-GitHub-Api-Version: 2022-11-28\" " + + "-H \"Content-Type: #{file_content_type}\" " + + "#{url_to_upload} --data-binary @#{fpath}" + result = `#{cmd}` + rc = $?.success? && JSON.parse!(result)['browser_download_url'] + unless rc + $stderr.puts "Failed to upload release asset!" + exit(1) + end end end From 6ada95fac75cb15f56351c96a40fe70c511c674a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 15:53:56 +0100 Subject: [PATCH 083/168] add test_release_task --- .cirrus.yml | 73 +++++++++++++++++++- tools/scripts/cirrus/setup-debian.sh | 3 + tools/scripts/cirrus/setup-fedora.sh | 3 + tools/scripts/cirrus/setup-opensuse.sh | 3 + tools/scripts/cirrus/setup-ubuntu.sh | 3 + tools/scripts/cirrus/test-wxruby3-release.sh | 23 ++++++ 6 files changed, 105 insertions(+), 3 deletions(-) create mode 100755 tools/scripts/cirrus/test-wxruby3-release.sh diff --git a/.cirrus.yml b/.cirrus.yml index a77c4154..ee795a6a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,7 +7,7 @@ env: verify_task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" - only_if: $CIRRUS_BRANCH =~ 'master' || $CIRRUS_BUILD_SOURCE == 'api' + only_if: $CIRRUS_BRANCH =~ 'master' matrix: - name: Cirrus CI / Fedora AMD64 container: @@ -219,8 +219,8 @@ release_task: ruby tools/scripts/cirrus/upload-release-pkg.rb -test_release_task: - only_if: $CIRRUS_BUILD_SOURCE == 'XXX' +release_test_task: + only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: - name: Cirrus CI / Fedora AMD64 container: @@ -288,3 +288,70 @@ test_release_task: release_script: ruby tools/scripts/cirrus/upload-release-pkg.rb + +test_release_task: + depends_on: + - release_test_task + matrix: + - name: Cirrus CI / Fedora AMD64 + container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / OpenSuSE Leap AMD64 + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / Ubuntu AMD64 + container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Debian AMD64 + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / MacOSX Ventura M1 + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true + + before_script: | + ./tools/scripts/cirrus/setup-$distro.sh test + + # Show some information about the system. + uname -a + locale + locale -a + + system_test_script: | + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh + + ./tools/scripts/cirrus/test-wxruby3-release.sh + + system_cleanup_script: | + ./tools/scripts/cirrus/cleanup-wxruby3.sh + + ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove + + latest_test_script: + ./tools/scripts/cirrus/setup-ruby-install-latest.sh + + ./tools/scripts/cirrus/test-wxruby3-release.sh diff --git a/tools/scripts/cirrus/setup-debian.sh b/tools/scripts/cirrus/setup-debian.sh index 4e64838d..7cc3a8a3 100755 --- a/tools/scripts/cirrus/setup-debian.sh +++ b/tools/scripts/cirrus/setup-debian.sh @@ -2,3 +2,6 @@ apt-get update apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps +if [ "$1" == "test" ]; then + apt-get install -y 'libgtk-3-[0-9]+' 'libwebkit2gtk-4.0-[0-9]+' 'libgspell-1-[0-9]+' libnotify4 'libsecret-1-[0-9]+' curl +fi diff --git a/tools/scripts/cirrus/setup-fedora.sh b/tools/scripts/cirrus/setup-fedora.sh index bbac7ee4..eb33e3c2 100755 --- a/tools/scripts/cirrus/setup-fedora.sh +++ b/tools/scripts/cirrus/setup-fedora.sh @@ -1,3 +1,6 @@ #!/usr/bin/env bash dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng +if [ "$1" == "test" ]; then + dnf install -y gtk3 webkit2gtk4.1 gspell libnotify libsecret curl +fi diff --git a/tools/scripts/cirrus/setup-opensuse.sh b/tools/scripts/cirrus/setup-opensuse.sh index 851fe0d0..3f50320e 100755 --- a/tools/scripts/cirrus/setup-opensuse.sh +++ b/tools/scripts/cirrus/setup-opensuse.sh @@ -1,3 +1,6 @@ #!/usr/bin/env bash zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make tar gzip +if [ "$1" == "test" ]; then + zypper install -y gtk3 webkit2gtk4 gspell libnotify4 libsecret curl +fi diff --git a/tools/scripts/cirrus/setup-ubuntu.sh b/tools/scripts/cirrus/setup-ubuntu.sh index 4e64838d..7cc3a8a3 100755 --- a/tools/scripts/cirrus/setup-ubuntu.sh +++ b/tools/scripts/cirrus/setup-ubuntu.sh @@ -2,3 +2,6 @@ apt-get update apt-get install -y git make gcc gpg xvfb xfonts-75dpi curl procps +if [ "$1" == "test" ]; then + apt-get install -y 'libgtk-3-[0-9]+' 'libwebkit2gtk-4.0-[0-9]+' 'libgspell-1-[0-9]+' libnotify4 'libsecret-1-[0-9]+' curl +fi diff --git a/tools/scripts/cirrus/test-wxruby3-release.sh b/tools/scripts/cirrus/test-wxruby3-release.sh new file mode 100755 index 00000000..0399ee26 --- /dev/null +++ b/tools/scripts/cirrus/test-wxruby3-release.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +if [ "$CIRRUS_BUILD_SOURCE" == "api" ]; then + bundle install + bundle exec rake gem + if [ "$distro" == "macosx" ]; then + gem install $(echo pkg/*.gem) && wxruby test + else + gem install $(echo pkg/*.gem) && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test + fi +else + WXRUBY_VERSION=${CIRRUS_TAG/#v/} + if grep -q "\-[a-zA-Z]" <<< "$CIRRUS_TAG" ; then + WXRUBY_PRERELEASE="--pre" + else + WXRUBY_PRERELEASE="" + fi + if [ "$distro" == "macosx" ]; then + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && wxruby test + else + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test + fi +fi From ce035791541c2449b82b9557f2579f8fb545a877 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 15:59:55 +0100 Subject: [PATCH 084/168] added bin pkg digest signatures and remove MacOS M1 build (leave to cirrus) --- .github/workflows/release-test.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index cf29f24f..a5b1c1a6 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -104,10 +104,6 @@ jobs: runner: macos-13 arch: x86_64 ruby: '3.3' - - name: macOS 14 - runner: macos-14 - arch: m1 - ruby: '3.3' steps: - name: Checkout wxRuby3 @@ -146,3 +142,12 @@ jobs: tag: v0.9.7 overwrite: true file_glob: true + + - name: Upload bin pkg digest signature as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.sha + tag: v0.9.7 + overwrite: true + file_glob: true From 79aee398f8ae352b32dbca250dbfffc6055a8eb3 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 16:18:29 +0100 Subject: [PATCH 085/168] fix naming --- .cirrus.yml | 64 ++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ee795a6a..b1485bdc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -9,7 +9,7 @@ verify_task: skip: "changesIncludeOnly('.yardopts','*.md','.circleci/**','.github/**','lib/wx/doc/**','assets/**','lib/wx/version.rb')" only_if: $CIRRUS_BRANCH =~ 'master' matrix: - - name: Cirrus CI / Fedora AMD64 + - name: Cirrus CI / Fedora AMD64 Test container: image: fedora:latest cpu: 4 @@ -17,7 +17,7 @@ verify_task: env: osname: linux distro: fedora - - name: Cirrus CI / Fedora ARM64 + - name: Cirrus CI / Fedora ARM64 Test arm_container: image: fedora:latest cpu: 4 @@ -25,7 +25,7 @@ verify_task: env: osname: linux distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 + - name: Cirrus CI / OpenSuSE Leap AMD64 Test container: image: opensuse/leap:latest cpu: 4 @@ -33,7 +33,7 @@ verify_task: env: osname: linux distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 + - name: Cirrus CI / OpenSuSE Leap ARM64 Test arm_container: image: opensuse/leap:latest cpu: 4 @@ -41,7 +41,7 @@ verify_task: env: osname: linux distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 + - name: Cirrus CI / Ubuntu AMD64 Test container: image: ubuntu:latest cpu: 4 @@ -49,7 +49,7 @@ verify_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Ubuntu ARM64 + - name: Cirrus CI / Ubuntu ARM64 Test arm_container: image: ubuntu:latest cpu: 4 @@ -57,7 +57,7 @@ verify_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Debian AMD64 + - name: Cirrus CI / Debian AMD64 Test container: image: debian:latest cpu: 4 @@ -65,7 +65,7 @@ verify_task: env: osname: linux distro: debian - - name: Cirrus CI / Debian ARM64 + - name: Cirrus CI / Debian ARM64 Test arm_container: image: debian:latest cpu: 4 @@ -106,7 +106,7 @@ verify_task: release_task: only_if: $CIRRUS_RELEASE != '' matrix: - - name: Cirrus CI / Fedora AMD64 + - name: Cirrus CI / Fedora AMD64 Release container: image: fedora:latest cpu: 4 @@ -114,7 +114,7 @@ release_task: env: osname: linux distro: fedora - - name: Cirrus CI / Fedora ARM64 + - name: Cirrus CI / Fedora ARM64 Release arm_container: image: fedora:latest cpu: 4 @@ -122,7 +122,7 @@ release_task: env: osname: linux distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 + - name: Cirrus CI / OpenSuSE Leap AMD64 Release container: image: opensuse/leap:latest cpu: 4 @@ -130,7 +130,7 @@ release_task: env: osname: linux distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 + - name: Cirrus CI / OpenSuSE Leap ARM64 Release arm_container: image: opensuse/leap:latest cpu: 4 @@ -138,7 +138,7 @@ release_task: env: osname: linux distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 + - name: Cirrus CI / Ubuntu AMD64 Release container: image: ubuntu:latest cpu: 4 @@ -146,7 +146,7 @@ release_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Ubuntu ARM64 + - name: Cirrus CI / Ubuntu ARM64 Release arm_container: image: ubuntu:latest cpu: 4 @@ -154,7 +154,7 @@ release_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Debian AMD64 + - name: Cirrus CI / Debian AMD64 Release container: image: debian:latest cpu: 4 @@ -162,7 +162,7 @@ release_task: env: osname: linux distro: debian - - name: Cirrus CI / Debian ARM64 + - name: Cirrus CI / Debian ARM64 Release arm_container: image: debian:latest cpu: 4 @@ -170,21 +170,21 @@ release_task: env: osname: linux distro: debian - - name: Cirrus CI / MacOSX Monterey M1 + - name: Cirrus CI / MacOSX Monterey M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-monterey-xcode:latest env: osname: darwin distro: macosx latest_only: true - - name: Cirrus CI / MacOSX Ventura M1 + - name: Cirrus CI / MacOSX Ventura M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest env: osname: darwin distro: macosx latest_only: true - - name: Cirrus CI / MacOSX Sonoma M1 + - name: Cirrus CI / MacOSX Sonoma M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest env: @@ -222,7 +222,7 @@ release_task: release_test_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: - - name: Cirrus CI / Fedora AMD64 + - name: Cirrus CI / Fedora AMD64 Release container: image: fedora:latest cpu: 4 @@ -230,7 +230,7 @@ release_test_task: env: osname: linux distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 + - name: Cirrus CI / OpenSuSE Leap AMD64 Release container: image: opensuse/leap:latest cpu: 4 @@ -238,7 +238,7 @@ release_test_task: env: osname: linux distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 + - name: Cirrus CI / Ubuntu AMD64 Release container: image: ubuntu:latest cpu: 4 @@ -246,7 +246,7 @@ release_test_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Debian AMD64 + - name: Cirrus CI / Debian AMD64 Release container: image: debian:latest cpu: 4 @@ -254,7 +254,7 @@ release_test_task: env: osname: linux distro: debian - - name: Cirrus CI / MacOSX Ventura M1 + - name: Cirrus CI / MacOSX Ventura M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest env: @@ -291,9 +291,13 @@ release_test_task: test_release_task: depends_on: - - release_test_task + - Cirrus CI / Fedora AMD64 Release + - Cirrus CI / OpenSuSE Leap AMD64 Release + - Cirrus CI / Ubuntu AMD64 Release + - Cirrus CI / Debian AMD64 Release + - Cirrus CI / MacOSX Ventura M1 Release matrix: - - name: Cirrus CI / Fedora AMD64 + - name: Cirrus CI / Fedora AMD64 Release Test container: image: fedora:latest cpu: 4 @@ -301,7 +305,7 @@ test_release_task: env: osname: linux distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 + - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test container: image: opensuse/leap:latest cpu: 4 @@ -309,7 +313,7 @@ test_release_task: env: osname: linux distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 + - name: Cirrus CI / Ubuntu AMD64 Release Test container: image: ubuntu:latest cpu: 4 @@ -317,7 +321,7 @@ test_release_task: env: osname: linux distro: ubuntu - - name: Cirrus CI / Debian AMD64 + - name: Cirrus CI / Debian AMD64 Release Test container: image: debian:latest cpu: 4 @@ -325,7 +329,7 @@ test_release_task: env: osname: linux distro: debian - - name: Cirrus CI / MacOSX Ventura M1 + - name: Cirrus CI / MacOSX Ventura M1 Release Test macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest env: From a736ad7f5c1dcc7d9f3d1ac813e68436e7f7ac37 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 16:20:00 +0100 Subject: [PATCH 086/168] prevent unwanted execution --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index b1485bdc..45943ba3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -290,6 +290,7 @@ release_test_task: ruby tools/scripts/cirrus/upload-release-pkg.rb test_release_task: + only_if: $CIRRUS_BUILD_SOURCE == 'api' depends_on: - Cirrus CI / Fedora AMD64 Release - Cirrus CI / OpenSuSE Leap AMD64 Release From 914b68ef13214d15a80e6f5fedee48e8fbd65d04 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 18:16:42 +0100 Subject: [PATCH 087/168] fix upload script --- tools/scripts/cirrus/upload-release-pkg.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/scripts/cirrus/upload-release-pkg.rb b/tools/scripts/cirrus/upload-release-pkg.rb index 2b5b2bbf..cd881eb7 100644 --- a/tools/scripts/cirrus/upload-release-pkg.rb +++ b/tools/scripts/cirrus/upload-release-pkg.rb @@ -39,7 +39,7 @@ "#{url_to_upload} --data-binary @#{fpath}" result = `#{cmd}` rc = $?.success? && JSON.parse!(result)['browser_download_url'] - unless rc + if rc name = File.basename(name, '.*')+'.sha' fpath = File.join(File.dirname(fpath), name) url_to_upload = "https://uploads.github.com/repos/mcorino/wxruby3/releases/#{$CIRRUS_RELEASE}/assets?name=#{name}" @@ -51,9 +51,9 @@ "#{url_to_upload} --data-binary @#{fpath}" result = `#{cmd}` rc = $?.success? && JSON.parse!(result)['browser_download_url'] - unless rc - $stderr.puts "Failed to upload release asset!" - exit(1) - end + end + unless rc + $stderr.puts "Failed to upload release asset!" + exit(1) end end From fca2d6e31e1669da00c95f5f065e336ecd38c42a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 13 Feb 2024 18:18:09 +0100 Subject: [PATCH 088/168] disable some stuff for now --- .cirrus.yml | 230 ++++++++++++++++++++++++++-------------------------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 45943ba3..31585ef9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -103,121 +103,121 @@ verify_task: latest_test_script: ./tools/scripts/cirrus/test-wxruby3.sh -release_task: - only_if: $CIRRUS_RELEASE != '' - matrix: - - name: Cirrus CI / Fedora AMD64 Release - container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / Fedora ARM64 Release - arm_container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 Release - container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 Release - arm_container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 Release - container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Ubuntu ARM64 Release - arm_container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Debian AMD64 Release - container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / Debian ARM64 Release - arm_container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / MacOSX Monterey M1 Release - macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true - - name: Cirrus CI / MacOSX Ventura M1 Release - macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true - - name: Cirrus CI / MacOSX Sonoma M1 Release - macos_instance: - image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true - - before_script: | - ./tools/scripts/cirrus/setup-$distro.sh - - # Show some information about the system. - uname -a - locale - locale -a - - system_build_script: | - ./tools/scripts/cirrus/setup-$distro-system-ruby.sh - - ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log - - system_cleanup_script: | - ./tools/scripts/cirrus/cleanup-wxruby3.sh - - ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove - - latest_build_script: - ./tools/scripts/cirrus/setup-ruby-install-latest.sh - - ./tools/scripts/cirrus/build-wxruby3.sh --latest --binpkg 2>&1 | tee -a build-wxruby3.log - - release_script: - - ruby tools/scripts/cirrus/upload-release-pkg.rb +#release_task: +# only_if: $CIRRUS_RELEASE != '' +# matrix: +# - name: Cirrus CI / Fedora AMD64 Release +# container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / Fedora ARM64 Release +# arm_container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / OpenSuSE Leap AMD64 Release +# container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / OpenSuSE Leap ARM64 Release +# arm_container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / Ubuntu AMD64 Release +# container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Ubuntu ARM64 Release +# arm_container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Debian AMD64 Release +# container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / Debian ARM64 Release +# arm_container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / MacOSX Monterey M1 Release +# macos_instance: +# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true +# - name: Cirrus CI / MacOSX Ventura M1 Release +# macos_instance: +# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true +# - name: Cirrus CI / MacOSX Sonoma M1 Release +# macos_instance: +# image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true +# +# before_script: | +# ./tools/scripts/cirrus/setup-$distro.sh +# +# # Show some information about the system. +# uname -a +# locale +# locale -a +# +# system_build_script: | +# ./tools/scripts/cirrus/setup-$distro-system-ruby.sh +# +# ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log +# +# system_cleanup_script: | +# ./tools/scripts/cirrus/cleanup-wxruby3.sh +# +# ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove +# +# latest_build_script: +# ./tools/scripts/cirrus/setup-ruby-install-latest.sh +# +# ./tools/scripts/cirrus/build-wxruby3.sh --latest --binpkg 2>&1 | tee -a build-wxruby3.log +# +# release_script: +# +# ruby tools/scripts/cirrus/upload-release-pkg.rb release_test_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' From ecd000771c5fd7e45101c48c87ac7870a9a17f4c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 09:20:37 +0100 Subject: [PATCH 089/168] add bin pkg digest signature upload for windows --- .github/workflows/release-test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index a5b1c1a6..bb29aa08 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -89,6 +89,15 @@ jobs: tag: v0.9.7 overwrite: true file_glob: true + + - name: Upload bin pkg digest signature as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.sha + tag: v0.9.7 + overwrite: true + file_glob: true release-macosx-binpkg: runs-on: ${{ matrix.runner }} name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) From 150376cefbeefd28168368973a40d0111933ca46 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 09:32:52 +0100 Subject: [PATCH 090/168] protect against incompatible test env --- tests/test_config.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_config.rb b/tests/test_config.rb index 0d2308b2..796054ad 100644 --- a/tests/test_config.rb +++ b/tests/test_config.rb @@ -203,13 +203,16 @@ def run_auto_accessor_tests(cfg) def run_env_var_tests(cfg) # by default expansion is on + # Cirrus CI Linux builds run in privileged container without proper user env + has_user = Wx::PLATFORM == 'WXMSW' || ENV['USER'] + # add a number of entries for env var in new group 'Environment' cfg['/Environment/HOME'] = '$HOME' - cfg['Environment'].USER = Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}' + cfg['Environment'].USER = Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}' if has_user cfg['/Environment/PATH'] = '$(PATH)' assert_equal(ENV['HOME'], cfg.Environment['HOME']) - assert_equal(ENV[Wx::PLATFORM == 'WXMSW' ? 'USERNAME' : 'USER'], cfg['/Environment/USER']) + assert_equal(ENV[Wx::PLATFORM == 'WXMSW' ? 'USERNAME' : 'USER'], cfg['/Environment/USER']) if has_user assert_equal(ENV['PATH'], cfg.Environment.PATH) # test escaping @@ -225,9 +228,9 @@ def run_env_var_tests(cfg) assert_equal('${NonExistingLongNonsenseVariable}', cfg.Environment['NONSENSE']) - cfg['/Environment/MULTIPLE'] = "$HOME / #{Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}'}" + cfg['/Environment/MULTIPLE'] = "$HOME / #{Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}'}" if has_user - assert_equal("#{ENV['HOME']} / #{Wx::PLATFORM == 'WXMSW' ? ENV['USERNAME'] : ENV['USER']}", cfg.Environment['MULTIPLE']) + assert_equal("#{ENV['HOME']} / #{Wx::PLATFORM == 'WXMSW' ? ENV['USERNAME'] : ENV['USER']}", cfg.Environment['MULTIPLE']) if has_user # disable env var expansion cfg.expand_env_vars = false From 80307f3d3f6f2610371d9da9abaf7a1ad9bfe447 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 09:34:41 +0100 Subject: [PATCH 091/168] test only --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 31585ef9..3f9e8021 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -220,7 +220,7 @@ verify_task: # ruby tools/scripts/cirrus/upload-release-pkg.rb release_test_task: - only_if: $CIRRUS_BUILD_SOURCE == 'api' + only_if: $CIRRUS_BUILD_SOURCE == 'XXX' matrix: - name: Cirrus CI / Fedora AMD64 Release container: From ba276fc1ca1abfd63721c2544725a6798c0d46b4 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 10:04:05 +0100 Subject: [PATCH 092/168] allow test_config --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3f9e8021..2d9e7499 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -2,7 +2,7 @@ # env: - WXRUBY_TEST_EXCLUDE: 'test_config:test_intl:test_media_ctrl' + WXRUBY_TEST_EXCLUDE: 'test_intl:test_media_ctrl' GITHUB_TOKEN: ENCRYPTED[2ce3914266dec78118dd9706c25d2e52fbd164f86713692efde9b8af5f0159099cb299934a8d6279e524da7a0790e025] verify_task: From c87b9dad57582122759a974095470bc8c06de539 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 10:04:16 +0100 Subject: [PATCH 093/168] properly exclude tests --- tools/scripts/cirrus/test-wxruby3-release.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/scripts/cirrus/test-wxruby3-release.sh b/tools/scripts/cirrus/test-wxruby3-release.sh index 0399ee26..c874cf17 100755 --- a/tools/scripts/cirrus/test-wxruby3-release.sh +++ b/tools/scripts/cirrus/test-wxruby3-release.sh @@ -4,9 +4,9 @@ if [ "$CIRRUS_BUILD_SOURCE" == "api" ]; then bundle install bundle exec rake gem if [ "$distro" == "macosx" ]; then - gem install $(echo pkg/*.gem) && wxruby test + gem install $(echo pkg/*.gem) && wxruby test --exclude=test_intl --exclude=test_media_ctrl else - gem install $(echo pkg/*.gem) && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test + gem install $(echo pkg/*.gem) && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl fi else WXRUBY_VERSION=${CIRRUS_TAG/#v/} @@ -16,8 +16,8 @@ else WXRUBY_PRERELEASE="" fi if [ "$distro" == "macosx" ]; then - gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && wxruby test + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && wxruby test --exclude=test_intl --exclude=test_media_ctrl else - gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl fi fi From de144037148387246495b75ff5c1dbe6106fbd73 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 10:19:48 +0100 Subject: [PATCH 094/168] workaround to install webkit2gtk without having to specify exact versions --- tools/scripts/cirrus/setup-opensuse.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse.sh b/tools/scripts/cirrus/setup-opensuse.sh index 3f50320e..a4bcac65 100755 --- a/tools/scripts/cirrus/setup-opensuse.sh +++ b/tools/scripts/cirrus/setup-opensuse.sh @@ -2,5 +2,5 @@ zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make tar gzip if [ "$1" == "test" ]; then - zypper install -y gtk3 webkit2gtk4 gspell libnotify4 libsecret curl + zypper install -y gtk3 webkit2gtk3-devel gspell libnotify4 libsecret curl fi From 8dc1f8292b735b1bedbb2785a55bad398b8bbb6e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 11:16:02 +0100 Subject: [PATCH 095/168] make sure no to format gem executables with ruby version --- tools/scripts/cirrus/test-wxruby3-release.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/scripts/cirrus/test-wxruby3-release.sh b/tools/scripts/cirrus/test-wxruby3-release.sh index c874cf17..1b689664 100755 --- a/tools/scripts/cirrus/test-wxruby3-release.sh +++ b/tools/scripts/cirrus/test-wxruby3-release.sh @@ -4,9 +4,9 @@ if [ "$CIRRUS_BUILD_SOURCE" == "api" ]; then bundle install bundle exec rake gem if [ "$distro" == "macosx" ]; then - gem install $(echo pkg/*.gem) && wxruby test --exclude=test_intl --exclude=test_media_ctrl + gem install $(echo pkg/*.gem) --no-format-executable && wxruby test --exclude=test_intl --exclude=test_media_ctrl else - gem install $(echo pkg/*.gem) && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl + gem install $(echo pkg/*.gem) --no-format-executable && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl fi else WXRUBY_VERSION=${CIRRUS_TAG/#v/} @@ -16,8 +16,8 @@ else WXRUBY_PRERELEASE="" fi if [ "$distro" == "macosx" ]; then - gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && wxruby test --exclude=test_intl --exclude=test_media_ctrl + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} --no-format-executable && wxruby test --exclude=test_intl --exclude=test_media_ctrl else - gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl + gem install wxruby3 -v "$WXRUBY_VERSION" ${WXRUBY_PRERELEASE} --no-format-executable && xvfb-run -a -s '-screen 0 1600x1200x24' wxruby test --exclude=test_intl --exclude=test_media_ctrl fi fi From 0eb165136885d6dad2b745bde906cfd4c0d9ec58 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 11:21:13 +0100 Subject: [PATCH 096/168] add missing runtime requisite for testing --- tools/scripts/cirrus/setup-fedora.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-fedora.sh b/tools/scripts/cirrus/setup-fedora.sh index eb33e3c2..89a842c3 100755 --- a/tools/scripts/cirrus/setup-fedora.sh +++ b/tools/scripts/cirrus/setup-fedora.sh @@ -2,5 +2,5 @@ dnf install -y git xorg-x11-server-Xvfb xorg-x11-fonts-75dpi which gcc make procps-ng if [ "$1" == "test" ]; then - dnf install -y gtk3 webkit2gtk4.1 gspell libnotify libsecret curl + dnf install -y gtk3 webkit2gtk4.1 mesa-libGLU gspell libnotify libsecret curl fi From d0d9652be4c2f43a2885bb98a622769d892586d2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 11:36:28 +0100 Subject: [PATCH 097/168] add missing runtime requisite for testing --- tools/scripts/cirrus/setup-opensuse.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/setup-opensuse.sh b/tools/scripts/cirrus/setup-opensuse.sh index a4bcac65..65c804c9 100755 --- a/tools/scripts/cirrus/setup-opensuse.sh +++ b/tools/scripts/cirrus/setup-opensuse.sh @@ -2,5 +2,5 @@ zypper install -y git xorg-x11-server-Xvfb xvfb-run xorg-x11-fonts curl gcc make tar gzip if [ "$1" == "test" ]; then - zypper install -y gtk3 webkit2gtk3-devel gspell libnotify4 libsecret curl + zypper install -y gtk3 webkit2gtk3-devel libGLU1 gspell libnotify4 libsecret curl fi From 36d2cfeb72f46d707173337fa2f3be5d535fa059 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 11:37:17 +0100 Subject: [PATCH 098/168] finalize and cleanup --- .cirrus.yml | 218 ++++++++++++++++++++++++---------------------------- 1 file changed, 100 insertions(+), 118 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2d9e7499..ddefd44e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -103,124 +103,8 @@ verify_task: latest_test_script: ./tools/scripts/cirrus/test-wxruby3.sh -#release_task: -# only_if: $CIRRUS_RELEASE != '' -# matrix: -# - name: Cirrus CI / Fedora AMD64 Release -# container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / Fedora ARM64 Release -# arm_container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / OpenSuSE Leap AMD64 Release -# container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / OpenSuSE Leap ARM64 Release -# arm_container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / Ubuntu AMD64 Release -# container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Ubuntu ARM64 Release -# arm_container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Debian AMD64 Release -# container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / Debian ARM64 Release -# arm_container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / MacOSX Monterey M1 Release -# macos_instance: -# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true -# - name: Cirrus CI / MacOSX Ventura M1 Release -# macos_instance: -# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true -# - name: Cirrus CI / MacOSX Sonoma M1 Release -# macos_instance: -# image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true -# -# before_script: | -# ./tools/scripts/cirrus/setup-$distro.sh -# -# # Show some information about the system. -# uname -a -# locale -# locale -a -# -# system_build_script: | -# ./tools/scripts/cirrus/setup-$distro-system-ruby.sh -# -# ./tools/scripts/cirrus/build-wxruby3.sh --binpkg 2>&1 | tee -a build-wxruby3.log -# -# system_cleanup_script: | -# ./tools/scripts/cirrus/cleanup-wxruby3.sh -# -# ./tools/scripts/cirrus/setup-$distro-system-ruby.sh remove -# -# latest_build_script: -# ./tools/scripts/cirrus/setup-ruby-install-latest.sh -# -# ./tools/scripts/cirrus/build-wxruby3.sh --latest --binpkg 2>&1 | tee -a build-wxruby3.log -# -# release_script: -# -# ruby tools/scripts/cirrus/upload-release-pkg.rb - -release_test_task: - only_if: $CIRRUS_BUILD_SOURCE == 'XXX' +release_task: + only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: - name: Cirrus CI / Fedora AMD64 Release container: @@ -230,6 +114,14 @@ release_test_task: env: osname: linux distro: fedora + - name: Cirrus CI / Fedora ARM64 Release + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora - name: Cirrus CI / OpenSuSE Leap AMD64 Release container: image: opensuse/leap:latest @@ -238,6 +130,14 @@ release_test_task: env: osname: linux distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 Release + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse - name: Cirrus CI / Ubuntu AMD64 Release container: image: ubuntu:latest @@ -246,6 +146,14 @@ release_test_task: env: osname: linux distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 Release + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu - name: Cirrus CI / Debian AMD64 Release container: image: debian:latest @@ -254,6 +162,21 @@ release_test_task: env: osname: linux distro: debian + - name: Cirrus CI / Debian ARM64 Release + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / MacOSX Monterey M1 Release + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true - name: Cirrus CI / MacOSX Ventura M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest @@ -261,6 +184,13 @@ release_test_task: osname: darwin distro: macosx latest_only: true + - name: Cirrus CI / MacOSX Sonoma M1 Release + macos_instance: + image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true before_script: | ./tools/scripts/cirrus/setup-$distro.sh @@ -296,7 +226,13 @@ test_release_task: - Cirrus CI / OpenSuSE Leap AMD64 Release - Cirrus CI / Ubuntu AMD64 Release - Cirrus CI / Debian AMD64 Release + - Cirrus CI / Fedora ARM64 Release + - Cirrus CI / OpenSuSE Leap ARM64 Release + - Cirrus CI / Ubuntu ARM64 Release + - Cirrus CI / Debian ARM64 Release + - Cirrus CI / MacOSX Monterey M1 Release - Cirrus CI / MacOSX Ventura M1 Release + - Cirrus CI / MacOSX Sonoma M1 Release matrix: - name: Cirrus CI / Fedora AMD64 Release Test container: @@ -306,6 +242,14 @@ test_release_task: env: osname: linux distro: fedora + - name: Cirrus CI / Fedora ARM64 Release Test + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test container: image: opensuse/leap:latest @@ -314,6 +258,14 @@ test_release_task: env: osname: linux distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 Release Test + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse - name: Cirrus CI / Ubuntu AMD64 Release Test container: image: ubuntu:latest @@ -322,6 +274,14 @@ test_release_task: env: osname: linux distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 Release Test + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu - name: Cirrus CI / Debian AMD64 Release Test container: image: debian:latest @@ -330,6 +290,21 @@ test_release_task: env: osname: linux distro: debian + - name: Cirrus CI / Debian ARM64 Release Test + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / MacOSX Monterey M1 Release Test + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true - name: Cirrus CI / MacOSX Ventura M1 Release Test macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest @@ -337,6 +312,13 @@ test_release_task: osname: darwin distro: macosx latest_only: true + - name: Cirrus CI / MacOSX Sonoma M1 Release Test + macos_instance: + image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true before_script: | ./tools/scripts/cirrus/setup-$distro.sh test From 04307995404c30ea04cf910ef26a816da381dd27 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 14:18:32 +0100 Subject: [PATCH 099/168] use commandline switches not environment var --- ext/mkrf_conf_ext.rb | 33 +++++++++++++++++++++++++++++- rakelib/gem.rake | 29 +++++++++++++++++++++----- rakelib/gem.rb | 48 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 94 insertions(+), 16 deletions(-) diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index 523992bd..95e98eab 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -6,6 +6,37 @@ # wxRuby3 extension configuration file for gems ### +require 'optparse' + +OPTIONS = { +} + +opts = OptionParser.new +opts.banner = "wxRuby3 extension build script\n\nUsage: gem install wxruby3 -- -h|--help OR gem install wxruby3 [-- options]\n\n" +opts.separator '' +opts.on('--[no-]prebuilt', + "Specifies to either require ('--prebuilt') or avoid ('--no-prebuilt') installing prebuilt binary packages.", + "If not specified installing a prebuilt package will be attempted reverting to source install if none found.") {|v| OPTIONS[:prebuilt] = !!v } +opts.on('--package=URL', + "Specifies the http(s) url or absolute path to the prebuilt binary package to install.", + "Implies '--prebuilt'.") {|v| OPTIONS[:package] = v } +opts.on('-h', '--help', + 'Show this message.') do |v| + puts opts + puts + exit(0) +end +opts.parse!(args) + +task_args = '' +unless OPTIONS[:prebuilt].nil? + task_args << (OPTIONS[:prebuilt] ? '--prebuilt' : '--no-prebuilt') +end +if OPTIONS[:package] + task_args << ', ' unless task_args.empty? + task_args << '--package, ' << OPTIONS[:package] +end + # generate new rakefile with appropriate default task (calls actual task in rakelib) File.open('../Rakefile', 'w') do |f| f.puts < finish install - Rake::Task['wxruby:post:binpkg'].invoke + kwargs = {} + no_prebuilt = false + task :install do |_, args| + argv = args.extras + until argv.empty? + switch = argv.shift + case switch + when '--prebuilt' + kwargs[:prebuilt_only] = true + when '--no-prebuilt' + no_prebuilt = true unless kwargs[:package] + when '--package' + fail "Missing value for '--package' argument for wxruby:gem:install." if argv.empty? + kwargs[:package] = argv.shift + no_prebuilt = false + else + fail "Invalid argument #{switch} for wxruby:gem:install." + end + end + unless no_prebuilt # do not even try to find&install a binary package + if WXRuby3::Gem.install_gem(**kwargs) + # binaries have been installed -> finish install + Rake::Task['wxruby:post:binpkg'].invoke + end end end diff --git a/rakelib/gem.rb b/rakelib/gem.rb index e6445406..9c237111 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -177,18 +177,38 @@ def pack_file(os, path) # Gem installation helpers - def install_gem + def install_gem(prebuilt_only: false, package: nil) # check if a user specified binary package is to be used - if ENV['WXRUBY_BINPKG'] - if File.file?(ENV['WXRUBY_BINPKG']) - $stdout.puts "Installing user package #{ENV['WXRUBY_BINPKG']}..." - exit(1) unless install_bin_pkg(ENV['WXRUBY_BINPKG']) - $stdout.puts 'Done!' - true + if package + uri = URI(package) + if uri.scheme == 'file' || uri.scheme.nil? + if File.file?(uri.path) + $stdout.puts "Installing user package #{uri.path}..." + exit(1) unless install_bin_pkg(uri.path) + $stdout.puts 'Done!' + true + else + $stderr.puts "ERROR: Cannot access file #{uri.path}. Reverting to source install." + exit(1) + end + elsif uri.scheme == 'http' || uri.scheme == 'https' + # download the binary release package + $stdout.puts "Downloading #{uri.path}..." + filename = File.basename(uri.path) + if WXRuby3.config.download_file(uri.path, filename) + sha_file = File.basename(filename, '.*')+DIGEST_EXT + uri.path = File.join(File.dirname(uri.path), sha_file) + unless WXRuby3.config.download_file(uri.path, sha_file) + $stderr.puts "ERROR: Unable to download digest signature for binary release package : #{package}" + exit(1) + end + exit(1) unless install_bin_pkg(filename) + true + else + $stderr.puts "ERROR: Unable to download binary release package (#{package})!" + exit(1) + end else - $stderr.puts "ERROR: Cannot access file #{ENV['WXRUBY_BINPKG']}. Reverting to source install." - exit(1) - false end # check if there exists a pre-built binary release package for the current platform elsif has_release_package? @@ -202,10 +222,18 @@ def install_gem exit(1) unless install_bin_pkg(bin_pkg_name+BINPKG_EXT) true else + if prebuilt_only + $stderr.puts "ERROR: Unable to download binary release package (#{bin_pkg_name})!" + exit(1) + end $stdout.puts "WARNING: Unable to download binary release package (#{bin_pkg_name})! Reverting to source install." false end else + if prebuilt_only + $stderr.puts "ERROR: No binary release package available!" + exit(1) + end false end end From 1cdaeb214afa4e389cf533bab0ba5a88d4b326b6 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 14:18:47 +0100 Subject: [PATCH 100/168] finalize and cleanup --- .github/workflows/release.yml | 426 ++++++++++++++++++---------------- 1 file changed, 229 insertions(+), 197 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61375eb1..61238636 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ permissions: contents: write jobs: - release: + release-gem: strategy: fail-fast: false matrix: @@ -91,8 +91,162 @@ jobs: echo "WXRUBY_PRERELEASE=0" >> "$GITHUB_OUTPUT" fi + + release-windows-binpkg: + needs: release-gem + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) + env: + DOXYGEN_ROOT: ${{ github.workspace }}\doxygen + strategy: + fail-fast: false + matrix: + include: + - os: windows-2022 + platform: 'x64' + CXX: g++-12 + ruby: '3.3' + swig: '4' + + steps: + - name: Checkout wxRuby3 + uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Setup Ruby gems + run: | + bundle install + + - name: Cache Doxygen + id: cache-doxygen + uses: actions/cache@v4 + 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 + 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 + run: | + echo "$env:PATH" + ruby -v + doxygen -v + ridk exec bash -c 'gcc -v' + ridk exec bash -c 'g++ -v' + + - name: Configure wxRuby3 + run: | + bundle exec rake configure[--with-wxwin,--autoinstall] + + - name: Build wxRuby3 + run: | + bundle exec rake build + + - name: Build wxRuby3 binpkg + run: | + bundle exec rake binpkg + + - name: Upload bin pkg as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.pkg + tag: v0.9.7 + overwrite: true + file_glob: true + + - name: Upload bin pkg digest signature as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.sha + tag: v0.9.7 + overwrite: true + file_glob: true + + release-macosx-binpkg: + needs: release-gem + runs-on: ${{ matrix.runner }} + name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) + strategy: + fail-fast: false + matrix: + include: + - name: macOS 12 + runner: macos-12 + arch: x86_64 + ruby: '3.3' + - name: macOS 13 + runner: macos-13 + arch: x86_64 + ruby: '3.3' + + steps: + - name: Checkout wxRuby3 + uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Setup Ruby gems + run: | + bundle install + + - name: Display build environment + run: | + echo "$env:PATH" + ruby -v + + - name: Configure wxRuby3 + run: | + bundle exec rake configure[--with-wxwin,--autoinstall] + + - name: Build wxRuby3 + run: | + bundle exec rake build + + - name: Build wxRuby3 binpkg + run: | + bundle exec rake binpkg + + - name: Upload bin pkg as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.pkg + tag: v0.9.7 + overwrite: true + file_glob: true + + - name: Upload bin pkg digest signature as release asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: pkg/*.sha + tag: v0.9.7 + overwrite: true + file_glob: true + verify-gem: - needs: release + needs: + - release-macosx-binpkg strategy: fail-fast: false matrix: @@ -101,11 +255,35 @@ jobs: gtk_version: 3 CC: gcc-12 CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' configure_flags: use_xvfb: true + build: true + wxw_type: develop + - os: ubuntu-22.04 + gtk_version: 3 + CC: gcc-12 + CXX: g++-12 + ruby: 'ruby' + wxWidgets: '3.2.4' + swig: '4' + configure_flags: + use_xvfb: true + build: true + wxw_type: embed + - name: macOS 12 + runner: macos-12 + arch: x86_64 + ruby: 'ruby' + build: false + - name: macOS 13 + runner: macos-13 + arch: x86_64 + ruby: 'ruby' + build: false + runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby Gem Test (${{ github.ref_name }}) env: @@ -118,8 +296,8 @@ jobs: WX_EXTRA_PACKAGES: doxygen patchelf CC: ${{ matrix.CC }} CXX: ${{ matrix.CXX }} - WXRUBY_VERSION: ${{ needs.release.outputs.version }} - WXRUBY_PRERELEASE: ${{ needs.release.outputs.prerelease }} + WXRUBY_VERSION: ${{ needs.release-gem.outputs.version }} + WXRUBY_PRERELEASE: ${{ needs.release-gem.outputs.prerelease }} steps: - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -127,6 +305,7 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: checkout wxWidgets + if: matrix.build == 'true' && matrix.wxw_type != 'embed' uses: actions/checkout@v4 with: repository: wxWidgets/wxWidgets @@ -135,6 +314,7 @@ jobs: submodules: 'recursive' - name: Set up build environment + if: matrix.build == 'true' && matrix.wxw_type != 'embed' run: | # Install locales used by our tests to run all the tests instead of # skipping them. @@ -146,18 +326,16 @@ jobs: run: | echo $PATH ruby -v - doxygen -v - gcc -v - g++ -v - name: Configuring wxWidgets + if: matrix.build == 'true' && matrix.wxw_type != 'embed' 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=$? + ./configure $wxCONFIGURE_OPTIONS --prefix=$WXWIN_INSTALL --disable-tests --without-subdirs --disable-debug_info || rc=$? if [ -n "$rc" ]; then echo '*** Configuring failed, contents of config.log follows: ***' echo '-----------------------------------------------------------' @@ -167,20 +345,35 @@ jobs: fi - name: Build and install wxWidgets + if: matrix.build == 'true' && matrix.wxw_type != 'embed' working-directory: ${{ env.WXWIDGETS_ROOT }} run: | - make && sudo make install && sudo ldconfig + make && make install - - name: Remove wxWidgets + - name: Install wxRuby3 gem with binary package + if: matrix.build != 'true' run: | - rm -rf $WXWIDGETS_ROOT + if [ "$WXRUBY_PRERELEASE" == "1" ]; then + gem install wxruby3 -v $WXRUBY_VERSION --pre -- --prebuilt + else + gem install wxruby3 -v $WXRUBY_VERSION -- --prebuilt + fi - - name: Install wxRuby3 gem + - name: Install wxRuby3 gem with local build + if: matrix.build == 'true' run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then - gem install wxruby3 -v $WXRUBY_VERSION --pre && wxruby setup --autoinstall + if [ "${{ matrix.wxw_type }}" == "embed" ]; then + gem install wxruby3 -v $WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --autoinstall + else + gem install wxruby3 -v $WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + fi else - gem install wxruby3 -v $WXRUBY_VERSION && wxruby setup --autoinstall + if [ "${{ matrix.wxw_type }}" == "embed" ]; then + gem install wxruby3 -v $WXRUBY_VERSION -- --no-prebuilt && wxruby setup --autoinstall + else + gem install wxruby3 -v $WXRUBY_VERSION -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + fi fi - name: Run wxRuby3 regression tests @@ -196,103 +389,14 @@ jobs: 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 && wxruby setup --autoinstall - else - gem install wxruby3 -v $WXRUBY_VERSION && wxruby setup --autoinstall - fi - - - name: Run wxRuby3 regression tests - run: | - wxruby test - release-bingem: - needs: release + verify-gem-windows: + needs: + - release-windows-binpkg runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} wxRuby Bingem Release (${{ github.ref_name }}) + name: ${{ matrix.os }} wxRuby Gem Test (${{ github.ref_name }}) env: - DOXYGEN_ROOT: ${{ github.workspace }}\doxygen - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + WXRUBY_VERSION: ${{ needs.release-gem.outputs.version }} + WXRUBY_PRERELEASE: ${{ needs.release-gem.outputs.prerelease }} strategy: fail-fast: false matrix: @@ -300,92 +404,14 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' - wxWidgets: '3.2.4' + ruby: 'ruby' 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@v4 - 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' + ruby: 'ruby' swig: '4' + build: true steps: - name: Install Ruby @@ -393,18 +419,24 @@ jobs: with: ruby-version: ${{ matrix.ruby }} - - name: Wait for RubyGems + - name: Install wxRuby3 gem with binary package + if: matrix.build != 'true' run: | - Start-Sleep -Seconds 300 + If ("$env:WXRUBY_PRERELEASE" -eq "1") { + gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --prebuilt + } + Else { + gem install wxruby3 -v $env:WXRUBY_VERSION -- --prebuilt + } - - name: Install wxRuby3 gem - if: matrix.wxr_type != 'develop' + - name: Install wxRuby3 gem with local build + if: matrix.build == 'true' run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_VERSION --pre + gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --autoinstall } Else { - gem install wxruby3 -v $env:WXRUBY_VERSION + gem install wxruby3 -v $env:WXRUBY_VERSION -- --no-prebuilt && wxruby setup --autoinstall } - name: Run wxRuby3 regression tests From ea730ae8e9deaf1935669367b9a58326bda22045 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 14:19:20 +0100 Subject: [PATCH 101/168] remove temporary workflow --- .github/workflows/release-test.yml | 162 ----------------------------- 1 file changed, 162 deletions(-) delete mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml deleted file mode 100644 index bb29aa08..00000000 --- a/.github/workflows/release-test.yml +++ /dev/null @@ -1,162 +0,0 @@ -# CI wxRuby test release workflow -name: Testing Release builds - -on: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: write - -jobs: - release-windows-binpkg: - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) - env: - DOXYGEN_ROOT: ${{ github.workspace }}\doxygen - strategy: - fail-fast: false - matrix: - include: - - os: windows-2022 - platform: 'x64' - CXX: g++-12 - ruby: '3.3' - swig: '4' - - steps: - - name: Checkout wxRuby3 - uses: actions/checkout@v4 - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - - name: Setup Ruby gems - run: | - bundle install - - - name: Cache Doxygen - id: cache-doxygen - uses: actions/cache@v4 - 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 - 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 - run: | - echo "$env:PATH" - ruby -v - doxygen -v - ridk exec bash -c 'gcc -v' - ridk exec bash -c 'g++ -v' - - - name: Configure wxRuby3 - run: | - bundle exec rake configure[--with-wxwin,--autoinstall] - - - name: Build wxRuby3 - run: | - bundle exec rake build - - - name: Build wxRuby3 binpkg - run: | - bundle exec rake binpkg - - - name: Upload bin pkg as release asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: pkg/*.pkg - tag: v0.9.7 - overwrite: true - file_glob: true - - - name: Upload bin pkg digest signature as release asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: pkg/*.sha - tag: v0.9.7 - overwrite: true - file_glob: true - release-macosx-binpkg: - runs-on: ${{ matrix.runner }} - name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) - strategy: - fail-fast: false - matrix: - include: - - name: macOS 12 - runner: macos-12 - arch: x86_64 - ruby: '3.3' - - name: macOS 13 - runner: macos-13 - arch: x86_64 - ruby: '3.3' - - steps: - - name: Checkout wxRuby3 - uses: actions/checkout@v4 - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - - name: Setup Ruby gems - run: | - bundle install - - - name: Display build environment - run: | - echo "$env:PATH" - ruby -v - - - name: Configure wxRuby3 - run: | - bundle exec rake configure[--with-wxwin,--autoinstall] - - - name: Build wxRuby3 - run: | - bundle exec rake build - - - name: Build wxRuby3 binpkg - run: | - bundle exec rake binpkg - - - name: Upload bin pkg as release asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: pkg/*.pkg - tag: v0.9.7 - overwrite: true - file_glob: true - - - name: Upload bin pkg digest signature as release asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: pkg/*.sha - tag: v0.9.7 - overwrite: true - file_glob: true From 36d47e57542ee10367868db74288aa02e54add82 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 15:08:41 +0100 Subject: [PATCH 102/168] finalize and add release test support --- .github/workflows/release.yml | 129 +++++++++++++++++++++++++++------- 1 file changed, 105 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61238636..6aa1c9c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: matrix: include: - os: ubuntu-22.04 - ruby: '3.2' + ruby: 'ruby' runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby Release (${{ github.ref_name }}) env: @@ -36,28 +36,24 @@ jobs: 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: Create GPG signature for wxRuby3 gem - if: ${{ github.event_name != 'workflow_dispatch' }} run: | echo -n "${{ secrets.GPG_KEY }}" | base64 --decode | gpg --pinentry-mode loopback --batch --passphrase ${{ secrets.GPG_PASSPHRASE }} --import gpg --detach-sign --pinentry-mode loopback --batch --passphrase ${{ secrets.GPG_PASSPHRASE }} --armor pkg/*.gem - name: Upload gem to release - if: ${{ github.event_name != 'workflow_dispatch' }} + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -67,7 +63,7 @@ jobs: file_glob: true - name: Upload gem GPG signature to release - if: ${{ github.event_name != 'workflow_dispatch' }} + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -77,11 +73,19 @@ jobs: file_glob: true - name: Publish Gem on RubyGems - if: ${{ github.event_name != 'workflow_dispatch' }} + if: github.event_name != 'workflow_dispatch' run: | - gem push pkg/*.gem + gem push pkg/*.gem + + - name: Upload Gem as release test artifact + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: wxruby3_release_test_gem + path: pkg/*.gem - name: Set version variables + if: github.event_name != 'workflow_dispatch' id: version_var run: | echo "WXRUBY_VERSION=${GITHUB_REF_NAME/#v/}" >> "$GITHUB_OUTPUT" @@ -102,7 +106,8 @@ jobs: fail-fast: false matrix: include: - - os: windows-2022 + - name: Windows2022 + os: windows-2022 platform: 'x64' CXX: g++-12 ruby: '3.3' @@ -163,6 +168,7 @@ jobs: bundle exec rake binpkg - name: Upload bin pkg as release asset + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -172,6 +178,7 @@ jobs: file_glob: true - name: Upload bin pkg digest signature as release asset + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -180,19 +187,26 @@ jobs: overwrite: true file_glob: true + - name: Upload bin pkg as release test artifacts + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: wxruby3_release_test_bin_${{ matrix.name }} + path: pkg/* + release-macosx-binpkg: needs: release-gem runs-on: ${{ matrix.runner }} - name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) + name: ${{ matrix.runner }} wxRuby Binpkg Release (${{ github.ref_name }}) strategy: fail-fast: false matrix: include: - - name: macOS 12 + - name: macOS12 runner: macos-12 arch: x86_64 ruby: '3.3' - - name: macOS 13 + - name: macOS13 runner: macos-13 arch: x86_64 ruby: '3.3' @@ -227,6 +241,7 @@ jobs: bundle exec rake binpkg - name: Upload bin pkg as release asset + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -236,6 +251,7 @@ jobs: file_glob: true - name: Upload bin pkg digest signature as release asset + if: github.event_name != 'workflow_dispatch' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -244,6 +260,13 @@ jobs: overwrite: true file_glob: true + - name: Upload bin pkg as release test artifacts + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: wxruby3_release_test_bin_${{ matrix.name }} + path: pkg/* + verify-gem: needs: - release-macosx-binpkg @@ -251,7 +274,8 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-22.04 + - name: Ubuntu2204 + os: ubuntu-22.04 gtk_version: 3 CC: gcc-12 CXX: g++-12 @@ -262,7 +286,8 @@ jobs: use_xvfb: true build: true wxw_type: develop - - os: ubuntu-22.04 + - name: Ubuntu2204 + os: ubuntu-22.04 gtk_version: 3 CC: gcc-12 CXX: g++-12 @@ -273,12 +298,12 @@ jobs: use_xvfb: true build: true wxw_type: embed - - name: macOS 12 + - name: macOS12 runner: macos-12 arch: x86_64 ruby: 'ruby' build: false - - name: macOS 13 + - name: macOS13 runner: macos-13 arch: x86_64 ruby: 'ruby' @@ -351,7 +376,7 @@ jobs: make && make install - name: Install wxRuby3 gem with binary package - if: matrix.build != 'true' + if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then gem install wxruby3 -v $WXRUBY_VERSION --pre -- --prebuilt @@ -360,7 +385,7 @@ jobs: fi - name: Install wxRuby3 gem with local build - if: matrix.build == 'true' + if: matrix.build == 'true' && github.event_name != 'workflow_dispatch' run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then if [ "${{ matrix.wxw_type }}" == "embed" ]; then @@ -376,7 +401,34 @@ jobs: fi fi - - name: Run wxRuby3 regression tests + - name: Download release test gem artifact + if: github.event_name == 'workflow_dispatch' + uses: actions/download-artifact@v4 + with: + name: wxruby3_release_test_gem + + - name: Download bin pkg artifacts + if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + uses: actions/download-artifact@v4 + with: + name: wxruby3_release_test_bin_${{ matrix.name }} + + - name: Install wxRuby3 gem with binary package (release test) + if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + run: | + gem install ./$(wxruby3*.gem) -- --package=$(wxruby3*.pkg) + + - name: Install wxRuby3 gem with local build (release test) + if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' + run: | + if [ "${{ matrix.wxw_type }}" == "embed" ]; then + gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --autoinstall + else + gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + fi + + - name: Run wxRuby3 regression tests (XVFB) + if: matrix.use_xvfb == 'true' run: | ulimit -c unlimited TEST_CMD="wxruby test" @@ -389,6 +441,11 @@ jobs: exit $rc fi + - name: Run wxRuby3 regression tests + if: matrix.use_xvfb != 'true' + run: | + wxruby test + verify-gem-windows: needs: - release-windows-binpkg @@ -401,12 +458,14 @@ jobs: fail-fast: false matrix: include: - - os: windows-2022 + - name: Windows2022 + os: windows-2022 platform: 'x64' CXX: g++-12 ruby: 'ruby' swig: '4' - - os: windows-2022 + - name: Windows2022 + os: windows-2022 platform: 'x64' CXX: g++-12 ruby: 'ruby' @@ -420,7 +479,7 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: Install wxRuby3 gem with binary package - if: matrix.build != 'true' + if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --prebuilt @@ -430,7 +489,7 @@ jobs: } - name: Install wxRuby3 gem with local build - if: matrix.build == 'true' + if: matrix.build == 'true' && github.event_name != 'workflow_dispatch' run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --autoinstall @@ -439,6 +498,28 @@ jobs: gem install wxruby3 -v $env:WXRUBY_VERSION -- --no-prebuilt && wxruby setup --autoinstall } + - name: Download release test gem artifact + if: github.event_name == 'workflow_dispatch' + uses: actions/download-artifact@v4 + with: + name: wxruby3_release_test_gem + + - name: Download bin pkg artifacts + if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + uses: actions/download-artifact@v4 + with: + name: wxruby3_release_test_bin_${{ matrix.name }} + + - name: Install wxRuby3 gem with binary package (release test) + if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + run: | + gem install ./$(wxruby3*.gem) -- --package=$(wxruby3*.pkg) + + - name: Install wxRuby3 gem with local build (release test) + if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' + run: | + gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --autoinstall + - name: Run wxRuby3 regression tests run: | wxruby test From a33fa504f924ee0c2cfab4dfd2367ae9019f4847 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 16:08:40 +0100 Subject: [PATCH 103/168] fix argv var --- ext/mkrf_conf_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index 95e98eab..a99b48fb 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -26,7 +26,7 @@ puts exit(0) end -opts.parse!(args) +opts.parse(ARGV) task_args = '' unless OPTIONS[:prebuilt].nil? From 668d81fb6c63ce7f1a5f498194df8766a819d75a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 16:43:27 +0100 Subject: [PATCH 104/168] fix issues with Rake arg parsing --- .github/workflows/release.yml | 30 +++++++++++----------- ext/mkrf_conf_ext.rb | 47 ++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6aa1c9c3..7e929c8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -379,9 +379,9 @@ jobs: if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then - gem install wxruby3 -v $WXRUBY_VERSION --pre -- --prebuilt + gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=only else - gem install wxruby3 -v $WXRUBY_VERSION -- --prebuilt + gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=only fi - name: Install wxRuby3 gem with local build @@ -389,15 +389,15 @@ jobs: run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --autoinstall + gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi else if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_VERSION -- --no-prebuilt && wxruby setup --autoinstall + gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_VERSION -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi fi @@ -416,15 +416,15 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' run: | - gem install ./$(wxruby3*.gem) -- --package=$(wxruby3*.pkg) + gem install ./$(wxruby3*.gem) -- package=$(wxruby3*.pkg) - name: Install wxRuby3 gem with local build (release test) if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' run: | if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --autoinstall + gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall else - gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi - name: Run wxRuby3 regression tests (XVFB) @@ -482,20 +482,20 @@ jobs: if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --prebuilt + gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=only } Else { - gem install wxruby3 -v $env:WXRUBY_VERSION -- --prebuilt + gem install wxruby3 -v $env:WXRUBY_VERSION -- prebuilt=only } - name: Install wxRuby3 gem with local build if: matrix.build == 'true' && github.event_name != 'workflow_dispatch' run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- --no-prebuilt && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --autoinstall } Else { - gem install wxruby3 -v $env:WXRUBY_VERSION -- --no-prebuilt && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_VERSION -- prebuilt=none && wxruby setup --autoinstall } - name: Download release test gem artifact @@ -513,12 +513,12 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' run: | - gem install ./$(wxruby3*.gem) -- --package=$(wxruby3*.pkg) + gem install ./$(wxruby3*.gem) -- package=$(wxruby3*.pkg) - name: Install wxRuby3 gem with local build (release test) if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' run: | - gem install ./$(wxruby3*.gem) -- --no-prebuilt && wxruby setup --autoinstall + gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall - name: Run wxRuby3 regression tests run: | diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index a99b48fb..fe2ba915 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -6,27 +6,40 @@ # wxRuby3 extension configuration file for gems ### -require 'optparse' - OPTIONS = { } -opts = OptionParser.new -opts.banner = "wxRuby3 extension build script\n\nUsage: gem install wxruby3 -- -h|--help OR gem install wxruby3 [-- options]\n\n" -opts.separator '' -opts.on('--[no-]prebuilt', - "Specifies to either require ('--prebuilt') or avoid ('--no-prebuilt') installing prebuilt binary packages.", - "If not specified installing a prebuilt package will be attempted reverting to source install if none found.") {|v| OPTIONS[:prebuilt] = !!v } -opts.on('--package=URL', - "Specifies the http(s) url or absolute path to the prebuilt binary package to install.", - "Implies '--prebuilt'.") {|v| OPTIONS[:package] = v } -opts.on('-h', '--help', - 'Show this message.') do |v| - puts opts - puts - exit(0) +until ARGV.empty? + switch = ARGV.shift + case switch + when /^prebuilt=(none|only)$/ + OPTIONS[:prebuilt] = $1 == 'only' + when /^package=(.+)$/ + OPTIONS[:package] = $1 + when 'help' + puts <<~__INFO_TXT + wxRuby3 extension build script + + Usage: gem install wxruby3 -- help OR gem install wxruby3 [-- options [...]] + + options: + + prebuilt=OPT Specifies to either require (OPT == 'only') or avoid (OPT == 'none') installing prebuilt + binary packages. If not specified installing a prebuilt package will be attempted reverting + to source install if none found. + + package=URL Specifies the http(s) url or absolute path to the prebuilt binary package to install. + Implies 'prebuilt=only'. + + help Show this message. + __INFO_TXT + puts + exit(1) + else + $stderr.puts "ERROR: Invalid option [#{switch}] for wxRuby3 extension build script." + exit(1) + end end -opts.parse(ARGV) task_args = '' unless OPTIONS[:prebuilt].nil? From 3075429314b00de7ed235f1fec37293adff8f5bb Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 16:47:08 +0100 Subject: [PATCH 105/168] properly quote Rake task args --- ext/mkrf_conf_ext.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index fe2ba915..8d9aed55 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -43,11 +43,11 @@ task_args = '' unless OPTIONS[:prebuilt].nil? - task_args << (OPTIONS[:prebuilt] ? '--prebuilt' : '--no-prebuilt') + task_args << "'#{(OPTIONS[:prebuilt] ? '--prebuilt' : '--no-prebuilt')}'" end if OPTIONS[:package] task_args << ', ' unless task_args.empty? - task_args << '--package, ' << OPTIONS[:package] + task_args << "'--package', " << "'#{OPTIONS[:package]}'" end # generate new rakefile with appropriate default task (calls actual task in rakelib) From 36d1b8d94e6cefb10cc12671b19566ecbb340a06 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 14 Feb 2024 18:44:26 +0100 Subject: [PATCH 106/168] fix windows testing --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e929c8b..07e04a9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -481,7 +481,7 @@ jobs: - name: Install wxRuby3 gem with binary package if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' run: | - If ("$env:WXRUBY_PRERELEASE" -eq "1") { + If ("$env:WXRUBY_PRERELEASE" -eq "1") { gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=only } Else { @@ -513,12 +513,12 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' run: | - gem install ./$(wxruby3*.gem) -- package=$(wxruby3*.pkg) + foreach ($f in Get-ChildItem -Path pkg\wxruby3*.gem) { foreach ($p in Get-ChildItem -Path pkg\wxruby3*.pkg) { gem install $f && wxruby setup -- package=$p } } - name: Install wxRuby3 gem with local build (release test) if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' run: | - gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall + foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } - name: Run wxRuby3 regression tests run: | From 86fc052e0282c66e3fce85d983d5033bd065a64c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 08:05:16 +0100 Subject: [PATCH 107/168] fix windows testing --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e04a9a..c76a250f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -513,12 +513,12 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' run: | - foreach ($f in Get-ChildItem -Path pkg\wxruby3*.gem) { foreach ($p in Get-ChildItem -Path pkg\wxruby3*.pkg) { gem install $f && wxruby setup -- package=$p } } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f && wxruby setup -- package=$p } } - name: Install wxRuby3 gem with local build (release test) if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' run: | - foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } - name: Run wxRuby3 regression tests run: | From 2f195c8cd5c332ac97462c1638c82219bf6b42e1 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 12:47:18 +0100 Subject: [PATCH 108/168] fix release workflow --- .github/workflows/release.yml | 51 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c76a250f..734c0850 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -196,18 +196,18 @@ jobs: release-macosx-binpkg: needs: release-gem - runs-on: ${{ matrix.runner }} - name: ${{ matrix.runner }} wxRuby Binpkg Release (${{ github.ref_name }}) + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} wxRuby Binpkg Release (${{ github.ref_name }}) strategy: fail-fast: false matrix: include: - name: macOS12 - runner: macos-12 + os: macos-12 arch: x86_64 ruby: '3.3' - name: macOS13 - runner: macos-13 + os: macos-13 arch: x86_64 ruby: '3.3' @@ -299,12 +299,12 @@ jobs: build: true wxw_type: embed - name: macOS12 - runner: macos-12 + os: macos-12 arch: x86_64 ruby: 'ruby' build: false - name: macOS13 - runner: macos-13 + os: macos-13 arch: x86_64 ruby: 'ruby' build: false @@ -330,7 +330,7 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: checkout wxWidgets - if: matrix.build == 'true' && matrix.wxw_type != 'embed' + if: ${{ matrix.build && matrix.wxw_type != 'embed' }} uses: actions/checkout@v4 with: repository: wxWidgets/wxWidgets @@ -339,7 +339,7 @@ jobs: submodules: 'recursive' - name: Set up build environment - if: matrix.build == 'true' && matrix.wxw_type != 'embed' + if: ${{ matrix.build && matrix.wxw_type != 'embed' }} run: | # Install locales used by our tests to run all the tests instead of # skipping them. @@ -353,7 +353,7 @@ jobs: ruby -v - name: Configuring wxWidgets - if: matrix.build == 'true' && matrix.wxw_type != 'embed' + if: ${{ matrix.build && matrix.wxw_type != 'embed' }} working-directory: ${{ env.WXWIDGETS_ROOT }} run: | wxCONFIGURE_OPTIONS="$wxCONFIGURE_FLAGS" @@ -370,13 +370,13 @@ jobs: fi - name: Build and install wxWidgets - if: matrix.build == 'true' && matrix.wxw_type != 'embed' + if: ${{ matrix.build && matrix.wxw_type != 'embed' }} working-directory: ${{ env.WXWIDGETS_ROOT }} run: | make && make install - name: Install wxRuby3 gem with binary package - if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name != 'workflow_dispatch' }} run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=only @@ -385,7 +385,7 @@ jobs: fi - name: Install wxRuby3 gem with local build - if: matrix.build == 'true' && github.event_name != 'workflow_dispatch' + if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then if [ "${{ matrix.wxw_type }}" == "embed" ]; then @@ -402,24 +402,24 @@ jobs: fi - name: Download release test gem artifact - if: github.event_name == 'workflow_dispatch' + if: ${{ github.event_name == 'workflow_dispatch' }} uses: actions/download-artifact@v4 with: name: wxruby3_release_test_gem - name: Download bin pkg artifacts - if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} uses: actions/download-artifact@v4 with: name: wxruby3_release_test_bin_${{ matrix.name }} - name: Install wxRuby3 gem with binary package (release test) - if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | gem install ./$(wxruby3*.gem) -- package=$(wxruby3*.pkg) - name: Install wxRuby3 gem with local build (release test) - if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' + if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} run: | if [ "${{ matrix.wxw_type }}" == "embed" ]; then gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall @@ -428,7 +428,7 @@ jobs: fi - name: Run wxRuby3 regression tests (XVFB) - if: matrix.use_xvfb == 'true' + if: ${{ matrix.use_xvfb }} run: | ulimit -c unlimited TEST_CMD="wxruby test" @@ -442,7 +442,7 @@ jobs: fi - name: Run wxRuby3 regression tests - if: matrix.use_xvfb != 'true' + if: ${{ !matrix.use_xvfb }} run: | wxruby test @@ -464,6 +464,7 @@ jobs: CXX: g++-12 ruby: 'ruby' swig: '4' + build: false - name: Windows2022 os: windows-2022 platform: 'x64' @@ -479,7 +480,7 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: Install wxRuby3 gem with binary package - if: matrix.build != 'true' && github.event_name != 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name != 'workflow_dispatch' }} run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=only @@ -489,7 +490,7 @@ jobs: } - name: Install wxRuby3 gem with local build - if: matrix.build == 'true' && github.event_name != 'workflow_dispatch' + if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --autoinstall @@ -499,24 +500,24 @@ jobs: } - name: Download release test gem artifact - if: github.event_name == 'workflow_dispatch' + if: ${{ github.event_name == 'workflow_dispatch' }} uses: actions/download-artifact@v4 with: name: wxruby3_release_test_gem - name: Download bin pkg artifacts - if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} uses: actions/download-artifact@v4 with: name: wxruby3_release_test_bin_${{ matrix.name }} - name: Install wxRuby3 gem with binary package (release test) - if: matrix.build != 'true' && github.event_name == 'workflow_dispatch' + if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | - foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f && wxruby setup -- package=$p } } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$p } } - name: Install wxRuby3 gem with local build (release test) - if: matrix.build == 'true' && github.event_name == 'workflow_dispatch' + if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} run: | foreach ($f in Get-ChildItem -Path wxruby3*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } From 8df70d8f4e1eab6c65e54742b338344596eaef26 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 13:42:17 +0100 Subject: [PATCH 109/168] fix typos --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 734c0850..0379e0d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -416,15 +416,15 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | - gem install ./$(wxruby3*.gem) -- package=$(wxruby3*.pkg) + gem install ./$(echo wxruby3*.gem) -- package=$(echo wxruby3*.pkg) - name: Install wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} run: | if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall + gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall else - gem install ./$(wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi - name: Run wxRuby3 regression tests (XVFB) From 585a591513997fcfa32f5f3c08ea43be939b2f1d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 14:50:30 +0100 Subject: [PATCH 110/168] fix package paths --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0379e0d0..bab7b465 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -416,7 +416,7 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | - gem install ./$(echo wxruby3*.gem) -- package=$(echo wxruby3*.pkg) + gem install ./$(echo wxruby3*.gem) -- package=`pwd`/$(echo wxruby3*.pkg) - name: Install wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} @@ -514,7 +514,7 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | - foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$p } } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$PWD\$p } } - name: Install wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} From 23ca306865481c28047ae79f4051f43613bedff2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 14:51:08 +0100 Subject: [PATCH 111/168] refactor updating shlib load paths --- rakelib/install.rb | 9 ++----- rakelib/lib/config.rb | 6 ++++- rakelib/lib/config/macosx.rb | 45 +++++++++++++++++++++++++++++++---- rakelib/lib/config/unixish.rb | 10 ++++++++ 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/rakelib/install.rb b/rakelib/install.rb index 0a48bd37..b1c37ae8 100644 --- a/rakelib/install.rb +++ b/rakelib/install.rb @@ -67,24 +67,19 @@ def install_wxwin_shlibs FileUtils.ln_s(File.join('.', File.basename(src_shlib)), File.join('ext', File.basename(shlib))) else FileUtils.cp(shlib, inshlib = File.join('ext', File.basename(shlib))) - unless WXRuby3.config.patch_rpath(inshlib, WXRuby3.config.get_rpath_origin) - # cleanup and exit - FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) - exit(1) - end wxwin_inshlibs << File.expand_path(inshlib) end end # prepare wxRuby shared libs Dir["lib/*.#{WXRuby3.config.dll_mask}"].each do |shlib| - unless WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin, "#{WXRuby3.config.get_rpath_origin}/../ext") + unless WXRuby3.config.update_wxruby_shlib_loadpaths(shlib) # cleanup and exit FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) exit(1) end end (wxwin_inshlibs + Dir["lib/*.#{WXRuby3.config.dll_mask}"]).each do |shlib| - unless WXRuby3.config.update_shlib_loadpaths(shlib, WXRuby3::Install.wxwin_shlibs) + unless WXRuby3.config.update_wxwin_shlib_loadpaths(shlib, WXRuby3::Install.wxwin_shlibs) # cleanup and exit FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) exit(1) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 1745791b..a4db8da7 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -456,7 +456,11 @@ def patch_rpath(_shlib, *) true end - def update_shlib_loadpaths(_shlib, _deplibs) + def update_wxruby_shlib_loadpaths(_shlib) + true + end + + def update_wxwin_shlib_loadpaths(_shlib, _deplibs) true end diff --git a/rakelib/lib/config/macosx.rb b/rakelib/lib/config/macosx.rb index 26da73fd..ad784a11 100644 --- a/rakelib/lib/config/macosx.rb +++ b/rakelib/lib/config/macosx.rb @@ -9,6 +9,8 @@ require_relative './unixish' require_relative 'pkgman/macosx' +require 'pathname' + module WXRuby3 module Config @@ -48,10 +50,45 @@ def patch_rpath(shlib, *rpath) true end - def update_shlib_loadpaths(shlib, deplibs) - changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"} - sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| } - true + # add deployment lookup paths for wxruby shared libraries + def update_wxruby_shlib_loadpaths(shlib) + # default lookup for any of the unixish platforms + if super + # fix lookup for the Ruby shared library + # on MacOSX the Ruby library will be linked with it's full path from the **development** environment + # which is no use after binary deployment so we change that to be relative to the executable's path + # loading the shared libs (which is always going to be the Ruby exe) + + # get the development folder holding ruby lib + ruby_libdir = Pathname.new(RB_CONFIG['libdir']) + # determine the relative path to the lib directory from the executable dir + # (this remains constant for any similar deployed Ruby for this platform) + rel_ruby_libdir = ruby_libdir.relative_path_from(RB_CONFIG['bindir']) + # get the Ruby library name used for linking + ld_ruby_lib = (RB_CONFIG['LIBRUBYARG_SHARED'].split.find { |s| s =~ /^-lruby/ }).sub(/^-l/,'') + # match the full shared library name that will be linked + ruby_so = [RB_CONFIG['LIBRUBY_SO'], RB_CONFIG['LIBRUBY_SONAME'], *RB_CONFIG['LIBRUBY_ALIASES'].split].find do |soname| + soname =~ /^#{ld_ruby_lib}\./ + end + # form the full path of the shared Ruby library linked + ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO']) + # change the full path to a path relative to the Ruby executable + sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{}' #{shlib}") + true + else + false + end + end + + # add deployment lookup paths for wxwidgets shared libraries + def update_wxwin_shlib_loadpaths(shlib, deplibs) + if super + changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"} + sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| } + true + else + false + end end def check_tool_pkgs diff --git a/rakelib/lib/config/unixish.rb b/rakelib/lib/config/unixish.rb index 3249cb44..0b2a3fb4 100644 --- a/rakelib/lib/config/unixish.rb +++ b/rakelib/lib/config/unixish.rb @@ -67,6 +67,16 @@ def get_rpath_origin "$ORIGIN" end + # add deployment lookup paths for wxruby shared libraries + def update_wxruby_shlib_loadpaths(shlib) + WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin, "#{WXRuby3.config.get_rpath_origin}/../ext") + end + + # add deployment lookup paths for wxwidgets shared libraries + def update_wxwin_shlib_loadpaths(shlib, _deplibs) + WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin) + end + def expand(cmd) STDERR.puts "> sh: #{cmd}" if verbose? s = super From ba40c7c04d5a7bd36a9b982a3f541f48b748c8e0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 15:45:32 +0100 Subject: [PATCH 112/168] fix omitted so name --- rakelib/lib/config/macosx.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/config/macosx.rb b/rakelib/lib/config/macosx.rb index ad784a11..e4c85a63 100644 --- a/rakelib/lib/config/macosx.rb +++ b/rakelib/lib/config/macosx.rb @@ -73,7 +73,7 @@ def update_wxruby_shlib_loadpaths(shlib) # form the full path of the shared Ruby library linked ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO']) # change the full path to a path relative to the Ruby executable - sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{}' #{shlib}") + sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{ruby_so}' #{shlib}") true else false From 3c98f4239df102191740634872dd242ba3d09a46 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 16:26:59 +0100 Subject: [PATCH 113/168] fix updating shlib load paths --- rakelib/install.rb | 9 ++++-- rakelib/lib/config.rb | 10 +++--- rakelib/lib/config/linux.rb | 2 ++ rakelib/lib/config/macosx.rb | 61 +++++++++++++++-------------------- rakelib/lib/config/unixish.rb | 8 ++--- 5 files changed, 43 insertions(+), 47 deletions(-) diff --git a/rakelib/install.rb b/rakelib/install.rb index b1c37ae8..f5f9e88e 100644 --- a/rakelib/install.rb +++ b/rakelib/install.rb @@ -67,19 +67,24 @@ def install_wxwin_shlibs FileUtils.ln_s(File.join('.', File.basename(src_shlib)), File.join('ext', File.basename(shlib))) else FileUtils.cp(shlib, inshlib = File.join('ext', File.basename(shlib))) + unless WXRuby3.config.update_shlib_loadpaths(inshlib) + # cleanup and exit + FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) + exit(1) + end wxwin_inshlibs << File.expand_path(inshlib) end end # prepare wxRuby shared libs Dir["lib/*.#{WXRuby3.config.dll_mask}"].each do |shlib| - unless WXRuby3.config.update_wxruby_shlib_loadpaths(shlib) + unless WXRuby3.config.update_shlib_loadpaths(shlib) && WXRuby3.config.update_shlib_ruby_libpath(shlib) # cleanup and exit FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) exit(1) end end (wxwin_inshlibs + Dir["lib/*.#{WXRuby3.config.dll_mask}"]).each do |shlib| - unless WXRuby3.config.update_wxwin_shlib_loadpaths(shlib, WXRuby3::Install.wxwin_shlibs) + unless WXRuby3.config.update_shlib_wxwin_libpaths(shlib, WXRuby3::Install.wxwin_shlibs) # cleanup and exit FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"]) exit(1) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index a4db8da7..3fd9a7d1 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -447,20 +447,22 @@ def do_link(_pkg) def get_rpath_origin '' end + protected :get_rpath_origin - def check_rpath_patch + def patch_rpath(_shlib, *) true end + protected :patch_rpath - def patch_rpath(_shlib, *) + def update_shlib_loadpaths(_shlib) true end - def update_wxruby_shlib_loadpaths(_shlib) + def update_shlib_ruby_libpath(_shlib) true end - def update_wxwin_shlib_loadpaths(_shlib, _deplibs) + def update_shlib_wxwin_libpaths(_shlib, _deplibs) true end diff --git a/rakelib/lib/config/linux.rb b/rakelib/lib/config/linux.rb index af7babac..f53882bd 100644 --- a/rakelib/lib/config/linux.rb +++ b/rakelib/lib/config/linux.rb @@ -42,6 +42,7 @@ def check_rpath_patch end true end + protected :check_rpath_patch def patch_rpath(shlib, *rpath) if check_rpath_patch @@ -50,6 +51,7 @@ def patch_rpath(shlib, *rpath) end false end + protected :patch_rpath def check_tool_pkgs pkg_deps = super diff --git a/rakelib/lib/config/macosx.rb b/rakelib/lib/config/macosx.rb index e4c85a63..dcf18a9d 100644 --- a/rakelib/lib/config/macosx.rb +++ b/rakelib/lib/config/macosx.rb @@ -35,12 +35,7 @@ def dll_mask def get_rpath_origin "@loader_path" end - - def check_rpath_patch - # no need to check anything; install_name_tool is part of XCode cmdline tools - # and without these we couldn't build anything - true - end + protected :get_rpath_origin def patch_rpath(shlib, *rpath) # don't leave old rpath-s behind @@ -49,39 +44,35 @@ def patch_rpath(shlib, *rpath) sh("install_name_tool #{rpath.collect {|rp| "-add_rpath '#{rp}'"}.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| } true end - - # add deployment lookup paths for wxruby shared libraries - def update_wxruby_shlib_loadpaths(shlib) - # default lookup for any of the unixish platforms - if super - # fix lookup for the Ruby shared library - # on MacOSX the Ruby library will be linked with it's full path from the **development** environment - # which is no use after binary deployment so we change that to be relative to the executable's path - # loading the shared libs (which is always going to be the Ruby exe) - - # get the development folder holding ruby lib - ruby_libdir = Pathname.new(RB_CONFIG['libdir']) - # determine the relative path to the lib directory from the executable dir - # (this remains constant for any similar deployed Ruby for this platform) - rel_ruby_libdir = ruby_libdir.relative_path_from(RB_CONFIG['bindir']) - # get the Ruby library name used for linking - ld_ruby_lib = (RB_CONFIG['LIBRUBYARG_SHARED'].split.find { |s| s =~ /^-lruby/ }).sub(/^-l/,'') - # match the full shared library name that will be linked - ruby_so = [RB_CONFIG['LIBRUBY_SO'], RB_CONFIG['LIBRUBY_SONAME'], *RB_CONFIG['LIBRUBY_ALIASES'].split].find do |soname| - soname =~ /^#{ld_ruby_lib}\./ - end - # form the full path of the shared Ruby library linked - ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO']) - # change the full path to a path relative to the Ruby executable - sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{ruby_so}' #{shlib}") - true - else - false + protected :patch_rpath + + # add Ruby library path for wxruby shared libraries + def update_shlib_ruby_libpath(shlib) + # fix lookup for the Ruby shared library + # on MacOSX the Ruby library will be linked with it's full path from the **development** environment + # which is no use after binary deployment so we change that to be relative to the executable's path + # loading the shared libs (which is always going to be the Ruby exe) + + # get the development folder holding ruby lib + ruby_libdir = Pathname.new(RB_CONFIG['libdir']) + # determine the relative path to the lib directory from the executable dir + # (this remains constant for any similar deployed Ruby for this platform) + rel_ruby_libdir = ruby_libdir.relative_path_from(RB_CONFIG['bindir']) + # get the Ruby library name used for linking + ld_ruby_lib = (RB_CONFIG['LIBRUBYARG_SHARED'].split.find { |s| s =~ /^-lruby/ }).sub(/^-l/,'') + # match the full shared library name that will be linked + ruby_so = [RB_CONFIG['LIBRUBY_SO'], RB_CONFIG['LIBRUBY_SONAME'], *RB_CONFIG['LIBRUBY_ALIASES'].split].find do |soname| + soname =~ /^#{ld_ruby_lib}\./ end + # form the full path of the shared Ruby library linked + ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO']) + # change the full path to a path relative to the Ruby executable + sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{ruby_so}' #{shlib}") + true end # add deployment lookup paths for wxwidgets shared libraries - def update_wxwin_shlib_loadpaths(shlib, deplibs) + def update_shlib_wxwin_libpaths(shlib, deplibs) if super changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"} sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| } diff --git a/rakelib/lib/config/unixish.rb b/rakelib/lib/config/unixish.rb index 0b2a3fb4..dd9d4546 100644 --- a/rakelib/lib/config/unixish.rb +++ b/rakelib/lib/config/unixish.rb @@ -66,17 +66,13 @@ def check_tool_pkgs def get_rpath_origin "$ORIGIN" end + protected :get_rpath_origin # add deployment lookup paths for wxruby shared libraries - def update_wxruby_shlib_loadpaths(shlib) + def update_shlib_loadpaths(shlib) WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin, "#{WXRuby3.config.get_rpath_origin}/../ext") end - # add deployment lookup paths for wxwidgets shared libraries - def update_wxwin_shlib_loadpaths(shlib, _deplibs) - WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin) - end - def expand(cmd) STDERR.puts "> sh: #{cmd}" if verbose? s = super From 3b923d83a9315370c04f3f12d94fa2e9e7b9154d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 18:30:02 +0100 Subject: [PATCH 114/168] fix window package path --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bab7b465..ef69bdaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -514,7 +514,7 @@ jobs: - name: Install wxRuby3 gem with binary package (release test) if: ${{ !matrix.build && github.event_name == 'workflow_dispatch' }} run: | - foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$PWD\$p } } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$p } } - name: Install wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} From 317d58d87a0f75c6bf381f8b5455ec624d3a1d3c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 18:37:19 +0100 Subject: [PATCH 115/168] add temporary test workflow --- .github/workflows/release-test.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..6277772c --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,36 @@ +name: Test workflow + +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + runs-on: ${{ matrix.os }} + name: Ruby config test + strategy: + fail-fast: false + matrix: + include: + - name: macOS12 + os: macos-12 + arch: x86_64 + ruby: '3.3' + - name: macOS13 + os: macos-13 + arch: x86_64 + ruby: '3.3' + + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Show Ruby config + run: | + ruby -e "RbConfig::CONFIG.each_pair {|k,v| puts %Q{#{k}=#{v}} }" From 436410793b3294274e675c6ea6329855fa127d43 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 18:38:44 +0100 Subject: [PATCH 116/168] add temporary test workflow --- .github/workflows/release-test.yml | 43 +++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 6277772c..c32b4207 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -11,26 +11,27 @@ permissions: contents: write jobs: - runs-on: ${{ matrix.os }} - name: Ruby config test - strategy: - fail-fast: false - matrix: - include: - - name: macOS12 - os: macos-12 - arch: x86_64 - ruby: '3.3' - - name: macOS13 - os: macos-13 - arch: x86_64 - ruby: '3.3' + test: + runs-on: ${{ matrix.os }} + name: Ruby config test + strategy: + fail-fast: false + matrix: + include: + - name: macOS12 + os: macos-12 + arch: x86_64 + ruby: '3.3' + - name: macOS13 + os: macos-13 + arch: x86_64 + ruby: '3.3' - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} - - name: Show Ruby config - run: | - ruby -e "RbConfig::CONFIG.each_pair {|k,v| puts %Q{#{k}=#{v}} }" + - name: Show Ruby config + run: | + ruby -e "RbConfig::CONFIG.each_pair {|k,v| puts %Q{#{k}=#{v}} }" From 7d6d1b0e4dc803bca4aada7954fa75439ea3f3b7 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 18:45:29 +0100 Subject: [PATCH 117/168] fix macosx ruby lib matching --- rakelib/lib/config/macosx.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/config/macosx.rb b/rakelib/lib/config/macosx.rb index dcf18a9d..a06e03a7 100644 --- a/rakelib/lib/config/macosx.rb +++ b/rakelib/lib/config/macosx.rb @@ -62,7 +62,7 @@ def update_shlib_ruby_libpath(shlib) ld_ruby_lib = (RB_CONFIG['LIBRUBYARG_SHARED'].split.find { |s| s =~ /^-lruby/ }).sub(/^-l/,'') # match the full shared library name that will be linked ruby_so = [RB_CONFIG['LIBRUBY_SO'], RB_CONFIG['LIBRUBY_SONAME'], *RB_CONFIG['LIBRUBY_ALIASES'].split].find do |soname| - soname =~ /^#{ld_ruby_lib}\./ + soname =~ /^lib#{ld_ruby_lib}\./ end # form the full path of the shared Ruby library linked ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO']) From f513534d4f1a2d1140332c783394061c7bab4f1e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 19:53:53 +0100 Subject: [PATCH 118/168] temporarily restrict to a single platform --- .cirrus.yml | 332 ++++++++++++++++++++++++++-------------------------- 1 file changed, 166 insertions(+), 166 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ddefd44e..88b4f09e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -106,84 +106,84 @@ verify_task: release_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: - - name: Cirrus CI / Fedora AMD64 Release - container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / Fedora ARM64 Release - arm_container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 Release - container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 Release - arm_container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 Release - container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Ubuntu ARM64 Release - arm_container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Debian AMD64 Release - container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / Debian ARM64 Release - arm_container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / MacOSX Monterey M1 Release - macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true - - name: Cirrus CI / MacOSX Ventura M1 Release - macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true +# - name: Cirrus CI / Fedora AMD64 Release +# container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / Fedora ARM64 Release +# arm_container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / OpenSuSE Leap AMD64 Release +# container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / OpenSuSE Leap ARM64 Release +# arm_container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / Ubuntu AMD64 Release +# container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Ubuntu ARM64 Release +# arm_container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Debian AMD64 Release +# container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / Debian ARM64 Release +# arm_container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / MacOSX Monterey M1 Release +# macos_instance: +# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true +# - name: Cirrus CI / MacOSX Ventura M1 Release +# macos_instance: +# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true - name: Cirrus CI / MacOSX Sonoma M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest @@ -222,96 +222,96 @@ release_task: test_release_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' depends_on: - - Cirrus CI / Fedora AMD64 Release - - Cirrus CI / OpenSuSE Leap AMD64 Release - - Cirrus CI / Ubuntu AMD64 Release - - Cirrus CI / Debian AMD64 Release - - Cirrus CI / Fedora ARM64 Release - - Cirrus CI / OpenSuSE Leap ARM64 Release - - Cirrus CI / Ubuntu ARM64 Release - - Cirrus CI / Debian ARM64 Release - - Cirrus CI / MacOSX Monterey M1 Release - - Cirrus CI / MacOSX Ventura M1 Release +# - Cirrus CI / Fedora AMD64 Release +# - Cirrus CI / OpenSuSE Leap AMD64 Release +# - Cirrus CI / Ubuntu AMD64 Release +# - Cirrus CI / Debian AMD64 Release +# - Cirrus CI / Fedora ARM64 Release +# - Cirrus CI / OpenSuSE Leap ARM64 Release +# - Cirrus CI / Ubuntu ARM64 Release +# - Cirrus CI / Debian ARM64 Release +# - Cirrus CI / MacOSX Monterey M1 Release +# - Cirrus CI / MacOSX Ventura M1 Release - Cirrus CI / MacOSX Sonoma M1 Release matrix: - - name: Cirrus CI / Fedora AMD64 Release Test - container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / Fedora ARM64 Release Test - arm_container: - image: fedora:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: fedora - - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test - container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / OpenSuSE Leap ARM64 Release Test - arm_container: - image: opensuse/leap:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: opensuse - - name: Cirrus CI / Ubuntu AMD64 Release Test - container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Ubuntu ARM64 Release Test - arm_container: - image: ubuntu:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: ubuntu - - name: Cirrus CI / Debian AMD64 Release Test - container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / Debian ARM64 Release Test - arm_container: - image: debian:latest - cpu: 4 - memory: 8G - env: - osname: linux - distro: debian - - name: Cirrus CI / MacOSX Monterey M1 Release Test - macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true - - name: Cirrus CI / MacOSX Ventura M1 Release Test - macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:latest - env: - osname: darwin - distro: macosx - latest_only: true +# - name: Cirrus CI / Fedora AMD64 Release Test +# container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / Fedora ARM64 Release Test +# arm_container: +# image: fedora:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: fedora +# - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test +# container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / OpenSuSE Leap ARM64 Release Test +# arm_container: +# image: opensuse/leap:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: opensuse +# - name: Cirrus CI / Ubuntu AMD64 Release Test +# container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Ubuntu ARM64 Release Test +# arm_container: +# image: ubuntu:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: ubuntu +# - name: Cirrus CI / Debian AMD64 Release Test +# container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / Debian ARM64 Release Test +# arm_container: +# image: debian:latest +# cpu: 4 +# memory: 8G +# env: +# osname: linux +# distro: debian +# - name: Cirrus CI / MacOSX Monterey M1 Release Test +# macos_instance: +# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true +# - name: Cirrus CI / MacOSX Ventura M1 Release Test +# macos_instance: +# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest +# env: +# osname: darwin +# distro: macosx +# latest_only: true - name: Cirrus CI / MacOSX Sonoma M1 Release Test macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest From 18684ce84865db1cd7c5cc5a9826ba49037ec1da Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 15 Feb 2024 20:37:10 +0100 Subject: [PATCH 119/168] replace WXRUBY_VERSION by WXRUBY_RELEASE as the former clashes with the build scripts --- .github/workflows/release.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef69bdaa..3dbb7265 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: env: GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} outputs: - version: ${{ steps.version_var.outputs.WXRUBY_VERSION }} + version: ${{ steps.version_var.outputs.WXRUBY_RELEASE }} prerelease: ${{ steps.version_var.outputs.WXRUBY_PRERELEASE }} steps: - name: Checkout wxRuby3 @@ -88,7 +88,7 @@ jobs: if: github.event_name != 'workflow_dispatch' id: version_var run: | - echo "WXRUBY_VERSION=${GITHUB_REF_NAME/#v/}" >> "$GITHUB_OUTPUT" + echo "WXRUBY_RELEASE=${GITHUB_REF_NAME/#v/}" >> "$GITHUB_OUTPUT" if grep -q "\-[a-zA-Z]" <<< "$GITHUB_REF_NAME" ; then echo "WXRUBY_PRERELEASE=1" >> "$GITHUB_OUTPUT" else @@ -321,7 +321,7 @@ jobs: WX_EXTRA_PACKAGES: doxygen patchelf CC: ${{ matrix.CC }} CXX: ${{ matrix.CXX }} - WXRUBY_VERSION: ${{ needs.release-gem.outputs.version }} + WXRUBY_RELEASE: ${{ needs.release-gem.outputs.version }} WXRUBY_PRERELEASE: ${{ needs.release-gem.outputs.prerelease }} steps: - name: Install Ruby @@ -379,9 +379,9 @@ jobs: if: ${{ !matrix.build && github.event_name != 'workflow_dispatch' }} run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then - gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=only + gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=only else - gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=only + gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=only fi - name: Install wxRuby3 gem with local build @@ -389,15 +389,15 @@ jobs: run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi else if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_VERSION -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall fi fi @@ -452,7 +452,7 @@ jobs: runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby Gem Test (${{ github.ref_name }}) env: - WXRUBY_VERSION: ${{ needs.release-gem.outputs.version }} + WXRUBY_RELEASE: ${{ needs.release-gem.outputs.version }} WXRUBY_PRERELEASE: ${{ needs.release-gem.outputs.prerelease }} strategy: fail-fast: false @@ -483,20 +483,20 @@ jobs: if: ${{ !matrix.build && github.event_name != 'workflow_dispatch' }} run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=only + gem install wxruby3 -v $env:WXRUBY_RELEASE --pre -- prebuilt=only } Else { - gem install wxruby3 -v $env:WXRUBY_VERSION -- prebuilt=only + gem install wxruby3 -v $env:WXRUBY_RELEASE -- prebuilt=only } - name: Install wxRuby3 gem with local build if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_VERSION --pre -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --autoinstall } Else { - gem install wxruby3 -v $env:WXRUBY_VERSION -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_RELEASE -- prebuilt=none && wxruby setup --autoinstall } - name: Download release test gem artifact From df55a3009432744d3d129db701e8554e44e7327d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 10:31:52 +0100 Subject: [PATCH 120/168] fix windows binpkg install; improve URI handling --- ext/mkrf_conf_ext.rb | 3 ++- rakelib/gem.rb | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index 8d9aed55..74a9a161 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -47,7 +47,8 @@ end if OPTIONS[:package] task_args << ', ' unless task_args.empty? - task_args << "'--package', " << "'#{OPTIONS[:package]}'" + pkg = RUBY_PLATFORM =~ /mingw/ ? pkg.gsub('\\', '/') : pkg # make sure the path is URI compatible + task_args << "'--package', " << "'#{pkg}'" end # generate new rakefile with appropriate default task (calls actual task in rakelib) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 9c237111..35aee333 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -180,15 +180,20 @@ def pack_file(os, path) def install_gem(prebuilt_only: false, package: nil) # check if a user specified binary package is to be used if package - uri = URI(package) - if uri.scheme == 'file' || uri.scheme.nil? - if File.file?(uri.path) - $stdout.puts "Installing user package #{uri.path}..." - exit(1) unless install_bin_pkg(uri.path) + uri = File.file?(package) ? nil : URI(package) + if uri.nil? || uri.scheme == 'file' + filename = package + if uri + filename = uri.host ? "#{uri.host}:#{uri.path}" : uri.path + filename = nil unless File.file?(filename) + end + if filename + $stdout.puts "Installing user package #{filename}..." + exit(1) unless install_bin_pkg(filename) $stdout.puts 'Done!' true else - $stderr.puts "ERROR: Cannot access file #{uri.path}. Reverting to source install." + $stderr.puts "ERROR: Cannot access file #{package}." exit(1) end elsif uri.scheme == 'http' || uri.scheme == 'https' From 36f11aa1ee04d49de3e77af0043f053a62031af6 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 12:38:01 +0100 Subject: [PATCH 121/168] fix typos --- ext/mkrf_conf_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mkrf_conf_ext.rb b/ext/mkrf_conf_ext.rb index 74a9a161..ffe87aea 100644 --- a/ext/mkrf_conf_ext.rb +++ b/ext/mkrf_conf_ext.rb @@ -47,7 +47,7 @@ end if OPTIONS[:package] task_args << ', ' unless task_args.empty? - pkg = RUBY_PLATFORM =~ /mingw/ ? pkg.gsub('\\', '/') : pkg # make sure the path is URI compatible + pkg = RUBY_PLATFORM =~ /mingw/ ? OPTIONS[:package].gsub('\\', '/') : OPTIONS[:package] # make sure the path is URI compatible task_args << "'--package', " << "'#{pkg}'" end From 4e93308969d473bbee2d4e931836fac1d1b245be Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 13:44:50 +0100 Subject: [PATCH 122/168] update messages --- rakelib/gem.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index aca6454b..7971f737 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -47,7 +47,7 @@ namespace :wxruby do $ ./wxruby test - The wxRuby3 sample selector can be run by executing: + The wxRuby3 sample explorer can be run by executing: $ ./wxruby sampler @@ -108,7 +108,7 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do $ wxruby test - The wxRuby3 sample selector can be run by executing: + The wxRuby3 sample explorer can be run by executing: $ wxruby sampler From 9a034966619ca2ddaac94bdb451230f85310d8a0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 14:05:20 +0100 Subject: [PATCH 123/168] add missing 'git' key --- rakelib/lib/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 3fd9a7d1..3994117b 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -67,7 +67,7 @@ module WXRuby3 'sodir' => '$siterubyverarch', } - CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen}) + CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen git}) CONFIG.merge!({ 'wxwin' => ENV['WXWIN'] || '', 'wxxml' => ENV['WXXML'] || '', From 26f0f7ab9932adbe5d0c5fa7dad500bdc5c8cbe3 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 14:06:05 +0100 Subject: [PATCH 124/168] add essential build config to bin pkg --- rakelib/gem.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 35aee333..4a5f2fa0 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -122,8 +122,9 @@ def build_bin_pkg fname = bin_pkg_file - # package registry + # package registry and essential config registry = [] + config = %w{wxwin wxxml wxwininstdir with-wxwin}.reduce({}) { |h, k| h[k] = WXRuby3.config.get_config(k); h } # package temp deflate stream deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true) begin @@ -131,17 +132,27 @@ def build_bin_pkg bin_pkg_manifest.each do |path| registry << pack_file(deflate_stream, path) end - # convert registry to deflated json string + # convert registry and config to deflated json string registry_json_z = Zlib::Deflate.deflate(registry.to_json) + config_json_z = Zlib::Deflate.deflate(config.to_json) + # create final package archive deflate_stream.rewind digest = Digest::SHA256.new File.open(fname, 'w', binmode: true) do |fout| + # pack config + data = [config_json_z.size].pack('Q') + digest << data + fout.write(data) + digest << config_json_z + fout.write(config_json_z) + # pack registry data = [registry_json_z.size].pack('Q') digest << data fout.write(data) digest << registry_json_z fout.write(registry_json_z) + # pack files registry.each do |entry| if entry[2] > 0 data = deflate_stream.read(entry[2]) @@ -283,6 +294,10 @@ def install_bin_pkg(fname) return false end fin.rewind + # get packed config size + config_size = fin.read(8).unpack('Q').shift + # unpack config + config = JSON.parse!(Zlib::Inflate.inflate(fin.read(config_size))) # get packed registry size registry_size = fin.read(8).unpack('Q').shift # unpack registry @@ -302,6 +317,8 @@ def install_bin_pkg(fname) end end end + # merge config + config.each_pair { |k,v| WXRuby3.config.set_config(k, v) } true end private :install_bin_pkg From 66347aa78567b8d3c1579e4d166a944e71c32db2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 14:37:26 +0100 Subject: [PATCH 125/168] minimize essential build config for bin pkg --- rakelib/gem.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 4a5f2fa0..79c44204 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -124,7 +124,7 @@ def build_bin_pkg # package registry and essential config registry = [] - config = %w{wxwin wxxml wxwininstdir with-wxwin}.reduce({}) { |h, k| h[k] = WXRuby3.config.get_config(k); h } + config = %w{wxwininstdir with-wxwin}.reduce({}) { |h, k| h[k] = WXRuby3.config.get_config(k); h } # package temp deflate stream deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true) begin From b88d17e7d2413114f0fd7f3dbe38ad0a991f3fa9 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 15:08:14 +0100 Subject: [PATCH 126/168] provide option to force using system installed wxw only --- lib/wx/wxruby/cmd/setup.rb | 5 +- rakelib/configure.rb | 112 ++++++++++++++++++++----------------- rakelib/lib/config.rb | 13 ++++- 3 files changed, 75 insertions(+), 55 deletions(-) diff --git a/lib/wx/wxruby/cmd/setup.rb b/lib/wx/wxruby/cmd/setup.rb index d5201ead..44523c5a 100644 --- a/lib/wx/wxruby/cmd/setup.rb +++ b/lib/wx/wxruby/cmd/setup.rb @@ -26,7 +26,10 @@ def self.parse_args(args) opts.banner = "#{DESC}\n\nUsage: wxruby setup -h|--help OR wxruby setup [options]\n\n" opts.separator '' opts.on('--wxwin=path', - "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| Setup.options['wxwin'] = File.expand_path(v)} + "the installation root for the wxWidgets libraries and headers if not using the system default", + "(use '@system' to force using system default only)") do |v| + Setup.options['wxwin'] = (v.downcase == '@system') ? v : File.expand_path(v) + end opts.on('--wxxml=path', "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| Setup.options['wxxml'] = File.expand_path(v)} opts.on('--with-wxwin', diff --git a/rakelib/configure.rb b/rakelib/configure.rb index 3151a6cf..8198f2aa 100644 --- a/rakelib/configure.rb +++ b/rakelib/configure.rb @@ -57,13 +57,26 @@ def self.define(task, args) opts.on('--sodir=path', "the directory for ruby extensions [#{get_config('sodir')}]") {|v| CONFIG['sodir'] = v} opts.on('--wxwin=path', - "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| CONFIG['wxwin'] = File.expand_path(v)} + "the installation root for the wxWidgets libraries and headers if not using the system default", + "(use '@system' to force using system default only)") { |v| + if v.downcase == '@system' + CONFIG[WXW_SYS_KEY] = true + CONFIG['wxwin'] = nil + CONFIG['with-wxwin'] = false + else + CONFIG['wxwin'] = File.expand_path(v) + CONFIG[WXW_SYS_KEY] = false + end + } opts.on('--wxxml=path', "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| CONFIG['wxxml'] = File.expand_path(v)} opts.on('--wxwininstdir=path', - "the directory where the wxWidgets dlls are to be installed for wxRuby [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v} + "the directory where the wxWidgets dlls are installed (do not change if not absolutely needed) [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v} opts.on('--with-wxwin', - "build a local copy of wxWidgets for use with wxRuby [false]") {|v| CONFIG['with-wxwin'] = true} + "build a local copy of wxWidgets for use with wxRuby [false]") { |v| + CONFIG['with-wxwin'] = true + CONFIG[WXW_SYS_KEY] = false + } opts.on('--with-debug', "build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true} opts.on('--swig=path', @@ -84,69 +97,64 @@ def self.define(task, args) def self.check instance.init # re-initialize - if Dir[File.join('ext', 'wxruby_*.so')].empty? # Don't check for wxWidgets installation when executed for binary gem install + # should we try to use a system or user defined wxWidgets installation? + if !get_config('with-wxwin') - if !get_config('with-wxwin') - # check if a user defined wxWidgets location is specified or we're using a system standard install - if get_cfg_string('wxwin').empty? - # assume system standard install; will be checked below - set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty? - elsif get_cfg_string('wxwininstdir').empty? - if instance.windows? - set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin')) - else - set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib')) - end - end - elsif !get_cfg_string('wxwin').empty? - if get_cfg_string('wxwininstdir').empty? - if instance.windows? - set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin')) - else - set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib')) - end + # check if a user defined wxWidgets location is specified or should be using a system standard install + if get_cfg_string('wxwin').empty? + # assume/force system standard install; will be checked below + set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty? + elsif get_cfg_string('wxwininstdir').empty? # if not explicitly specified derive from 'wxwin' + if instance.windows? + set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin')) + else + set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib')) end - else - set_config('wxwininstdir', get_cfg_string('sodir')) if get_cfg_string('wxwininstdir').empty? end - if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin') - # check wxWidgets availability through 'wx-config' command - if instance.check_wx_config - if instance.wx_config("--version") < '3.2.0' - if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? - # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves - set_config('with-wxwin', true) - else - # if someone wants to customize they HAVE to do it right - STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release." - exit(1) - end - end - else - if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? - # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves + # or should we use an embedded (automatically built) wxWidgets installation + else + + set_config('wxwininstdir', instance.ext_dir) + + end + + if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin') + # check wxWidgets availability through 'wx-config' command + if instance.check_wx_config + if instance.wx_config("--version") < '3.2.0' + if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY) + # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves set_config('with-wxwin', true) else # if someone wants to customize they HAVE to do it right - STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release." + STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release." exit(1) end end - # else we're are assumed to build wxWidgets ourselves so cannot test anything yet - end - - if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty? - # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this - xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml') - # if not there see if the standard setup 'wxw_root/' was used - xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path) - if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty? - set_config('wxxml', xml_path) + else + if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY) + # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves + set_config('with-wxwin', true) + else + # if someone wants to customize they HAVE to do it right + STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release." + exit(1) end end + # else we're assumed to build wxWidgets ourselves so cannot test anything yet + end + if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty? + # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this + xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml') + # if not there see if the standard setup 'wxw_root/' was used + xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path) + if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty? + set_config('wxxml', xml_path) + end end + end end diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 3994117b..75da0e85 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -68,6 +68,7 @@ module WXRuby3 } CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen git}) + WXW_SYS_KEY = 'with-system-wxwin' CONFIG.merge!({ 'wxwin' => ENV['WXWIN'] || '', 'wxxml' => ENV['WXXML'] || '', @@ -504,15 +505,23 @@ def build_cfg end def save + cfg = WXRuby3::CONFIG.dup + wxw_system = !!cfg.delete(WXW_SYS_KEY) + cfg['wxwin'] = '@system' if wxw_system File.open(build_cfg, 'w') do |f| - f << JSON.pretty_generate(WXRuby3::CONFIG) + f << JSON.pretty_generate(cfg) end end def load if File.file?(build_cfg) File.open(build_cfg, 'r') do |f| - WXRuby3::CONFIG.merge!(JSON.load(f.read)) + cfg = JSON.load(f.read) + if cfg['wxwin'] == '@system' + cfg[WXW_SYS_KEY] = true + cfg.delete('wxwin') + end + WXRuby3::CONFIG.merge!(cfg) end end end From 7ebe9b6f24a11fc504b1cc0a21545965f946606a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 15:10:55 +0100 Subject: [PATCH 127/168] use (and force) system installed wxw --- .github/workflows/release.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dbb7265..5e0b1c31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -285,7 +285,7 @@ jobs: configure_flags: use_xvfb: true build: true - wxw_type: develop + wxw_type: system - name: Ubuntu2204 os: ubuntu-22.04 gtk_version: 3 @@ -313,7 +313,6 @@ jobs: 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 }} @@ -360,7 +359,7 @@ jobs: if [ -n "${{ matrix.gtk_version }}" ]; then wxCONFIGURE_OPTIONS="--with-gtk=${{ matrix.gtk_version }} $wxCONFIGURE_OPTIONS" fi - ./configure $wxCONFIGURE_OPTIONS --prefix=$WXWIN_INSTALL --disable-tests --without-subdirs --disable-debug_info || rc=$? + ./configure $wxCONFIGURE_OPTIONS --disable-tests --without-subdirs --disable-debug_info || rc=$? if [ -n "$rc" ]; then echo '*** Configuring failed, contents of config.log follows: ***' echo '-----------------------------------------------------------' @@ -373,7 +372,7 @@ jobs: if: ${{ matrix.build && matrix.wxw_type != 'embed' }} working-directory: ${{ env.WXWIDGETS_ROOT }} run: | - make && make install + sudo make install && sudo ldconfig - name: Install wxRuby3 gem with binary package if: ${{ !matrix.build && github.event_name != 'workflow_dispatch' }} @@ -391,13 +390,13 @@ jobs: if [ "${{ matrix.wxw_type }}" == "embed" ]; then gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall fi else if [ "${{ matrix.wxw_type }}" == "embed" ]; then gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --autoinstall else - gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall fi fi @@ -424,7 +423,7 @@ jobs: if [ "${{ matrix.wxw_type }}" == "embed" ]; then gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall else - gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL --autoinstall + gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall fi - name: Run wxRuby3 regression tests (XVFB) From 7cd3de5b9b9d6a9f24201a462370c7ea77c22f96 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 16:05:48 +0100 Subject: [PATCH 128/168] fix operation scope --- rakelib/gem.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 79c44204..5a456876 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -316,9 +316,9 @@ def install_bin_pkg(fname) File.chmod(mode, path) end end + # merge config + config.each_pair { |k,v| WXRuby3.config.set_config(k, v) } end - # merge config - config.each_pair { |k,v| WXRuby3.config.set_config(k, v) } true end private :install_bin_pkg From d68e2fa314cbbe5ffd7a763c7261adbe0b18300b Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 17:04:50 +0100 Subject: [PATCH 129/168] add Cirrus CI release task trigger --- .github/workflows/release.yml | 6 ++++ tools/scripts/cirrus/start_release_tasks.rb | 40 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tools/scripts/cirrus/start_release_tasks.rb diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e0b1c31..43dff360 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,7 @@ jobs: name: ${{ matrix.os }} wxRuby Release (${{ github.ref_name }}) env: GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + CIRRUS_TOKEN: ${{ secrets.CIRRUS_TOKEN }} outputs: version: ${{ steps.version_var.outputs.WXRUBY_RELEASE }} prerelease: ${{ steps.version_var.outputs.WXRUBY_PRERELEASE }} @@ -77,6 +78,11 @@ jobs: run: | gem push pkg/*.gem + - name: Trigger Cirrus CI Release Tasks + if: github.event_name != 'workflow_dispatch' + run: | + ruby tools/scripts/cirrus/start_release_tasks.rb + - name: Upload Gem as release test artifact if: github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 diff --git a/tools/scripts/cirrus/start_release_tasks.rb b/tools/scripts/cirrus/start_release_tasks.rb new file mode 100644 index 00000000..e2e4233b --- /dev/null +++ b/tools/scripts/cirrus/start_release_tasks.rb @@ -0,0 +1,40 @@ + +require 'uri' +require 'net/https' +require 'json' + +$CIRRUS_TOKEN = ENV['CIRRUS_TOKEN'] || '' + +$cirrus_uri = URI('https://api.cirrus-ci.com/graphql') + +$query = %q[{ ownerRepository(platform: "github", owner: "mcorino", name: "wxRuby3") { id } }] + +$headers = { + 'Authorization' => "Bearer #{$CIRRUS_TOKEN}", + 'Content-Type' => 'application/json' +} +$response = Net::HTTP.post($cirrus_uri, { query: $query }.to_json, $headers) + +if Net::HTTPOK === $response + $repository_id = JSON.parse($response.body)['data']['ownerRepository']['id'] + + $mutation = %Q[mutation StartReleaseBuild( $input: RepositoryCreateBuildInput! ) { createBuild(input: $input) { build { id } } }] + vars = { + input: { + repositoryId: "#{$repository_id}", + branch: "bin-packages", + clientMutationId: "wxRuby3" + } + } + $response = Net::HTTP.post($cirrus_uri, { query: $mutation, variables: vars }.to_json, $headers) + if Net::HTTPOK === $response + $build_id = JSON.parse($response.body)['data']['createBuild']['build']['id'] + puts "Started release build [#{$build_id}]" + else + $stderr.puts "Failed to start release build." + exit(1) + end +else + $stderr.puts "Failed to retrieve repository id." + exit(1) +end From 4bd7e53682f7f9c7c21f325c544d9b1cc11af10e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 17:23:41 +0100 Subject: [PATCH 130/168] update for binpkg install option instead of bingem --- .github/workflows/linux.yml | 29 ++++++++++------------------- .github/workflows/mac.yml | 23 +++++++++++------------ .github/workflows/msw.yml | 13 ++++++++----- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 82e5abf2..b45b19d8 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -134,7 +134,7 @@ jobs: configure_flags: use_xvfb: true wxw_type: embed - wxr_type: bingem + wxr_type: binpkg runs-on: ${{ matrix.os }} name: ${{ matrix.os }} wxRuby(${{ matrix.wxr_type }}) ${{ matrix.CXX }} ruby-${{ matrix.ruby }} wxWidgets-${{ matrix.wxWidgets }}(${{ matrix.wxw_type }}) SWIG${{ matrix.swig }} env: @@ -254,34 +254,25 @@ jobs: ruby tools/check_swig_types.rb - name: Build wxRuby3 gem - if: matrix.wxr_type == 'gem' || matrix.wxr_type == 'bingem' + if: matrix.wxr_type == 'gem' || matrix.wxr_type == 'binpkg' run: | - if [ "${{ matrix.wxr_type }}" == "gem" ]; then - bundle exec rake gem - else - BUILD_CMD="bundle exec rake bingem" - /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 + bundle exec rake gem + if [ "${{ matrix.wxr_type }}" == "binpkg" ]; then + bundle exec rake binpkg fi - name: Install wxRuby3 gem if: matrix.wxr_type != 'develop' run: | - if [ "${{ matrix.wxr_type }}" == "bingem" ]; then - gem install $(echo pkg/*.gem) + if [ "${{ matrix.wxr_type }}" == "binpkg" ]; then + gem install $(echo pkg/*.gem) -- package=`pwd`/$(echo pkg/*.pkg) else if [ "${{ matrix.wxw_type }}" == "system" ]; then - gem install $(echo pkg/*.gem) && wxruby setup + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup -- --wxwin=@system elif [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install $(echo pkg/*.gem) && wxruby setup --autoinstall + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup --autoinstall else - gem install $(echo pkg/*.gem) && wxruby setup --wxwin=$WXWIN_INSTALL + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL fi fi diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index fe404436..4196f663 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -86,7 +86,7 @@ jobs: swig: '4' configure_flags: --disable-sys-libs wxw_type: embed - wxr_type: bingem + wxr_type: binpkg - name: wxMac macOS 13 runner: macos-13 arch: x86_64 @@ -295,30 +295,29 @@ jobs: ruby tools/check_swig_types.rb - name: Build wxRuby3 gem - if: matrix.wxr_type == 'gem' || matrix.wxr_type == 'bingem' + if: matrix.wxr_type == 'gem' || matrix.wxr_type == 'binpkg' run: | - if [ "${{ matrix.wxr_type }}" == "gem" ]; then - bundle exec rake gem - else - bundle exec rake bingem + bundle exec rake gem + if [ "${{ matrix.wxr_type }}" == "binpkg" ]; then + bundle exec rake binpkg fi - name: Remove wxWidgets - if: matrix.wxw_type == 'develop' && matrix.wxr_type == 'bingem' + if: matrix.wxw_type == 'develop' && matrix.wxr_type == 'binpkg' run: rm -rf $WXWIDGETS_ROOT - name: Install wxRuby3 gem if: matrix.wxr_type != 'develop' run: | - if [ "${{ matrix.wxr_type }}" == "bingem" ]; then - gem install $(echo pkg/*.gem) + if [ "${{ matrix.wxr_type }}" == "binpkg" ]; then + gem install $(echo pkg/*.gem) -- package=`pwd`/$(echo pkg/*.pkg) else if [ "${{ matrix.wxw_type }}" == "system" ]; then - gem install $(echo pkg/*.gem) && wxruby setup + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup --wxwin=@system elif [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install $(echo pkg/*.gem) && wxruby setup --autoinstall + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup --autoinstall else - gem install $(echo pkg/*.gem) && wxruby setup --wxwin=$WXWIN_INSTALL + gem install $(echo pkg/*.gem) -- prebuilt=none && wxruby setup --wxwin=$WXWIN_INSTALL fi fi diff --git a/.github/workflows/msw.yml b/.github/workflows/msw.yml index ab6100da..149a7d88 100644 --- a/.github/workflows/msw.yml +++ b/.github/workflows/msw.yml @@ -83,7 +83,7 @@ jobs: wxWidgets: '3.2.4' swig: '4' wxw_type: embed - wxr_type: bingem + wxr_type: binpkg - os: windows-2022 platform: 'x64' CXX: g++-12 @@ -189,21 +189,24 @@ jobs: - name: Build wxRuby3 gem if: matrix.wxr_type != 'develop' run: | - bundle exec rake ${{ matrix.wxr_type }} + bundle exec rake gem + If ("${{ matrix.wxr_type }}" -eq "binpkg") { + bundle exec rake binpkg + } - name: Install wxRuby3 gem if: matrix.wxr_type != 'develop' run: | If ("${{ matrix.wxw_type }}" -eq "embed") { If ("${{ matrix.wxr_type }}" -eq "gem") { - foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f && wxruby setup --autoinstall } + foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } } Else { - foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f } + foreach ($f in Get-ChildItem -Path pkg\*.gem) { foreach ($p in Get-ChildItem -Path pkg\*.pkg) { gem install $f -- package=$p } } } } Else { - foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f && wxruby setup --wxwin=$env:WXWIN_ROOT } + foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f --prebuilt=none && wxruby setup --wxwin=$env:WXWIN_ROOT } } - name: Run wxRuby3 regression tests From 76d1317f051eaf906fae14ef994af74502b3066d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 16 Feb 2024 18:32:20 +0100 Subject: [PATCH 131/168] fix typo --- .github/workflows/msw.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msw.yml b/.github/workflows/msw.yml index 149a7d88..96e1c872 100644 --- a/.github/workflows/msw.yml +++ b/.github/workflows/msw.yml @@ -206,7 +206,7 @@ jobs: } } Else { - foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f --prebuilt=none && wxruby setup --wxwin=$env:WXWIN_ROOT } + foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f -- prebuilt=none && wxruby setup --wxwin=$env:WXWIN_ROOT } } - name: Run wxRuby3 regression tests From 338d686b241862b312d58111c983531e515c2c0a Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 09:45:16 +0100 Subject: [PATCH 132/168] wxw 3.3 compat fix --- rakelib/lib/director/aui_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/director/aui_manager.rb b/rakelib/lib/director/aui_manager.rb index 0d9d395f..008bda8e 100644 --- a/rakelib/lib/director/aui_manager.rb +++ b/rakelib/lib/director/aui_manager.rb @@ -53,7 +53,7 @@ class WXRubyAuiManager : public wxAuiManager m_actionWindow = NULL; m_hoverButton = NULL; m_art = new wxAuiDefaultDockArt; - m_hintWnd = NULL; + #{Config.instance.wx_version < '3.3.0' ? 'm_hintWnd = NULL;' : ''} m_flags = wxAUI_MGR_DEFAULT; m_hasMaximized = false; m_dockConstraintX = 0.3; From 66a4392e4622962c66405c5d43bdf84daf7c6269 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 09:47:14 +0100 Subject: [PATCH 133/168] do not encode kernel version in pkg name for darwin --- rakelib/gem.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rakelib/gem.rb b/rakelib/gem.rb index 5a456876..a17a078f 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -107,7 +107,13 @@ def make_bin_name def bin_pkg_name gemspec = ::Gem::Specification.new(make_bin_name, WXRuby3::WXRUBY_VERSION) - gemspec.platform = ::Gem::Platform.local.to_s + platform = ::Gem::Platform.new(RB_CONFIG["arch"]) + if platform.os == 'darwin' + # loose the version for darwin kernels as that does not seem to affect wxRuby runtime compatibility + # (until proven otherwise) + platform.version = nil + end + gemspec.platform = platform.to_s gemspec.full_name end private :bin_pkg_name From c781ebd9c39700e25ce420329ca8156943162115 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 09:48:38 +0100 Subject: [PATCH 134/168] temp test --- tools/scripts/cirrus/start_release_tasks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/start_release_tasks.rb b/tools/scripts/cirrus/start_release_tasks.rb index e2e4233b..a9e96500 100644 --- a/tools/scripts/cirrus/start_release_tasks.rb +++ b/tools/scripts/cirrus/start_release_tasks.rb @@ -22,7 +22,7 @@ vars = { input: { repositoryId: "#{$repository_id}", - branch: "bin-packages", + branch: "v0.9.7", clientMutationId: "wxRuby3" } } From 315f326eae4aa2949833b9bb2e37a72d7937a7e4 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 09:50:51 +0100 Subject: [PATCH 135/168] trigger cirrus always --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43dff360..b87e04b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,7 +79,6 @@ jobs: gem push pkg/*.gem - name: Trigger Cirrus CI Release Tasks - if: github.event_name != 'workflow_dispatch' run: | ruby tools/scripts/cirrus/start_release_tasks.rb From b2732bb2c4a41a18e0459df7c6dbfcfba34eecb0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 10:10:09 +0100 Subject: [PATCH 136/168] trigger cirrus with proper branch info --- .github/workflows/release.yml | 6 +++++- tools/scripts/cirrus/start_release_tasks.rb | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b87e04b6..7095c301 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,11 @@ jobs: - name: Trigger Cirrus CI Release Tasks run: | - ruby tools/scripts/cirrus/start_release_tasks.rb + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + ruby tools/scripts/cirrus/start_release_tasks.rb ${{ github.ref }} + else + ruby tools/scripts/cirrus/start_release_tasks.rb + fi - name: Upload Gem as release test artifact if: github.event_name == 'workflow_dispatch' diff --git a/tools/scripts/cirrus/start_release_tasks.rb b/tools/scripts/cirrus/start_release_tasks.rb index a9e96500..202ece23 100644 --- a/tools/scripts/cirrus/start_release_tasks.rb +++ b/tools/scripts/cirrus/start_release_tasks.rb @@ -5,6 +5,10 @@ $CIRRUS_TOKEN = ENV['CIRRUS_TOKEN'] || '' +# for an actual release we can just run the Cirrus tasks off the master branch since +# the release tag has just be created against that +$branch = ARGV.empty? ? 'master' : ARGV[0] + $cirrus_uri = URI('https://api.cirrus-ci.com/graphql') $query = %q[{ ownerRepository(platform: "github", owner: "mcorino", name: "wxRuby3") { id } }] @@ -22,14 +26,19 @@ vars = { input: { repositoryId: "#{$repository_id}", - branch: "v0.9.7", + branch: $branch, clientMutationId: "wxRuby3" } } $response = Net::HTTP.post($cirrus_uri, { query: $mutation, variables: vars }.to_json, $headers) if Net::HTTPOK === $response - $build_id = JSON.parse($response.body)['data']['createBuild']['build']['id'] - puts "Started release build [#{$build_id}]" + response_data = JSON.parse($response.body) + if response_data['errors'] + $stderr.puts "Error starting release build: #{response_data['errors'].collect { |err| err['message'] }.join(',')}" + else + $build_id = response_data['data']['createBuild']['build']['id'] + puts "Started release build [#{$build_id}]" + end else $stderr.puts "Failed to start release build." exit(1) From 29a2901cdcb6fc31b41982dc88026b6becacf7eb Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 10:18:23 +0100 Subject: [PATCH 137/168] get branch from github ref --- tools/scripts/cirrus/start_release_tasks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/cirrus/start_release_tasks.rb b/tools/scripts/cirrus/start_release_tasks.rb index 202ece23..dafa9a76 100644 --- a/tools/scripts/cirrus/start_release_tasks.rb +++ b/tools/scripts/cirrus/start_release_tasks.rb @@ -7,7 +7,7 @@ # for an actual release we can just run the Cirrus tasks off the master branch since # the release tag has just be created against that -$branch = ARGV.empty? ? 'master' : ARGV[0] +$branch = ARGV.empty? ? 'master' : ARGV[0].split('/').last $cirrus_uri = URI('https://api.cirrus-ci.com/graphql') From df1012d8c9d6a9a04f8fb2599ab9b491d2bdc995 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 17 Feb 2024 11:44:56 +0100 Subject: [PATCH 138/168] re-enable matrices --- .cirrus.yml | 332 ++++++++++++++++++++++++++-------------------------- 1 file changed, 166 insertions(+), 166 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 88b4f09e..ddefd44e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -106,84 +106,84 @@ verify_task: release_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' matrix: -# - name: Cirrus CI / Fedora AMD64 Release -# container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / Fedora ARM64 Release -# arm_container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / OpenSuSE Leap AMD64 Release -# container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / OpenSuSE Leap ARM64 Release -# arm_container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / Ubuntu AMD64 Release -# container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Ubuntu ARM64 Release -# arm_container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Debian AMD64 Release -# container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / Debian ARM64 Release -# arm_container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / MacOSX Monterey M1 Release -# macos_instance: -# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true -# - name: Cirrus CI / MacOSX Ventura M1 Release -# macos_instance: -# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true + - name: Cirrus CI / Fedora AMD64 Release + container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / Fedora ARM64 Release + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / OpenSuSE Leap AMD64 Release + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 Release + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / Ubuntu AMD64 Release + container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 Release + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Debian AMD64 Release + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / Debian ARM64 Release + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / MacOSX Monterey M1 Release + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true + - name: Cirrus CI / MacOSX Ventura M1 Release + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true - name: Cirrus CI / MacOSX Sonoma M1 Release macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest @@ -222,96 +222,96 @@ release_task: test_release_task: only_if: $CIRRUS_BUILD_SOURCE == 'api' depends_on: -# - Cirrus CI / Fedora AMD64 Release -# - Cirrus CI / OpenSuSE Leap AMD64 Release -# - Cirrus CI / Ubuntu AMD64 Release -# - Cirrus CI / Debian AMD64 Release -# - Cirrus CI / Fedora ARM64 Release -# - Cirrus CI / OpenSuSE Leap ARM64 Release -# - Cirrus CI / Ubuntu ARM64 Release -# - Cirrus CI / Debian ARM64 Release -# - Cirrus CI / MacOSX Monterey M1 Release -# - Cirrus CI / MacOSX Ventura M1 Release + - Cirrus CI / Fedora AMD64 Release + - Cirrus CI / OpenSuSE Leap AMD64 Release + - Cirrus CI / Ubuntu AMD64 Release + - Cirrus CI / Debian AMD64 Release + - Cirrus CI / Fedora ARM64 Release + - Cirrus CI / OpenSuSE Leap ARM64 Release + - Cirrus CI / Ubuntu ARM64 Release + - Cirrus CI / Debian ARM64 Release + - Cirrus CI / MacOSX Monterey M1 Release + - Cirrus CI / MacOSX Ventura M1 Release - Cirrus CI / MacOSX Sonoma M1 Release matrix: -# - name: Cirrus CI / Fedora AMD64 Release Test -# container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / Fedora ARM64 Release Test -# arm_container: -# image: fedora:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: fedora -# - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test -# container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / OpenSuSE Leap ARM64 Release Test -# arm_container: -# image: opensuse/leap:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: opensuse -# - name: Cirrus CI / Ubuntu AMD64 Release Test -# container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Ubuntu ARM64 Release Test -# arm_container: -# image: ubuntu:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: ubuntu -# - name: Cirrus CI / Debian AMD64 Release Test -# container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / Debian ARM64 Release Test -# arm_container: -# image: debian:latest -# cpu: 4 -# memory: 8G -# env: -# osname: linux -# distro: debian -# - name: Cirrus CI / MacOSX Monterey M1 Release Test -# macos_instance: -# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true -# - name: Cirrus CI / MacOSX Ventura M1 Release Test -# macos_instance: -# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest -# env: -# osname: darwin -# distro: macosx -# latest_only: true + - name: Cirrus CI / Fedora AMD64 Release Test + container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / Fedora ARM64 Release Test + arm_container: + image: fedora:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: fedora + - name: Cirrus CI / OpenSuSE Leap AMD64 Release Test + container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / OpenSuSE Leap ARM64 Release Test + arm_container: + image: opensuse/leap:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: opensuse + - name: Cirrus CI / Ubuntu AMD64 Release Test + container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Ubuntu ARM64 Release Test + arm_container: + image: ubuntu:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: ubuntu + - name: Cirrus CI / Debian AMD64 Release Test + container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / Debian ARM64 Release Test + arm_container: + image: debian:latest + cpu: 4 + memory: 8G + env: + osname: linux + distro: debian + - name: Cirrus CI / MacOSX Monterey M1 Release Test + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true + - name: Cirrus CI / MacOSX Ventura M1 Release Test + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest + env: + osname: darwin + distro: macosx + latest_only: true - name: Cirrus CI / MacOSX Sonoma M1 Release Test macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest From ae047575ffbbcf854dfa5cc9b2081619146509ed Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sun, 18 Feb 2024 12:22:57 +0100 Subject: [PATCH 139/168] clean up --- .github/workflows/release-test.yml | 37 ------------------------------ 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml deleted file mode 100644 index c32b4207..00000000 --- a/.github/workflows/release-test.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Test workflow - -on: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: write - -jobs: - test: - runs-on: ${{ matrix.os }} - name: Ruby config test - strategy: - fail-fast: false - matrix: - include: - - name: macOS12 - os: macos-12 - arch: x86_64 - ruby: '3.3' - - name: macOS13 - os: macos-13 - arch: x86_64 - ruby: '3.3' - - steps: - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - - name: Show Ruby config - run: | - ruby -e "RbConfig::CONFIG.each_pair {|k,v| puts %Q{#{k}=#{v}} }" From 1128503ffbe41f948b7339632188fdd0b0076e62 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 20 Feb 2024 09:51:30 +0100 Subject: [PATCH 140/168] remove superfluous metadata --- rakelib/gem.rake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 7971f737..66524de2 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -87,9 +87,8 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do "'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'" gem.metadata = { "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues", - "source_code_uri" => "https://github.com/mcorino/wxRuby3", - "documentation_uri" => "https://mcorino.github.io/wxRuby3", "homepage_uri" => "https://github.com/mcorino/wxRuby3", + "documentation_uri" => "https://mcorino.github.io/wxRuby3", "github_repo" => "https://github.com/mcorino/wxRuby3" } gem.post_install_message = <<~__MSG From cd06864ac39b449310267c7fb9a5e01de3c7300f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 20 Feb 2024 09:55:57 +0100 Subject: [PATCH 141/168] cleanup; remove unlikely platform --- rakelib/lib/config.rb | 2 -- rakelib/lib/config/cygwin.rb | 9 --------- 2 files changed, 11 deletions(-) delete mode 100644 rakelib/lib/config/cygwin.rb diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 75da0e85..ba115946 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -534,8 +534,6 @@ def platform case RUBY_PLATFORM when /mingw/ :mingw - when /cygwin/ - :cygwin when /netbsd/ :netbsd when /darwin/ diff --git a/rakelib/lib/config/cygwin.rb b/rakelib/lib/config/cygwin.rb deleted file mode 100644 index ba956e6e..00000000 --- a/rakelib/lib/config/cygwin.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 buildtools configuration -### - -raise "Cygwin platform is unsupported as yet." From 7fd2027f96fe02f1c43bd0b7f245273c8fae0872 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 20 Feb 2024 09:57:14 +0100 Subject: [PATCH 142/168] replace Netbsd by Freebsd as possible future platform --- rakelib/lib/config.rb | 4 ++-- rakelib/lib/config/{netbsd.rb => freebsd.rb} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename rakelib/lib/config/{netbsd.rb => freebsd.rb} (75%) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index ba115946..c6a79d29 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -534,8 +534,8 @@ def platform case RUBY_PLATFORM when /mingw/ :mingw - when /netbsd/ - :netbsd + when /freebsd/ + :freebsd when /darwin/ :macosx when /linux/ diff --git a/rakelib/lib/config/netbsd.rb b/rakelib/lib/config/freebsd.rb similarity index 75% rename from rakelib/lib/config/netbsd.rb rename to rakelib/lib/config/freebsd.rb index 45201fc3..fc804a46 100644 --- a/rakelib/lib/config/netbsd.rb +++ b/rakelib/lib/config/freebsd.rb @@ -6,4 +6,4 @@ # wxRuby3 buildtools configuration ### -raise "NETBSD platform is unsupported as yet." +raise "Freebsd platform is unsupported as yet." From 1e44e52050d608f92bc5a103d4495e7bc1304153 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 20 Feb 2024 09:59:23 +0100 Subject: [PATCH 143/168] cleanup --- rakelib/lib/config.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index c6a79d29..09f54aa0 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -610,11 +610,6 @@ def init # Extra swig helper files to be built @helper_modules = %w|RubyStockObjects| - # if macosx? - # %w|RubyStockObjects Mac| - # else - # %w|RubyStockObjects| - # end # helper to initialize on startup (stock objects can only be initialized after App creation) @helper_inits = @helper_modules - %w|RubyStockObjects| @@ -657,7 +652,7 @@ def init @obj_ext = RB_CONFIG["OBJEXT"] @dll_ext = RB_CONFIG['DLEXT'] - # Exclude certian classes from being built, even if they are present + # Exclude certain classes from being built, even if they are present # in the configuration of wxWidgets. if ENV['WXRUBY_EXCLUDED'] ENV['WXRUBY_EXCLUDED'].split(",").each { |classname| exclude_module(classname) } @@ -721,16 +716,12 @@ def wx_abi_version @wx_abi_version || '' end - def cygwin? - @platform == :cygwin - end - def mingw? @platform == :mingw end - def netbsd? - @platform == :netbsd + def freebsd? + @platform == :freebsd end def macosx? @@ -742,7 +733,7 @@ def linux? end def windows? - mingw? || cygwin? + mingw? end def ldflags(_target) From c751efa8027624505fe064546c8316ea0d3868ef Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 20 Feb 2024 16:40:47 +0100 Subject: [PATCH 144/168] allow only a single command at a time --- lib/wx/wxruby/base.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/wx/wxruby/base.rb b/lib/wx/wxruby/base.rb index 1354cb2c..d62824d5 100644 --- a/lib/wx/wxruby/base.rb +++ b/lib/wx/wxruby/base.rb @@ -81,9 +81,7 @@ def parse_args(args) def self.run(argv = ARGV) # parse global options (upto first command) argv = WxRuby::Commands.parse_args(argv) - while !argv.empty? - WxRuby::Commands.run(argv.shift, argv) - end + WxRuby::Commands.run(argv.shift, argv) unless argv.empty? end end From cad6a3450f9549b36a7985e90802fdc9bf36d6d8 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 09:02:19 +0100 Subject: [PATCH 145/168] simplify by moving code to and reusing plat4m gem --- Gemfile | 1 + rakelib/gem.rake | 1 + rakelib/gem.rb | 12 +- rakelib/lib/config.rb | 20 +++- rakelib/lib/config/linux.rb | 2 +- rakelib/lib/config/pkgman/arch.rb | 53 --------- rakelib/lib/config/pkgman/debian.rb | 66 ----------- .../lib/config/pkgman/{base.rb => linux.rb} | 90 +++++---------- rakelib/lib/config/pkgman/macosx.rb | 103 +++--------------- rakelib/lib/config/pkgman/rhel.rb | 54 --------- rakelib/lib/config/pkgman/suse.rb | 54 --------- rakelib/lib/config/unknown.rb | 10 ++ 12 files changed, 77 insertions(+), 389 deletions(-) delete mode 100644 rakelib/lib/config/pkgman/arch.rb delete mode 100644 rakelib/lib/config/pkgman/debian.rb rename rakelib/lib/config/pkgman/{base.rb => linux.rb} (56%) delete mode 100644 rakelib/lib/config/pkgman/rhel.rb delete mode 100644 rakelib/lib/config/pkgman/suse.rb create mode 100644 rakelib/lib/config/unknown.rb diff --git a/Gemfile b/Gemfile index cf205047..e616ea46 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'rake' gem 'nokogiri', '~> 1.12' gem 'minitest', '~> 5.15' gem 'test-unit', '~> 3.5' +gem 'plat4m', '~> 1.0' group :develop, optional: true do gem 'ruby_memcheck', '~> 1.2' end diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 66524de2..11784797 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -79,6 +79,7 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do gem.add_dependency 'rake' gem.add_dependency 'minitest', '~> 5.15' gem.add_dependency 'test-unit', '~> 3.5' + gem.add_dependency 'plat4m', '~> 1.0' gem.rdoc_options << '--exclude=\\.dll' << '--exclude=\\.so' << diff --git a/rakelib/gem.rb b/rakelib/gem.rb index a17a078f..ea423d6d 100644 --- a/rakelib/gem.rb +++ b/rakelib/gem.rb @@ -93,14 +93,12 @@ def bin_pkg_manifest end def make_bin_name - if WXRuby3.config.platform == :linux - distro = Config::Platform::PkgManager.distro - "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" - elsif WXRuby3.config.platform == :macosx - distro = Config::Platform::PkgManager.distro - "wxruby3_#{distro[:distro]}_#{distro[:release] || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" + os = WXRuby3.config.sysinfo.os + case os.id + when :windows + "wxruby3_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" else - "wxruby3_#{WXRuby3.config.platform}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" + "wxruby3_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}" end end private :make_bin_name diff --git a/rakelib/lib/config.rb b/rakelib/lib/config.rb index 09f54aa0..cce3c575 100644 --- a/rakelib/lib/config.rb +++ b/rakelib/lib/config.rb @@ -11,6 +11,7 @@ require 'json' require 'open3' require 'monitor' +require 'plat4m' module FileUtils # add convenience methods @@ -555,15 +556,26 @@ def create def initialize @ruby_exe = RB_CONFIG["ruby_install_name"] - @extmk = /extmk\.rb/ =~ $0 - @platform = Config.platform - require File.join(File.dirname(__FILE__), 'config', @platform.to_s) + @sysinfo = Plat4m.current rescue nil + @platform = if @sysinfo + case @sysinfo.os.id + when :darwin + :macosx + when :windows + RUBY_PLATFORM =~ /mingw/ ? :mingw : :unknown + else + @sysinfo.os.id + end + else + :unknown + end + require_relative File.join('config', @platform.to_s) self.class.include(WXRuby3::Config::Platform) init # initialize settings end - attr_reader :ruby_exe, :extmk, :platform, :helper_modules, :helper_inits, :include_modules, :verbosity + attr_reader :ruby_exe, :sysinfo, :platform, :helper_modules, :helper_inits, :include_modules, :verbosity attr_reader :release_build, :debug_build, :verbose_debug, :no_deprecate attr_reader :ruby_cppflags, :ruby_ldflags, :ruby_libs, :extra_cflags, :extra_cppflags, :extra_ldflags, :extra_libs, :cpp_out_flag, :link_output_flag, :obj_ext, :dll_ext, diff --git a/rakelib/lib/config/linux.rb b/rakelib/lib/config/linux.rb index f53882bd..26056051 100644 --- a/rakelib/lib/config/linux.rb +++ b/rakelib/lib/config/linux.rb @@ -7,7 +7,7 @@ ### require_relative './unixish' -require_relative 'pkgman/base' +require_relative 'pkgman/linux' module WXRuby3 diff --git a/rakelib/lib/config/pkgman/arch.rb b/rakelib/lib/config/pkgman/arch.rb deleted file mode 100644 index e8bb4ce7..00000000 --- a/rakelib/lib/config/pkgman/arch.rb +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 buildtools platform pkg manager for Arch Linux type systems -### - -module WXRuby3 - - module Config - - module Platform - - module PkgManager - - PLATFORM_DEPS = %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12] - - class << self - - private - - def do_install(distro, pkgs) - run_pacman(make_install_cmd(pkgs)) - end - - def add_platform_pkgs(pkgs) - if pkgs.include?('g++') - pkgs.delete('g++') - pkgs << 'gcc' - end - # find pkgs we need - PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("pacman -Qq #{pkg} >/dev/null 2>&1"); list } - end - - def run_pacman(cmd) - run("pacman -q --noconfirm #{cmd}") - end - - def make_install_cmd(pkgs) - # create install command - "-S --needed #{ pkgs.join(' ') }" - end - - end - - end - - end - - end - -end diff --git a/rakelib/lib/config/pkgman/debian.rb b/rakelib/lib/config/pkgman/debian.rb deleted file mode 100644 index 3b590b4f..00000000 --- a/rakelib/lib/config/pkgman/debian.rb +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 buildtools platform pkg manager for Debian type systems -### - -module WXRuby3 - - module Config - - module Platform - - module PkgManager - - PLATFORM_DEPS = %w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev] - - class << self - - private - - def do_install(distro, pkgs) - run_apt(make_install_cmd(pkgs)) - end - - def add_platform_pkgs(pkgs) - # get architecture - arch = expand('dpkg --print-architecture').strip - # find pkgs we need - PLATFORM_DEPS.inject(pkgs) do |list, pkg| - list << pkg unless (system("dpkg-query -s \"#{pkg}:#{arch}\" >/dev/null 2>&1") || - system("dpkg-query -s \"#{pkg}:all\" >/dev/null 2>&1") || - (expand("dpkg-query -s \"#{pkg}\" 2>/dev/null").strip =~ /Architecture: (#{arch}|all)/)) - list - end - end - - def run_apt(cmd) - run("DEBIAN_FRONTEND=noninteractive apt-get -q -o=Dpkg::Use-Pty=0 #{cmd}") - end - - def update_pkgs - run_apt('update') - end - - def make_install_cmd(pkgs) - # update cache - update_pkgs - # get list of available packages - apt_cache = `apt-cache pkgnames`.chomp.split("\n").collect { |s| s.strip } - # remove un-installables - pkgs = pkgs.select { |pkg| apt_cache.include?(pkg) } - # create install command - "install -y #{ pkgs.join(' ') }" - end - - end - - end - - end - - end - -end diff --git a/rakelib/lib/config/pkgman/base.rb b/rakelib/lib/config/pkgman/linux.rb similarity index 56% rename from rakelib/lib/config/pkgman/base.rb rename to rakelib/lib/config/pkgman/linux.rb index 13a9f5df..4fb1067d 100644 --- a/rakelib/lib/config/pkgman/base.rb +++ b/rakelib/lib/config/pkgman/linux.rb @@ -14,35 +14,34 @@ module Platform module PkgManager + PLATFORM_DEPS = { + debian: %w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev], + rhel: %w[expat-devel findutils gspell-devel gstreamer1-plugins-base-devel gtk3-devel libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel], + suse: %w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel], + arch: %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12] + } MIN_GENERIC_PKGS = %w[gtk3-devel patchelf g++ make git webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel] class << self - def distro - @distro ||= get_distro - end - def install(pkgs) # do we need to install anything? if !pkgs.empty? || builds_wxwidgets? - # determine the linux distro specs - begin - # load distro installation support - require_relative "./#{distro[:type]}" - rescue LoadError + # check linux distro compatibility + unless no_autoinstall? || pkgman # do we need to build wxWidgets? pkgs.concat(MIN_GENERIC_PKGS) if builds_wxwidgets? $stderr.puts <<~__ERROR_TXT - ERROR: Do not know how to install required packages for distro type '#{distro[:type]}'. + ERROR: Do not know how to install required packages for distro type '#{WXRuby3.config.sysinfo.os.variant}'. - Make sure the following packages (or equivalent) are installed and than try again with `WXRUBY_NO_AUTOINSTALL=1`: + Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`: #{pkgs.join(', ')} __ERROR_TXT exit(1) end # can we install? unless no_autoinstall? || has_sudo? || is_root? - $stderr.puts 'ERROR: Cannot check for or install required packages. Please install sudo or run as root and try again.' + $stderr.puts 'ERROR: Cannot check for or install required packages. Please install sudo and try again.' exit(1) end # do we need to build wxWidgets? @@ -63,7 +62,7 @@ def install(pkgs) exit(1) end # do the actual install - unless do_install(distro, pkgs) + unless run(pkgman.make_install_command(*pkgs)) $stderr.puts <<~__ERROR_TXT ERROR: Failed to install all or some of the following required software packages: #{pkgs.join(', ')} @@ -81,6 +80,18 @@ def install(pkgs) private + def pkgman + @pkgman ||= WXRuby3.config.sysinfo.os.pkgman + end + + def platform_pkgs + PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || [] + end + + def add_platform_pkgs(pkgs) + pkgs.concat(pkgman.select_uninstalled(platform_pkgs)) + end + def builds_wxwidgets? Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty? end @@ -103,8 +114,8 @@ def is_root? def run(cmd) $stdout.print "Running #{cmd}..." - rc = WXRuby3.config.sh("#{is_root? ? '' : 'sudo '}#{cmd}") - $stderr.puts (rc ? 'done!' : 'FAILED!') + rc = WXRuby3.config.sh(cmd) + $stderr.puts(rc ? 'done!' : 'FAILED!') rc end @@ -112,55 +123,6 @@ def expand(cmd) `#{is_root? ? '' : 'sudo '}#{cmd}` end - def get_distro - if File.file?('/etc/os-release') # works with most (if not all) recent distro releases - data = File.readlines('/etc/os-release').reduce({}) do |hash, line| - val, var = line.split('=') - hash[val] = var.strip.gsub(/(\A")|("\Z)/, '') - hash - end - { - type: if data['ID_LIKE'] - data['ID_LIKE'].split.first.to_sym - elsif File.file?('/etc/redhat-release') - :rhel - elsif File.file?('/etc/SUSE-brand') || File.file?('/etc/SuSE-release') - :suse - elsif File.file?('/etc/debian_version') - :debian - else - data['ID'].to_sym - end, - distro: data['ID'].downcase, - release: data['VERSION_ID'] - } - elsif File.file?('/etc/redhat-release') - data = File.read('/etc/redhat-release').strip - { - type: :rhel, - distro: data.split.shift.downcase, - release: data =~ /\d+(\.\d+)*/ ? $~[0] : '' - } - elsif File.file?('/etc/SUSE-brand') || File.file?('/etc/SuSE-release') - data = File.readlines(File.file?('/etc/SUSE-brand') ? '/etc/SUSE-brand' : '/etc/SuSE-release') - { - type: :suse, - distro: data.shift.split.shift.downcase, - release: (data.find { |s| s.strip =~ /\AVERSION\s*=/ } || '').split('=').last || '' - } - elsif File.file?('/etc/debian_version') - { - type: :debian, - distro: 'generic', - release: File.read('/etc/debian_version').strip - } - else - { - type: :unknown - } - end - end - end end diff --git a/rakelib/lib/config/pkgman/macosx.rb b/rakelib/lib/config/pkgman/macosx.rb index f67e3f7c..97feaa96 100644 --- a/rakelib/lib/config/pkgman/macosx.rb +++ b/rakelib/lib/config/pkgman/macosx.rb @@ -16,17 +16,9 @@ module PkgManager class << self - def distro - @distro ||= { - type: 'darwin', - distro: 'macosx', - release: WXRuby3.config.expand('sw_vers -productVersion').strip.split('.').first - } - end - def install(pkgs) # do we need to install anything? - if !pkgs.empty? + unless pkgs.empty? # can we install XCode commandline tools? unless no_autoinstall? || !pkgs.include?('xcode') || has_sudo? || is_root? STDERR.puts 'ERROR: Cannot check for or install required packages. Please install sudo or run as root and try again.' @@ -58,18 +50,20 @@ def install(pkgs) private + def pkgman + @pkgman ||= WXRuby3.config.sysinfo.os.pkgman + end + def do_install(pkgs) rc = true # first see if we need to install XCode commandline tools if pkgs.include?('xcode') pkgs.delete('xcode') - rc = run('xcode-select --install') + rc = auth_run('xcode-select --install') end - # now check if we need any other packages (which need Homebrew or MacPorts) + # now check if we need any other packages if rc && !pkgs.empty? - # Has Ruby been installed through MacPorts? - if has_macports? && - (ruby_info = expand('port -q installed installed').strip.split("\n").find { |ln| ln.strip =~ /\Aruby\d+\s/ }) + if pkgman.macports? # this is really crap; with MacPorts we need to install swig-ruby instead of simply swig # which for whatever nonsensical reason will pull in another (older) Ruby version (probably 2.3 or such) @@ -78,59 +72,15 @@ def do_install(pkgs) pkgs.delete('swig') pkgs << 'swig-ruby' end - # in case MacPorts was installed with root privileges this install would also have to be run - # with root privileges (otherwise it would fail early on with access problems) so we can - # just run without sudo as we either have root privileges for root-installed MacPorts or - # we're running without root privileges for user-installed MacPorts - pkgs.each { |pkg| rc &&= sh("port install #{pkg}") } - - # or are we running without root privileges and have Homebrew installed? - # (Ruby may be installed using Homebrew itself or using a Ruby version manager like RVM) - elsif !is_root? && has_homebrew? - - pkgs.each { |pkg| rc &&= sh("brew install #{pkg}") } - - # or do we have MacPorts (running either privileged or not) and - # a Ruby installed using a Ruby version manager. - elsif has_macports? - # same crap as above - if pkgs.include?('swig') - pkgs.delete('swig') - pkgs << 'swig-ruby' - end - # in case MacPorts was installed with root privileges this install would also have to be run - # with root privileges (otherwise it would fail early on with access problems) so we can - # just run without sudo as we either have root privileges for root-installed MacPorts or - # we're running without root privileges for user-installed MacPorts - pkgs.each { |pkg| rc &&= sh("port install #{pkg}") } - - else - if has_homebrew? || is_root? - $stderr.puts <<~__ERROR_TXT - ERROR: Unsupported Ruby installation. wxRuby3 can only be installed for Ruby with root privileges - in case Ruby was installed with MacPorts. Homebrew should not be run with root privileges. - - Re-install a supported Ruby setup and try again. - __ERROR_TXT - else - $stderr.puts <<~__ERROR_TXT - ERROR: Unsupported Ruby installation. wxRuby3 requires either a MacPorts installed Ruby version - or a non-privileged Ruby installation and have Homebrew installed. - - Install either Homebrew or MacPorts and try again. - __ERROR_TXT - end - exit(1) end + + # actually install packages + pkgs.each { |pkg| rc &&= run(pkgman.make_install_command(pkg)); break unless rc } end rc end - def builds_wxwidgets? - Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty? - end - def no_autoinstall? Config.get_config('autoinstall') == false end @@ -140,46 +90,27 @@ def wants_autoinstall? end def has_sudo? - system('command -v sudo > /dev/null') + WXRuby3.config.sysinfo.os.has_sudo? end def is_root? - if @is_root.nil? - @is_root = (`id -u 2>/dev/null`.chomp == '0') - end - @is_root - end - - def has_macports? - if @has_macports.nil? - @has_macports = system('command -v port>/dev/null') - end - end - - def has_homebrew? - if @has_homebrew.nil? - @has_homebrew = system('command -v brew>/dev/null') - end + WXRuby3.config.sysinfo.os.is_root? end - def run(cmd) + def auth_run(cmd) $stdout.print "Running #{cmd}..." rc = WXRuby3.config.sh("#{is_root? ? '' : 'sudo '}#{cmd}") - $stderr.puts (rc ? 'done!' : 'FAILED!') + $stderr.puts(rc ? 'done!' : 'FAILED!') rc end - def sh(*cmd, title: nil) + def run(*cmd, title: nil) $stdout.print(title ? title : "Running #{cmd}...") rc = WXRuby3.config.sh(*cmd) - $stderr.puts (rc ? 'done!' : 'FAILED!') + $stderr.puts(rc ? 'done!' : 'FAILED!') rc end - def expand(cmd) - WXRuby3.config.expand(cmd) - end - end end diff --git a/rakelib/lib/config/pkgman/rhel.rb b/rakelib/lib/config/pkgman/rhel.rb deleted file mode 100644 index d048f75e..00000000 --- a/rakelib/lib/config/pkgman/rhel.rb +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 buildtools platform pkg manager for RHEL type systems -### - -module WXRuby3 - - module Config - - module Platform - - module PkgManager - - PLATFORM_DEPS = %w[expat-devel findutils gspell-devel gstreamer1-plugins-base-devel gtk3-devel libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel] - - class << self - - private - - def do_install(distro, pkgs) - run_dnf(make_install_cmd(pkgs)) - end - - def add_platform_pkgs(pkgs) - # add build tools - if pkgs.include?('git') - pkgs.delete('git') - pkgs << 'git-core' - end - # find pkgs we need - PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("dnf list installed #{pkg} >/dev/null 2>&1"); list } - end - - def run_dnf(cmd) - run("dnf #{cmd}") - end - - def make_install_cmd(pkgs) - # create install command - "install -y #{ pkgs.join(' ') }" - end - - end - - end - - end - - end - -end diff --git a/rakelib/lib/config/pkgman/suse.rb b/rakelib/lib/config/pkgman/suse.rb deleted file mode 100644 index badf6958..00000000 --- a/rakelib/lib/config/pkgman/suse.rb +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2023 M.J.N. Corino, The Netherlands -# -# This software is released under the MIT license. - -### -# wxRuby3 buildtools platform pkg manager for SuSE type systems -### - -module WXRuby3 - - module Config - - module Platform - - module PkgManager - - PLATFORM_DEPS = %w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel] - - class << self - - private - - def do_install(distro, pkgs) - run_zypper(make_install_cmd(pkgs)) - end - - def add_platform_pkgs(pkgs) - # add build tools - if pkgs.include?('g++') - pkgs.delete('g++') - pkgs << 'gcc-c++' - end - # find pkgs we need - PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("rpm -q --whatprovides #{pkg} >/dev/null 2>&1"); list } - end - - def run_zypper(cmd) - run("zypper -t -i #{cmd}") - end - - def make_install_cmd(pkgs) - # create install command - "install -y #{ pkgs.join(' ') }" - end - - end - - end - - end - - end - -end diff --git a/rakelib/lib/config/unknown.rb b/rakelib/lib/config/unknown.rb new file mode 100644 index 00000000..f650d727 --- /dev/null +++ b/rakelib/lib/config/unknown.rb @@ -0,0 +1,10 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +### +# wxRuby3 buildtools configuration fallback +### + +$stderr.puts 'ERROR: Unsupported Ruby platform!' +exit(1) From 220c7fcc03a1916e9ed9f4f798f7c560bf8e5073 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 11:19:20 +0100 Subject: [PATCH 146/168] update description format --- lib/wx/wxruby/cmd/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wx/wxruby/cmd/setup.rb b/lib/wx/wxruby/cmd/setup.rb index 44523c5a..be2b6a96 100644 --- a/lib/wx/wxruby/cmd/setup.rb +++ b/lib/wx/wxruby/cmd/setup.rb @@ -14,7 +14,7 @@ class Setup DESC = 'Run wxRuby3 post-install setup.' def self.description - " setup -h|[options]\t\t#{DESC}" + " setup -h|[options]\t\t\t#{DESC}" end def self.options From 832f62fb059e828b741312fa60d7dd21053442f9 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 11:19:55 +0100 Subject: [PATCH 147/168] added wxruby check command --- lib/wx/wxruby/cmd/check.rb | 182 +++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 lib/wx/wxruby/cmd/check.rb diff --git a/lib/wx/wxruby/cmd/check.rb b/lib/wx/wxruby/cmd/check.rb new file mode 100644 index 00000000..61fcd031 --- /dev/null +++ b/lib/wx/wxruby/cmd/check.rb @@ -0,0 +1,182 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +# wxruby check command handler +#-------------------------------------------------------------------- + +require 'fileutils' +require 'plat4m' + +module WxRuby + module Commands + + class Check + + LOAD_ERRORS = { + linux: /cannot\s+open\s+shared\s+object/i, + darwin: /library\s+not\s+loaded/i, + windows: /specified\s+module\s+could\s+not\s+be\s+found/i + } + + DESC = 'Run wxRuby3 runtime readiness check.' + + def self.description + " check -h|[options]\t\t\t#{DESC}" + end + + def self.options + Commands.options['check'] ||= { verbose: Commands.options[:verbose] } + end + + def self.parse_args(args) + opts = OptionParser.new + opts.banner = "#{DESC}\n\nUsage: wxruby check -h|--help OR wxruby check [options]\n\n" + + "Returns:\n"+ + " 0 if wxRuby3 is ready to run\n"+ + " 1 if wxRuby3 does not seem to be built yet\n"+ + " 2 if wxRuby3 has problems loading extension libraries\n"+ + " 3 if an unexpected Ruby error occurred\n\n"+ + "Unless '-q|--quiet' has been specified a description of the possible problem cause will\n"+ + "be shown on failure.\n\n" + opts.separator '' + opts.on('-q', '--quiet', + "Do not show problem analysis messages on failures.") do |v| + Check.options[:quiet] = true + Check.options[:verbose] = false + end + opts.on('-v', '--verbose', + 'Show verbose output') do |v| + Check.options[:verbose] = true + Check.options[:quiet] = false + end + opts.on('-h', '--help', + 'Show this message.') do |v| + puts opts + puts + exit(0) + end + opts.parse!(args) + end + + def self.show_error(msg) + $stderr.puts(msg) unless options[:quiet] + end + + def self.show_log(msg) + $stdout.puts(msg) if options[:verbose] + end + + def self.run(argv) + return description if argv == :describe + + parse_args(argv) + + show_log('Checking build (or binary package installation) completion...') + # check if the binary setup (packages or built) has been completed successfully + unless Commands.setup_done? + $stderr.puts <<~__INFO_TXT + + wxRuby3 requires the post-install setup cmd to be run to build and finish installing + the required runtime binaries. Execute the command like: + + $ wxruby setup + + To see the available options for the command execute: + + $ wxruby setup -h + + __INFO_TXT + exit(1) + end + + # check runtime + show_log('Attempting to load wxRuby3 libraries...') + sysinfo = Plat4m.current + begin + require 'wx' + rescue LoadError => ex + if ex.message =~ LOAD_ERRORS[sysinfo.os.id] + # error loading shared libraries + show_log("Captured LoadError: #{ex.message}") + # check if wxWidgets libs can be located + show_log('Checking wxWidgets availability...') + wx_found = if Dir[File.join(WxRuby::ROOT, 'ext', "*.#{RbConfig::CONFIG['SOEXT']}")].empty? + # no embedded wxWidgets -> if system installed than 'wx-config' should be in the path + if system("wx-config --version>#{sysinfo.dev_null} 2>&1") + true # system installed + else + # no system installed wxWidgets + # check the system dependent load paths if any wxWidgets libs can be found + case sysinfo.os.id + when :linux + (ENV['LD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.so')].empty? } + when :darwin + (ENV['DYLD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.dylib')].empty? } + when :windows + (ENV['PATH']||'').split(';').any? { |p| !Dir[File.join(p, 'wxbase*.dll')].empty? } + else + true # do not know how to search so assume wxWidgets found + end + end + else + true # embedded wxWidgets + end + if wx_found + show_log('wxWidgets found') + show_error <<~__INFO_TXT + + The runtime environment of this system seems to be missing some required libraries for + executing wxRuby3 apps. + Please be aware wxRuby3 requires a properly configured GUI based system to function. + See the documentation for more information on the required runtime environment. + + __INFO_TXT + else + show_log('NO wxWidgets found') + show_error <<~__INFO_TXT + + It seems wxRuby3 is not able to load any of the required wxWidgets libraries it was built + for. + Please make sure these (shared) libraries are available in the appropriate search path + for this system. + + __INFO_TXT + end + else + show_error <<~__INFO_TXT + + There is an unexpected problem loading the wxRuby3 extension libraries. + Please check the problem report below for a probable cause analysis. If you have reason + to suspect a bug to be the cause of this problem please file an issue at Github and attach + the problem report. + + #{ex.message} + #{ex.backtrace.join("\n")} + + __INFO_TXT + end + exit(2) + rescue Exception => ex + show_log("Captured Exception: #{ex.message}") + show_error <<~__INFO_TXT + + There is an unexpected problem loading the wxRuby3 libraries. + Please check the problem report below for a probable cause analysis. If you have reason + to suspect a bug to be the cause of this problem please file an issue at Github and attach + the problem report. + + #{ex.message} + #{ex.backtrace.join("\n")} + + __INFO_TXT + exit(3) + end + end + + end + + self.register('check', Check) + + end +end From 37d1f552d91f3b0fadb360e4b0667afa48a7488b Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 11:26:44 +0100 Subject: [PATCH 148/168] added wxruby check command to gem post install message --- rakelib/gem.rake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rakelib/gem.rake b/rakelib/gem.rake index 11784797..3b9d289c 100644 --- a/rakelib/gem.rake +++ b/rakelib/gem.rake @@ -101,8 +101,14 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do $ wxruby setup - Otherwise (or after you have successfully run the setup procedure) you can start - using wxRuby3. + To check whether wxRuby3 is ready to run or not you can at any time execute the + following command: + + $ wxruby check + + Run 'wxruby check -h' for more information. + + When the wxRuby3 setup has been fully completed you can start using wxRuby3. You can run the regression tests to verify the installation by executing: From 406089fee4ec6ebf3c02ea230ae2b2e5d33e9ee2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 12:07:17 +0100 Subject: [PATCH 149/168] properly report invalid switches and commands with appropriate exit code --- lib/wx/wxruby/base.rb | 4 ++-- lib/wx/wxruby/cmd/check.rb | 2 +- lib/wx/wxruby/cmd/sampler.rb | 2 +- lib/wx/wxruby/cmd/setup.rb | 2 +- lib/wx/wxruby/cmd/test.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/wx/wxruby/base.rb b/lib/wx/wxruby/base.rb index d62824d5..bb9f60cb 100644 --- a/lib/wx/wxruby/base.rb +++ b/lib/wx/wxruby/base.rb @@ -20,7 +20,7 @@ class << self def commands @commands ||= ::Hash.new do |hash, key| STDERR.puts "Unknown command #{key} specified." - exit(1) + exit(127) end end private :commands @@ -73,7 +73,7 @@ def parse_args(args) describe_all exit(0) end - opts.order!(args) + opts.order!(args) rescue ($stderr.puts $!.message; exit(127)) end end end diff --git a/lib/wx/wxruby/cmd/check.rb b/lib/wx/wxruby/cmd/check.rb index 61fcd031..a7841c8b 100644 --- a/lib/wx/wxruby/cmd/check.rb +++ b/lib/wx/wxruby/cmd/check.rb @@ -56,7 +56,7 @@ def self.parse_args(args) puts exit(0) end - opts.parse!(args) + opts.parse!(args) rescue ($stderr.puts $!.message; exit(127)) end def self.show_error(msg) diff --git a/lib/wx/wxruby/cmd/sampler.rb b/lib/wx/wxruby/cmd/sampler.rb index 28dba98a..111ef37c 100644 --- a/lib/wx/wxruby/cmd/sampler.rb +++ b/lib/wx/wxruby/cmd/sampler.rb @@ -34,7 +34,7 @@ def self.parse_args(args) puts exit(0) end - opts.parse!(args) + opts.parse!(args) rescue ($stderr.puts $!.message; exit(127)) end def self.run(argv) diff --git a/lib/wx/wxruby/cmd/setup.rb b/lib/wx/wxruby/cmd/setup.rb index be2b6a96..285d5775 100644 --- a/lib/wx/wxruby/cmd/setup.rb +++ b/lib/wx/wxruby/cmd/setup.rb @@ -50,7 +50,7 @@ def self.parse_args(args) puts exit(0) end - opts.parse!(args) + opts.parse!(args) rescue ($stderr.puts $!.message; exit(127)) end def self.run(argv) diff --git a/lib/wx/wxruby/cmd/test.rb b/lib/wx/wxruby/cmd/test.rb index 8f4f9d4e..0f37b03a 100644 --- a/lib/wx/wxruby/cmd/test.rb +++ b/lib/wx/wxruby/cmd/test.rb @@ -45,7 +45,7 @@ def self.parse_args(args) puts exit(0) end - opts.parse!(args) + opts.parse!(args) rescue ($stderr.puts $!.message; exit(127)) end def self.run(argv) From 2e8cbc51b296b430d17d46d4cba9cfbfc0143b6c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 12:30:02 +0100 Subject: [PATCH 150/168] integrated wxruby check in workflows --- .github/workflows/linux.yml | 5 +++ .github/workflows/mac.yml | 5 +++ .github/workflows/msw.yml | 5 +++ .github/workflows/release.yml | 80 ++++++++++++++++++++++++++--------- 4 files changed, 76 insertions(+), 19 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b45b19d8..0e8b106b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -276,6 +276,11 @@ jobs: fi fi + - name: Check wxRuby3 gem install + if: matrix.wxr_type != 'develop' + run: | + wxruby check + - name: Run wxRuby3 regression tests run: | ulimit -c unlimited diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 4196f663..27bc9f46 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -321,6 +321,11 @@ jobs: fi fi + - name: Check wxRuby3 gem install + if: matrix.wxr_type != 'develop' + run: | + wxruby check + - name: Run wxRuby3 regression tests run: | if [ "${{ matrix.wxr_type }}" == "develop" ]; then diff --git a/.github/workflows/msw.yml b/.github/workflows/msw.yml index 96e1c872..cc683f8b 100644 --- a/.github/workflows/msw.yml +++ b/.github/workflows/msw.yml @@ -209,6 +209,11 @@ jobs: foreach ($f in Get-ChildItem -Path pkg\*.gem) { gem install $f -- prebuilt=none && wxruby setup --wxwin=$env:WXWIN_ROOT } } + - name: Check wxRuby3 gem install + if: matrix.wxr_type != 'develop' + run: | + wxruby check + - name: Run wxRuby3 regression tests run: | If ("${{ matrix.wxr_type }}" -eq "develop") { diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7095c301..bb226183 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -392,21 +392,25 @@ jobs: gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=only fi - - name: Install wxRuby3 gem with local build + - name: Install wxRuby3 gem for local build if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} run: | if [ "$WXRUBY_PRERELEASE" == "1" ]; then - if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --autoinstall - else - gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall - fi + gem install wxruby3 -v $WXRUBY_RELEASE --pre -- prebuilt=none else - if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --autoinstall - else - gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall - fi + gem install wxruby3 -v $WXRUBY_RELEASE -- prebuilt=none + fi + if wxruby check || [ "$?" != "1" ]; then + echo "ERROR: 'wxruby check' returned unexpected result!" + fi + + - name: Setup wxRuby3 gem with local build + if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} + run: | + if [ "${{ matrix.wxw_type }}" == "embed" ]; then + wxruby setup --autoinstall + else + wxruby setup --wxwin=@system --autoinstall fi - name: Download release test gem artifact @@ -426,15 +430,28 @@ jobs: run: | gem install ./$(echo wxruby3*.gem) -- package=`pwd`/$(echo wxruby3*.pkg) - - name: Install wxRuby3 gem with local build (release test) + - name: Install wxRuby3 gem for local build (release test) + if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} + run: | + gem install ./$(echo wxruby3*.gem) -- prebuilt=none + if wxruby check || [ "$?" != "1" ]; then + echo "ERROR: 'wxruby check' returned unexpected result!" + fi + + - name: Setup wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} run: | if [ "${{ matrix.wxw_type }}" == "embed" ]; then - gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --autoinstall + wxruby setup --autoinstall else - gem install ./$(echo wxruby3*.gem) -- prebuilt=none && wxruby setup --wxwin=@system --autoinstall + wxruby setup --wxwin=@system --autoinstall fi + - name: Check wxRuby3 gem install + if: matrix.wxr_type != 'develop' + run: | + wxruby check + - name: Run wxRuby3 regression tests (XVFB) if: ${{ matrix.use_xvfb }} run: | @@ -497,16 +514,26 @@ jobs: gem install wxruby3 -v $env:WXRUBY_RELEASE -- prebuilt=only } - - name: Install wxRuby3 gem with local build + - name: Install wxRuby3 gem for local build if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} run: | If ("$env:WXRUBY_PRERELEASE" -eq "1") { - gem install wxruby3 -v $env:WXRUBY_RELEASE --pre -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_RELEASE --pre -- prebuilt=none } Else { - gem install wxruby3 -v $env:WXRUBY_RELEASE -- prebuilt=none && wxruby setup --autoinstall + gem install wxruby3 -v $env:WXRUBY_RELEASE -- prebuilt=none + } + wxruby check + If ($LastExitCode -ne 1) { + echo "ERROR: 'wxruby check' returned unexpected result!" + Exit $LastExitCode } + - name: Setup wxRuby3 gem with local build + if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} + run: | + wxruby setup --autoinstall + - name: Download release test gem artifact if: ${{ github.event_name == 'workflow_dispatch' }} uses: actions/download-artifact@v4 @@ -524,10 +551,25 @@ jobs: run: | foreach ($f in Get-ChildItem -Path wxruby3*.gem) { foreach ($p in Get-ChildItem -Path wxruby3*.pkg) { gem install $f -- package=$p } } - - name: Install wxRuby3 gem with local build (release test) + - name: Install wxRuby3 gem for local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} run: | - foreach ($f in Get-ChildItem -Path wxruby3*.gem) { gem install $f -- prebuilt=none && wxruby setup --autoinstall } + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { gem install $f -- prebuilt=none } + wxruby check + If ($LastExitCode -ne 1) { + echo "ERROR: 'wxruby check' returned unexpected result!" + Exit $LastExitCode + } + + - name: Setup wxRuby3 gem with local build (release test) + if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} + run: | + foreach ($f in Get-ChildItem -Path wxruby3*.gem) { wxruby setup --autoinstall } + + - name: Check wxRuby3 gem install + if: matrix.wxr_type != 'develop' + run: | + wxruby check - name: Run wxRuby3 regression tests run: | From faad2692be05aac94f863c76225460f22bedd391 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 14:38:36 +0100 Subject: [PATCH 151/168] take alternative platform package names into account --- rakelib/lib/config/pkgman/linux.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rakelib/lib/config/pkgman/linux.rb b/rakelib/lib/config/pkgman/linux.rb index 4fb1067d..d92ca593 100644 --- a/rakelib/lib/config/pkgman/linux.rb +++ b/rakelib/lib/config/pkgman/linux.rb @@ -20,6 +20,11 @@ module PkgManager suse: %w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel], arch: %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12] } + PLATFORM_ALTS = { + suse: { 'g++' => 'gcc-c++' }, + rhel: { 'git' => 'git-core' }, + arch: { 'g++' => 'gcc' } + } MIN_GENERIC_PKGS = %w[gtk3-devel patchelf g++ make git webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel] class << self @@ -85,7 +90,11 @@ def pkgman end def platform_pkgs - PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || [] + pkgs = PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || [] + (PLATFORM_ALTS[WXRuby3.config.sysinfo.os.variant.to_sym] || {}).each_pair do |org, alt| + pkgs << alt if pkgs.delete(org) + end + pkgs end def add_platform_pkgs(pkgs) From d85c84c0a386a526fc742c0bc7301f11cb1ef761 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 16:07:44 +0100 Subject: [PATCH 152/168] update proper exit codes on Windows --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb226183..b94b2556 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -526,8 +526,9 @@ jobs: wxruby check If ($LastExitCode -ne 1) { echo "ERROR: 'wxruby check' returned unexpected result!" - Exit $LastExitCode + Exit 1 } + Exit 0 - name: Setup wxRuby3 gem with local build if: ${{ matrix.build && github.event_name != 'workflow_dispatch' }} @@ -558,8 +559,9 @@ jobs: wxruby check If ($LastExitCode -ne 1) { echo "ERROR: 'wxruby check' returned unexpected result!" - Exit $LastExitCode + Exit 1 } + Exit 0 - name: Setup wxRuby3 gem with local build (release test) if: ${{ matrix.build && github.event_name == 'workflow_dispatch' }} From bc5a7e833872a124da8ea144b23752bdd770d57d Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 21 Feb 2024 16:22:23 +0100 Subject: [PATCH 153/168] fix alternative platform package name transformations --- rakelib/lib/config/pkgman/linux.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rakelib/lib/config/pkgman/linux.rb b/rakelib/lib/config/pkgman/linux.rb index d92ca593..2bde10c1 100644 --- a/rakelib/lib/config/pkgman/linux.rb +++ b/rakelib/lib/config/pkgman/linux.rb @@ -90,14 +90,15 @@ def pkgman end def platform_pkgs - pkgs = PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || [] - (PLATFORM_ALTS[WXRuby3.config.sysinfo.os.variant.to_sym] || {}).each_pair do |org, alt| - pkgs << alt if pkgs.delete(org) - end - pkgs + PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || [] end def add_platform_pkgs(pkgs) + # transform any platform specific package alternatives + (PLATFORM_ALTS[WXRuby3.config.sysinfo.os.variant.to_sym] || {}).each_pair do |org, alt| + pkgs << alt if pkgs.delete(org) + end + # add any other platform specific package dependencies pkgs.concat(pkgman.select_uninstalled(platform_pkgs)) end From 1384d147ff213fd7b71e3fbf0ed60329ebbdca5e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 15:19:24 +0100 Subject: [PATCH 154/168] use Ruby version 'ruby' to specify latest stable --- .github/workflows/linux.yml | 8 ++++---- .github/workflows/mac.yml | 12 ++++++------ .github/workflows/msw.yml | 10 +++++----- .github/workflows/release.yml | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0e8b106b..efbbed8e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -62,7 +62,7 @@ jobs: gtk_version: 3 CC: gcc-10 CXX: g++-10 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' configure_flags: @@ -95,7 +95,7 @@ jobs: gtk_version: 3 CC: gcc-12 CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' configure_flags: @@ -117,7 +117,7 @@ jobs: gtk_version: 3 CC: gcc-12 CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' configure_flags: @@ -128,7 +128,7 @@ jobs: gtk_version: 3 CC: gcc-12 CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' configure_flags: diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 27bc9f46..8b1b1212 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -55,7 +55,7 @@ jobs: runner: macos-11 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: develop @@ -64,7 +64,7 @@ jobs: runner: macos-11 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: embed @@ -73,7 +73,7 @@ jobs: runner: macos-13 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: develop @@ -82,7 +82,7 @@ jobs: runner: macos-13 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: embed @@ -91,7 +91,7 @@ jobs: runner: macos-13 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: embed @@ -100,7 +100,7 @@ jobs: runner: macos-13 arch: x86_64 wxWidgets: '3.2.4' - ruby: '3.2' + ruby: 'ruby' swig: '4' configure_flags: --disable-sys-libs wxw_type: system diff --git a/.github/workflows/msw.yml b/.github/workflows/msw.yml index cc683f8b..48215d16 100644 --- a/.github/workflows/msw.yml +++ b/.github/workflows/msw.yml @@ -63,7 +63,7 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' wxw_type: embed @@ -71,7 +71,7 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' wxw_type: develop @@ -79,7 +79,7 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' wxw_type: embed @@ -87,7 +87,7 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' wxw_type: embed @@ -95,7 +95,7 @@ jobs: - os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.2' + ruby: 'ruby' wxWidgets: '3.2.4' swig: '4' wxw_type: develop diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b94b2556..5f4cf8f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -119,7 +119,7 @@ jobs: os: windows-2022 platform: 'x64' CXX: g++-12 - ruby: '3.3' + ruby: 'ruby' swig: '4' steps: @@ -214,11 +214,11 @@ jobs: - name: macOS12 os: macos-12 arch: x86_64 - ruby: '3.3' + ruby: 'ruby' - name: macOS13 os: macos-13 arch: x86_64 - ruby: '3.3' + ruby: 'ruby' steps: - name: Checkout wxRuby3 From 1df3d3291b102ff7edf7b3efee45b237ba2daffb Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 17:01:07 +0100 Subject: [PATCH 155/168] make TOC vertically scrolled on overflow --- rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css b/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css index e4743239..eac76bb8 100644 --- a/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +++ b/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css @@ -90,4 +90,8 @@ div.wxrb-logo table td { #toc { position: fixed; + overflow-y: scroll; + overflow-x: hidden; + top: 1em; + bottom: 0; } From 346e01fab836ebb6e23ffc3f1a9b45ac77400af0 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 18:38:02 +0100 Subject: [PATCH 156/168] also use latest Ruby for doc gen --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 24b7d071..145b49a0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -39,7 +39,7 @@ jobs: - name: Install Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.2' + ruby-version: 'ruby' - name: Setup Ruby gems run: | From 236e6e37acdf27beea505bb951ff441da7cb1692 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 18:39:30 +0100 Subject: [PATCH 157/168] Updated docs for new binary package installations --- INSTALL.md | 203 ++++++++++++++++++++++++++++++++++++++++++----------- README.md | 50 +++++++------ 2 files changed, 189 insertions(+), 64 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index ec66c38e..90c20e13 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,25 +8,26 @@ The wxRuby3 gem provides a **worry-free** installation for all supported platforms. -The default gem installation commands +The default gem installation command + ```shell gem install wxruby3 ``` -for Windows and +and the setup command ```shell -gem install wxruby3 && wxruby setup +wxruby setup ``` -for Linux and MacOSX (see Note below) and Windows (if installing for Ruby releases older than the latest stable release) -should always result in a successfully installed wxRuby3 version.
-Just follow the (very few and in some cases none) prompts at the start of the setup procedure and sit back and relax. + +for installations without prebuilt binary packages should always result in a successfully installed wxRuby3 version. > **NOTE**
> Currently installing the wxRuby3 gem for the system supplied Ruby on MacOSX systems does not work.
> The user is therefor required to install a Ruby interpreter using either [MacPorts](https://www.macports.org/) (both > privileged and user installations are supported) or [Homebrew](https://brew.sh/) or Ruby installers/version managers -> like [ruby-install](https://github.com/postmodern/ruby-install) or [RVM](https://rvm.io) (only user installations supported) . +> like [ruby-install](https://github.com/postmodern/ruby-install) or [RVM](https://rvm.io) (only user installations +> supported) . [Below](INSTALL.md#installing-software-requirements) more details regarding the software requirements for wxRuby3, the setup procedure and various options to tweak and customize the installation (including platform specific details for @@ -36,16 +37,65 @@ Linux, Windows and MacOSX) are described. Installing the wxRuby3 gem will also install the bundled `wxruby` CLI binary. -For source gem installations the CLI will initially only provide the *setup* command. +For source gem installations the CLI will initially only provide the `check` and `setup` commands. -For binary gem installations and successfully set up source gem installations the *setup* command is replaced by other +For finalized installations (either from binary packages or source builds) the *setup* command is replaced by other utility commands providing the ability to run the bundled regression tests and access (run or copy) the bundled examples.
Run the following command to see the available options at any time: ```shell -wxruby --help +wxruby -h ``` +## Binary packages + +The wxRuby3 gem installation process will by default attempt to match the current platform to any standard available +binary packages and if found install the matched package. + +Binary packages are archives (custom format) containing prebuilt (extension) library artifacts for a single specific +platform. Any such platform is identified by: + +- CPU architecture (x86_64, ARM64, etc.) +- Operating system type (linux, darwin, windows, etc.) +- OS distribution and release number (except for windows) +- Ruby ABI version (i.e. {major}.{minor}) + +The standard available binary packages provide both the wxRuby3 extension libraries as well as the embedded wxWidgets +libraries the extension libraries were built for.
+This is however not mandatory. User created binary packages can be built for separately installed (either distribution +or user provided) wxWidgets libraries. + +### Standard packages + +The standard release artifacts at [Github](https://github.com/mcorino/wxRuby3/releases) provide a selection of binary +packages for all supported OS platforms which are automatically built and uploaded for every release.
+The following tables lists the packages provided by the current wxRuby3 release process: + +| OS | Distributions | Architectures | Rubies | +|---------|-------------------------------|-------------------------|----------------------------------------------------| +| Linux | OpenSuSE Leap (latest stable) | x86_64 and ARM64 | Distro provided Ruby and Latest stable Ruby | +| Linux | Fedora (latest stable) | x86_64 and ARM64 | Distro provided Ruby and Latest stable Ruby | +| Linux | Debian (latest stable) | x86_64 and ARM64 | Distro provided Ruby and Latest stable Ruby | +| Linux | Ubuntu (latest stable) | x86_64 and ARM64 | Distro provided Ruby and Latest stable Ruby | +| Windows | NA | x86_64 | Latest stable Ruby | +| OSX | MacOSX 12 | x86_64 and ARM64 | Latest stable Ruby | +| OSX | MacOSX 13 | x86_64 and ARM64 | Latest stable Ruby | +| OSX | MacOSX 14 | ARM64 | Latest stable Ruby | + +### User created packages + +Users can create their own wxRuby3 binary packages by building from source ([see here](#building-from-source)) and after +successfully having built the wxWidgets extension libraries execute the `rake binpkg` command.
+This creates two files in the `pkg` folder with names like
+`wxruby3_{distribution}_ruby{abi version}_v{wxruby version}_{os}_{arch}.pkg`
+and
+`wxruby3_{distribution}_ruby{abi version}_v{wxruby version}_{os}_{arch}.sha`
+where the `.pkg` file is the actual binary archive and the `.sha` file is the associated SHA256 digest signature of the +archive contents. + +Both files are required for installation and should be located at the same path (either local path or http(s) url).
+[See here](#the-package-option) for information on how to use user created binary packages with the wxRuby3 gem installation process. + ## Software requirements for wxRuby3 The software requirements for setting up a wxRuby3 runtime environment are: @@ -90,63 +140,129 @@ wxRuby3 can be built and installed for 3 different types of wxWidgets installati In this case the libraries and development files are most likely not found in standard locations and the wxRuby3 installation procedure will require specific options to have these locations provided. 3. An 'embedded' installation of wxWidgets setup by the wxRuby3 installation procedure.
- This is the default when the installation procedure does not detect a (compatible!) system installation or if an - option has been provided explicitly specifying to install an embedded wxWidgets version. + This is the default when using a standard binary package or when installing from source and the setup procedure does + not detect a (compatible!) system installation or if an option has been provided explicitly specifying to install an + embedded wxWidgets version. Please note that in case of option **2** the user is responsible to make sure the wxWidgets shared libraries can be found by the system's dynamic loader at runtime. -As described with option **3** a wxWidgets system installation must be compatible (>= version 3.2) to be selected. In case -the installed version does not meet this requirement it is ignored as if not installed. +As described with option **3** a wxWidgets system installation must be compatible (>= version 3.2) to be selected for +source installation. In case the installed version does not meet this requirement it is ignored as if not installed. For more information on how to install wxWidgets see the [Installing software requirements](INSTALL.md#installing-software-requirements) section below. ## wxRuby3 gem installation details -The wxRuby3 project provides gems on [RubyGems](https://rubygems.org) which can be installed with the +The wxRuby3 project provides a gem on [RubyGems](https://rubygems.org) which can be installed with the standard `gem install` command line this: ```shell gem install wxruby3 ``` -On Linux and MacOSX systems this will install the source based gem which will require a follow-up command to build the native wxruby3 extension -for the platform on which wxRuby3 is being installed.
-On Windows systems a prebuilt binary gem is available for the latest stable release(s) of [RubyInstaller](https://rubyinstaller.org) -installed rubies that will be installed by default if installing for that platform (including an embedded, latest -stable version, wxWidgets installation).
-Alternatively the source gem can be installed on Windows by installing with an explicit platform specification like this: +Alternatively the gem can be downloaded from the [Github release assets](https://github.com/mcorino/wxRuby3/releases) and +stored locally. This local gem can than be installed like this: ```shell -gem install wxruby3 --platform=ruby +gem install /path/to/local/wxruby3.gem ``` -> The result of installing the gem on a Linux platform should be something like this: +This default installation command will allow the wxRuby3 installation process to scan available standard binary packages +([see here](#standard-packages)) for a match to the platform being installed on and install any matched package or revert +to a source install if none matched.
+This command will therefor succeed if: +- a matching binary package could be successfully downloaded and installed; +- the installation reverted to source install. + +This command only fails when: +- a matching digest signature for the downloaded binary package could not be downloaded; +- the digest signature did not match the downloaded package contents. + +> The result of successfully installing the gem on a Linux platform should be something like this: > ``` > $ gem install wxruby3 +> Building native extensions. This could take a while... > -> The wxRuby3 Gem has been successfully installed. -> Before being able to use wxRuby3 you need to run the post-install setup process -> by executing the command 'wxruby setup'. +> The wxRuby3 Gem has been successfully installed including the 'wxruby' utility. > -> Run 'wxruby setup -h' to see information on the available commandline options. -> -> Successfully installed wxruby3-0.9.5 -> Parsing documentation for wxruby3-0.9.5 -> Installing ri documentation for wxruby3-0.9.5 -> Done installing documentation for wxruby3 after 10 seconds +> In case no suitable binary release package was available for your platform you +> will need to run the post-install setup process by executing: +> +> $ wxruby setup +> +> To check whether wxRuby3 is ready to run or not you can at any time execute the +> following command: +> +> $ wxruby check +> +> Run 'wxruby check -h' for more information. +> +> When the wxRuby3 setup has been fully completed you can start using wxRuby3. +> +> You can run the regression tests to verify the installation by executing: +> +> $ wxruby test +> +> The wxRuby3 sample explorer can be run by executing: +> +> $ wxruby sampler +> +> Have fun using wxRuby3. +> +> Run 'wxruby -h' to see information on the available commands. +> +> Successfully installed wxruby3-0.9.8 +> Parsing documentation for wxruby3-0.9.8 +> Installing ri documentation for wxruby3-0.9.8 +> Done installing documentation for wxruby3 after 2 seconds > 1 gem installed > ``` -As said, on Linux and MacOSX systems (also on Windows when installing the source gem) an additional command is required -to build the actual wxRuby3 extension libraries for the platform which is a wxRuby3 CLI command installed by the gem: +### Gem installation options + +Two options are available to control the wxRuby3 gem installation process. + +#### The `prebuilt` option + +The `prebuilt=none|only` option can be used to either prevent binary package matching and installation (`prebuilt=none`) +or make binary package installation mandatory (`prebuilt=only`). + +The following command therefor forces a wxRuby3 source installation and will never fail: + +```shell +gem install wxruby3 -- prebuilt=none +``` + +And the following command will force binary package installation and fails if no matching package could be installed: + +```shell +gem install wxruby3 -- prebuilt=only +``` + +#### The `package` option + +The `package=URL` option can be used to explicitly specify a binary package to install. This option implies `prebuilt=only`. +No package matching will be performed so mismatched binary packages will cause wxRuby3 to fail after installation.
+The `URL` can be specified as: +- an absolute local path like `/path/to/binary/package.pkg` +- an absolute `file://` URI like `file:///path/to/binary/package.pkg` +- an `http://` or `https://` URL + +In all cases the associated `.sha` file must be located at the same path as the package file itself. If not the +installation will fail as well as when the signature does not match the digest of the package contents. + +### Gem source setup + +As said a gem-based source installation requires an additional command is to build the actual wxRuby3 extension libraries +for the platform installing on which is a wxRuby3 CLI command installed by the gem: ```shell wxruby setup ``` The wxRuby3 CLI `wxruby` is installed by all wxRuby3 gems. In case of the source gem initially the CLI will provide only -a single command `wxruby setup` to finish wxRuby3 extension (build and) installation. +the commands `wxruby setup` (to finish wxRuby3 extension installation) and `wxruby check`. For most (user) installations the default setup command as shown above will suffice nicely. In this case the setup (or installation) procedure will analyze the system to see if it meets the software requirements described above and if not @@ -184,7 +300,7 @@ The initial message shown (between lines starting with '---' ) is indicative of on options passed to the setup command.
Building the wxRuby3 native extensions and generating reference documentation will always happen. -### Disable prompting for automatic install +#### Disable prompting for automatic install To prevent having the setup procedure asking consent the setup procedure can be started with the `--autoinstall` option like this: @@ -195,7 +311,7 @@ wxruby setup --autoinstall Note that on Linux that may still present a prompt in case the `sudo` command requires a password. -### Prevent automatic installation of software requirements +#### Prevent automatic installation of software requirements To prevent the setup procedure from considering to automatically install (with or without prompting) any missing software requirements the setup procedure can be started with the `--no-autoinstall` option like this: @@ -207,7 +323,7 @@ wxruby setup --no-autoinstall The setup procedure will still analyze the system for available software requirements and if it finds any missing it will end the procedure and show a message of what it found missing. -### Force embedded wxWidgets installation +#### Force embedded wxWidgets installation To prevent the setup procedure of using any system installed wxWidgets version the setup procedure can be started with the `--with-wxwin` option like this: @@ -218,7 +334,7 @@ wxruby setup --with-wxwin This will force the setup procedure to build and install an embedded wxWidgets version for wxRuby3. -### Setup with user installed wxWidgets +#### Setup with user installed wxWidgets In case of a (custom) user installation of wxWidgets the `--wxwin` (and optionally `--wxxml`) option(s) can be used to start the setup procedure to build for this installation like this: @@ -241,7 +357,7 @@ wxruby setup --wxwin=/my/custom/wxWidgets --wxxml=/my/alternate/wxWidgets/xml > responsible for making sure the wxRuby3 extension library can find the wxWidgets libraries at runtime (normally this > requires updating the standard shared library search path for the platform). -### Setup with customized tool paths +#### Setup with customized tool paths If for whatever reason the required development tools `doxygen`, `swig` and/or `git` have been installed in a location not in the standard executable search path the full path to these tools can be passed on the setup procedure using the @@ -251,7 +367,7 @@ not in the standard executable search path the full path to these tools can be p wxruby setup --doxygen=/my/path/to/doxygen ``` -### Redirect log to customized path +#### Redirect log to customized path The setup procedure will log full build results to a file setup.log at the location where the gem contents is stored. If the setup fails the error message will display the log file location and by default if the setup succeeds the log @@ -364,7 +480,7 @@ Checkout the wxRuby3 sources from [GitHub](https://github.com/mcorino/wxRuby3) o Requirements are the same as for installing the source gem. Gem dependencies are listed in the Gemfile in the root of the wxRuby3 tree and should be installed by executing `bundle install`.
To be able to generate HTML documentation the optional `:documentation` group should be included.
-To be able to run the Rake memory check task the option `:develop` group should be included. +To be able to run the Rake memory check task the optional `:develop` group should be included. The wxRuby3 project provides a Rake based build system. Call `rake help` to get an overview of the available commands. As mentioned there the `rake configure` command is required as the very first command. Call `rake configure[--help]` to @@ -376,4 +492,7 @@ commands are executed using parallel task execution by default. When the build has finished without errors the regression tests can be run by calling `rake test`. +After successfully building the wxRuby3 extension libraries (and possibly embedded wxWidgets libraries) a binary package +can be created by call `rake binpkg`. + For more details concerning the wxRuby3 development strategy and build options see [here](TODO). diff --git a/README.md b/README.md index 3911c6af..3ccc4850 100644 --- a/README.md +++ b/README.md @@ -96,11 +96,11 @@ of these products. Currently the following are fully supported: -| Platform | Ruby version(s) | wxWidgets version(s) | -|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|----------------------| -| Windows 10 (tested)
(most likely also Windows 11) | Ruby >= 2.5
(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 | -| Linux (tested; all major AMD-64 distributions: Ubuntu, Debian, Fedora, OpenSuSE and ArchLinux)
(most likely also i686 and ARM) | Ruby >= 2.5 | wxWidgets >= 3.2 | -| MacOS >= 10.10 using Cocoa (tested on AMD-64 and ARM64 M2 Chip) | Ruby >= 2.5 (MacPorts, Homebrew, ruby-install, RVM) | wxWidgets >= 3.2 | +| Platform | Ruby version(s) | wxWidgets version(s) | +|------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|----------------------| +| Windows 10 (tested)
(most likely also Windows 11) | Ruby >= 2.5
(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 | +| Linux (tested; all major AMD64 and ARM64 distributions: Ubuntu, Debian, Fedora, OpenSuSE and ArchLinux)
(most likely also i686) | Ruby >= 2.5 | wxWidgets >= 3.2 | +| MacOS >= 10.10 using Cocoa (tested on AMD64 and ARM64 M1/M2 Chip) | Ruby >= 2.5 (MacPorts, Homebrew, ruby-install, RVM) | wxWidgets >= 3.2 | Support for other platforms is not being actively developed at present, but patches are welcome. It is likely to be much simpler to get wxRuby @@ -109,43 +109,49 @@ on legacy systems (eg Windows 98, Mac OS 9). ### How can I install wxRuby3? -wxRuby3 is distributed as a Ruby gem on [RubyGems](https://rubygems.org).
-Apart from a regular source-only version of the gem there is also a binary gem version for Windows 10 provided (for the -latest stable Ruby release at the time of publishing) which includes an embedded wxWidgets installation (also latest -stable version). +wxRuby3 is distributed as a Ruby gem on [RubyGems](https://rubygems.org). This gem can also be downloaded from the release +assets on [Github](https://github.com/mcorino/wxRuby3/releases). The wxRuby3 gem provides a **worry-free** installation procedure for all supported platforms. -Installing the binary gem version on Windows (which is the default when installing for the latest stable Ruby release for -that platform) requires no additional installation steps and/or additional software to be installed except for a supported -version of the Ruby interpreter. So for this platform the following command is all it takes to get up and running: +Installing the gem requires no additional installation steps and/or additional software to be installed except for a +supported version of the Ruby interpreter. So the following command is all it takes to install: ```shell gem install wxruby3 ``` -For the platforms requiring a source based installation (Linux and MacOSX as well as Windows for older Ruby releases -or when explicitly selecting source based install) an additional (simple) setup step is required to finish installation. -For these platforms the full installation sequence would be: +The wxRuby3 installation procedure will check the availability of a, prebuilt, binary package matching the platform +being installed on and if found will download and install that package resulting in a ready-to-run wxRuby3 installation.
+If no matching package is found the installation reverts to a source installation which will require an additional setup +step to finalize the wxRuby3 installation by executing the following command: ```shell -gem install wxruby3 && wxruby setup +wxruby setup ``` -The second part of this command sequence is a fully automated setup procedure provided by the wxRuby3 **CLI** installed with -the gem. This procedure (by default) will analyze your system and install (after asking your consent) any missing software -requirements and build the wxRuby3 extension libraries (including a embedded copy of wxWidgets if necessary). It may take -quite a while depending on your system but you can mostly sit back and relax. +This last command is a fully automated setup procedure provided by the wxRuby3 **CLI** installed with the gem. This +procedure (by default) will analyze your system and install (after asking your consent) any missing software +requirements and build the wxRuby3 extension libraries (including a embedded copy of wxWidgets if necessary). It may +take quite a while depending on your system but you can mostly sit back and relax. > **NOTE**
> A source based installation requires the availability of the Ruby development headers. User installed Rubies in most cases > will already include those but (especially on Linux) system installed Rubies may require having an additional '-dev/-devel' -> package installed. +> package installed (although actually you may already have needed those to install the gems that the wxRuby3 gem depends +> on like the nokogiri gem). + +The wxRuby3 CLI also provides a 'check' command with which the runtime status of the wxRuby3 installation can be checked +at any time. By default running `wxruby check` will display a message reporting the runtime and suggestions on finalizing +the installation if not finalized yet. No message is displayed if wxRuby3 is ready to run. Run `wxruby check -h` for +details concerning this command. + +A selection of (prebuilt) binary packages is provided as release assets on [Github](https://github.com/mcorino/wxRuby3/releases). +See the [INSTALL](INSTALL.md#binary-packages) document for more details. This install procedure can of course be tweaked and customized with commandline arguments. See the [INSTALL](INSTALL.md) document for more details. - ### Where can I ask a question, or report a bug? Use GitHUb Issues. From ed4eb52dcbb8a51c06c56f53c3a948800e683bf6 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 18:51:28 +0100 Subject: [PATCH 158/168] fix linebreak --- lib/wx/doc/extra/14_config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wx/doc/extra/14_config.md b/lib/wx/doc/extra/14_config.md index dd37eee4..27f75c62 100644 --- a/lib/wx/doc/extra/14_config.md +++ b/lib/wx/doc/extra/14_config.md @@ -87,7 +87,7 @@ Another difference is that {Wx::Config} will not automatically create missing gr happen when writing configuration values. A last difference is that the default support is by default backed up by persistent storage (windows registry or file) and -the wxRuby enhanced support only provides in-memory storage (`Hash` instance) by default. + +the wxRuby enhanced support only provides in-memory storage (`Hash` instance) by default.
Persisting configuration data from {Wx::Config} will require coding customized storage and retrieval operations (which is trivial using standard YAML or JSON support). From 6f10a42a37bc5f33f78f48ca7f4b987f2e914f7f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 22 Feb 2024 19:01:30 +0100 Subject: [PATCH 159/168] fix bullet list --- lib/wx/doc/extra/02_lifecycles.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/wx/doc/extra/02_lifecycles.md b/lib/wx/doc/extra/02_lifecycles.md index dcd9bd42..30ce8ae2 100644 --- a/lib/wx/doc/extra/02_lifecycles.md +++ b/lib/wx/doc/extra/02_lifecycles.md @@ -155,12 +155,12 @@ There are however quite a lot of wrapped native objects in wxRuby for which *obj object tracking has been disabled for their classes. This means these kind of classes/object should **not** be derived from (if even possible and/or useful) to add functionality/information or their identity used as key to link other information.
These classes include: -* classes considered POD types like Wx::Size, Wx::Point, Wx::RealPoint, Wx::Rect, Wx::GBSpan, Wx::GBPosition, Wx::BusyInfoFlags, +- classes considered POD types like Wx::Size, Wx::Point, Wx::RealPoint, Wx::Rect, Wx::GBSpan, Wx::GBPosition, Wx::BusyInfoFlags, Wx::AboutDialogInfo -* final non-instantiatable classes like the Wx::DC (Device Context) class family, Wx::GraphicsContext, Wx::WindowsDisabler, +- final non-instantiatable classes like the Wx::DC (Device Context) class family, Wx::GraphicsContext, Wx::WindowsDisabler, Wx::EventBlocker, Wx::BusyInfo -* classes with native singleton objects like Wx::Clipboard -* the reference counted GDI objects like Wx::Pen, Wx::Brush, Wx::Colour, Wx::Cursor, Wx::Bitmap, Wx::Icon and similar +- classes with native singleton objects like Wx::Clipboard +- the reference counted GDI objects like Wx::Pen, Wx::Brush, Wx::Colour, Wx::Cursor, Wx::Bitmap, Wx::Icon and similar reference counted objects like Wx::Font The reference documentation will note untracked object classes. From e0286d1b3337f921887ad1c706b0cf1e9c562004 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 23 Feb 2024 10:16:57 +0100 Subject: [PATCH 160/168] add output typemaps to make to always copy value objects like wxPoint and wxSize --- rakelib/lib/typemap/common.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rakelib/lib/typemap/common.rb b/rakelib/lib/typemap/common.rb index 2e88fe58..7e1f1800 100644 --- a/rakelib/lib/typemap/common.rb +++ b/rakelib/lib/typemap/common.rb @@ -262,6 +262,16 @@ module Common end + # output typemaps for common value objects like wxPoint, wxSize, wxRect and wxRealPoint, + # making sure to ALWAYS create managed copies + %w[Point Size Rect RealPoint].each do |klass| + map "const wx#{klass}&", "const wx#{klass}*", as: "Wx::#{klass}" do + map_out code: <<~__CODE + $result = SWIG_NewPointerObj((new wx#{klass}(*static_cast< const wx#{klass}* >($1))), SWIGTYPE_p_wx#{klass}, SWIG_POINTER_OWN); + __CODE + end + end + # Integer <> wxItemKind type mappings map 'wxItemKind' => 'Integer' do From 67bbc9bda54fee2b63b763642e3b4168167e895f Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 23 Feb 2024 15:01:04 +0100 Subject: [PATCH 161/168] fix scope 'end' gen --- rakelib/lib/generate/doc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/generate/doc.rb b/rakelib/lib/generate/doc.rb index c8fe645a..f50b9ee6 100644 --- a/rakelib/lib/generate/doc.rb +++ b/rakelib/lib/generate/doc.rb @@ -713,9 +713,9 @@ def run gen_class_doc(fdoc) unless no_gen?(:classes) end package.all_modules.each do |_| + mod_indent -= 1 fdoc.puts fdoc.iputs('end', mod_indent) - mod_indent -= 1 end end end From 0115bd75f935ef13842fe72fa32b0950468a53c3 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 23 Feb 2024 15:01:26 +0100 Subject: [PATCH 162/168] add support for Wx::SecretStore --- lib/wx/core/secret_store.rb | 18 +++++ lib/wx/doc/secret_store.rb | 29 ++++++++ rakelib/lib/director/secret_store.rb | 77 ++++++++++++++++++++++ rakelib/lib/generate/doc/secret_store.yaml | 47 +++++++++++++ rakelib/lib/specs/interfaces.rb | 1 + 5 files changed, 172 insertions(+) create mode 100644 lib/wx/core/secret_store.rb create mode 100644 lib/wx/doc/secret_store.rb create mode 100644 rakelib/lib/director/secret_store.rb create mode 100644 rakelib/lib/generate/doc/secret_store.yaml diff --git a/lib/wx/core/secret_store.rb b/lib/wx/core/secret_store.rb new file mode 100644 index 00000000..aba42369 --- /dev/null +++ b/lib/wx/core/secret_store.rb @@ -0,0 +1,18 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +module Wx + + class SecretStore + + # Wipes the secret data. + def self.wipe(secret) + if ::String === secret + secret.bytesize.times { |i| secret.setbyte(i, 0) } + end + end + + end + +end diff --git a/lib/wx/doc/secret_store.rb b/lib/wx/doc/secret_store.rb new file mode 100644 index 00000000..fade26a3 --- /dev/null +++ b/lib/wx/doc/secret_store.rb @@ -0,0 +1,29 @@ +# :stopdoc: +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. +# :startdoc: + + +module Wx + + class SecretStore + + # Wipes the secret data. + # @param [String] secret string containing secret data + # @return [void] + def self.wipe(secret); end + + end + + class SecretValue + + # Returns a copy of the secret data. + # Be aware this is binary data and may contain embedded NUL characters. + # For more security {Wx::SecretStore.wipe} should be used to wipe the secret data after use. + # @return [String] secret data + def get_data; end + + end + +end diff --git a/rakelib/lib/director/secret_store.rb b/rakelib/lib/director/secret_store.rb new file mode 100644 index 00000000..66240fce --- /dev/null +++ b/rakelib/lib/director/secret_store.rb @@ -0,0 +1,77 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +### +# wxRuby3 wxWidgets interface director +### + +module WXRuby3 + + class Director + + class SecretStore < Director + + def setup + super + spec.items << 'wxSecretValue' + spec.gc_as_untracked # don't even track SecretStore and SecretValue objects + # there is no possibility of SecretStore derivatives + # not least because wxRuby only ever allows a single global SecretStore + spec.disable_proxies + spec.make_abstract 'wxSecretStore' + + spec.ignore 'wxSecretValue::wxSecretValue(size_t, const void *)', + 'wxSecretValue::GetAsString', + 'wxSecretValue::GetSize', + 'wxSecretValue::Wipe', + 'wxSecretValue::WipeString' + # customize GetData + spec.ignore 'wxSecretValue::GetData' + spec.map 'const void*' => 'String', swig: false do + map_out code: '' + end + spec.add_extend_code 'wxSecretValue', <<~__HEREDOC + VALUE get_data() + { + size_t sz = $self->GetSize(); + const void* data = $self->GetData(); + return rb_str_new(static_cast(data), sz); + } + __HEREDOC + + # customize GetDefault + spec.ignore 'wxSecretStore::GetDefault', ignore_doc: false + spec.add_extend_code 'wxSecretStore', <<~__HEREDOC + static VALUE get_default() + { + wxSecretStore* result = new wxSecretStore(wxSecretStore::GetDefault()); + return SWIG_NewPointerObj(result, SWIGTYPE_p_wxSecretStore, SWIG_POINTER_OWN); + } + __HEREDOC + spec.map 'wxString *errmsg' => 'String' do + map_in ignore: true, temp: 'wxString tmp', code: '$1 = &tmp;' + map_argout code: <<~__CODE + if ($result == Qfalse) + { + $result = SWIG_Ruby_AppendOutput($result, WXSTR_TO_RSTR(tmp$argnum)); + } + __CODE + end + spec.map 'wxString& username' => 'String' do + map_in ignore: true, temp: 'wxString tmp', code: '$1 = &tmp;' + map_argout code: <<~__CODE + if ($result == Qtrue) + { + $result = SWIG_Ruby_AppendOutput($result, WXSTR_TO_RSTR(tmp$argnum)); + } + __CODE + end + spec.map_apply 'wxString&' => 'const wxString&' + end + + end # class SecretStore + + end # class Director + +end # module WXRuby3 diff --git a/rakelib/lib/generate/doc/secret_store.yaml b/rakelib/lib/generate/doc/secret_store.yaml new file mode 100644 index 00000000..3687294f --- /dev/null +++ b/rakelib/lib/generate/doc/secret_store.yaml @@ -0,0 +1,47 @@ +--- +:wxSecretStore: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /\!store\..*Save.*username.*password\)/ + :replace: | + + ```ruby + store = Wx::SecretStore.get_default + rc, err = store.ok? + if rc + unless store.save('MyApp/MyService', username, password) + Wx.log_warning('Failed to save credentials to the system secret store.') + end + else + Wx.log_warning("This system doesn't support storing passwords securely (#{err}).") + end + ``` + - :pattern: !ruby/regexp /store\..*Load.*username.*password\)/ + :replace: | + + ```ruby + store = Wx::SecretStore.get_default + rc, _ = store.ok? + if rc + password = Wx::SecretValue.new + rc, username = store.load('MyApp/MyService', password) + if rc + # ... use the password ... + end + end + ``` +:wxSecretStore.IsOk: + :brief: + :replace: + :text: | + Check if this object can actually be used. + Returns true if the object can be used. + Returns false and an error message describing the reason if not. + +:wxSecretStore.Load: + :detail: + :post: + - :pattern: !ruby/regexp /Otherwise\s+the\s+function.*arguments\./ + :subst: | + Otherwise the function returns true and the username and updates the provided password argument. diff --git a/rakelib/lib/specs/interfaces.rb b/rakelib/lib/specs/interfaces.rb index aa2e0335..e56ba944 100644 --- a/rakelib/lib/specs/interfaces.rb +++ b/rakelib/lib/specs/interfaces.rb @@ -233,6 +233,7 @@ module WXRuby3 Director.Spec(pkg, 'wxPersistenceManager', requirements: %w[USE_CONFIG]) Director.Spec(pkg, 'wxPersistentObject', requirements: %w[USE_CONFIG]) Director.Spec(pkg, 'wxPersistentWindow', requirements: %w[USE_CONFIG]) + Director.Spec(pkg, 'wxSecretStore', requirements: %w[USE_SECRETSTORE]) } Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg| From d549c0cb91f1e0ca7039cf908fbb6772cd3b8b8c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Fri, 23 Feb 2024 16:53:58 +0100 Subject: [PATCH 163/168] fix type mapping for username arg of SecretStore#save --- rakelib/lib/director/secret_store.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rakelib/lib/director/secret_store.rb b/rakelib/lib/director/secret_store.rb index 66240fce..fd3508e9 100644 --- a/rakelib/lib/director/secret_store.rb +++ b/rakelib/lib/director/secret_store.rb @@ -67,7 +67,12 @@ def setup } __CODE end - spec.map_apply 'wxString&' => 'const wxString&' + # the type matching of the username argument is tricky here since there only is the const difference + # have to explicitly overrule here for Save() incl. explicitly negating the argout mapping + spec.map 'const wxString& username' => 'String' do + map_in temp: 'wxString tmp', code: 'tmp = RSTR_TO_WXSTR($input); $1 = &tmp;' + map_argout by_ref: true + end end end # class SecretStore From 0ded99dbab1075ffeb41d68b3133b8f3f9dc9d3c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 24 Feb 2024 14:01:23 +0100 Subject: [PATCH 164/168] fix SecretStore support --- lib/wx/doc/secret_store.rb | 11 +++++++-- rakelib/lib/director/secret_store.rb | 35 ++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/lib/wx/doc/secret_store.rb b/lib/wx/doc/secret_store.rb index fade26a3..962bcf2e 100644 --- a/lib/wx/doc/secret_store.rb +++ b/lib/wx/doc/secret_store.rb @@ -18,12 +18,19 @@ def self.wipe(secret); end class SecretValue - # Returns a copy of the secret data. - # Be aware this is binary data and may contain embedded NUL characters. + # Returns a copy of the secret data as an ASCII-8BIT encoded String. + # Be aware this could be binary data and may contain embedded NUL characters. # For more security {Wx::SecretStore.wipe} should be used to wipe the secret data after use. # @return [String] secret data def get_data; end + # Returns a copy of the secret data as an UTF-8 encoded String. + # Make sure to use this method only if sure that the secret originally stored was indeed + # UTF-8 data as otherwise the returned string will not match the stored data. + # For more security {Wx::SecretStore.wipe} should be used to wipe the secret data after use. + # @return [String] secret data + def get_as_string; end + end end diff --git a/rakelib/lib/director/secret_store.rb b/rakelib/lib/director/secret_store.rb index fd3508e9..2562a5de 100644 --- a/rakelib/lib/director/secret_store.rb +++ b/rakelib/lib/director/secret_store.rb @@ -21,13 +21,33 @@ def setup spec.disable_proxies spec.make_abstract 'wxSecretStore' - spec.ignore 'wxSecretValue::wxSecretValue(size_t, const void *)', - 'wxSecretValue::GetAsString', + spec.include 'ruby/encoding.h' + + spec.ignore 'wxSecretValue::GetAsString', 'wxSecretValue::GetSize', + 'wxSecretValue::GetData', 'wxSecretValue::Wipe', 'wxSecretValue::WipeString' + # customize ctor + spec.ignore 'wxSecretValue::wxSecretValue(const wxString&)', ignore_doc: false + spec.regard 'wxSecretValue::wxSecretValue(size_t, const void *)', regard_doc: false + spec.map 'size_t size, const void *data' do + map_in from: {type: 'String', index: 1}, temp: 'wxScopedCharBuffer tmp', code: <<~__CODE + if (RTEST($input) && TYPE($input) == T_STRING) + { + $1 = RSTRING_LEN($input); + $2 = (void*)StringValuePtr($input); + } + else + { + rb_raise(rb_eArgError, "Expected String for #0"); + } + __CODE + + map_typecheck precedence: 'pointer', code: '$1 = (TYPE($input) == T_STRING);' + end + # customize GetData - spec.ignore 'wxSecretValue::GetData' spec.map 'const void*' => 'String', swig: false do map_out code: '' end @@ -36,7 +56,14 @@ def setup { size_t sz = $self->GetSize(); const void* data = $self->GetData(); - return rb_str_new(static_cast(data), sz); + return rb_enc_str_new(static_cast(data), sz, rb_ascii8bit_encoding()); + } + + VALUE get_as_string() + { + size_t sz = $self->GetSize(); + const void* data = $self->GetData(); + return rb_utf8_str_new(static_cast(data), sz); } __HEREDOC From 624de4274224d8dbc307a4e4e0c1ae1b2befe68c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 24 Feb 2024 14:02:51 +0100 Subject: [PATCH 165/168] add SecretStore test --- tests/test_secret_store.rb | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_secret_store.rb diff --git a/tests/test_secret_store.rb b/tests/test_secret_store.rb new file mode 100644 index 00000000..2cd5f4ce --- /dev/null +++ b/tests/test_secret_store.rb @@ -0,0 +1,51 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +require_relative './lib/wxapp_runner' + +require 'digest' + +class TestSecretStore < Test::Unit::TestCase + + unless is_ci_build? + + def test_store + if Wx.has_feature?(:USE_SECRETSTORE) + state, err = Wx::SecretStore.get_default.ok? + if state + puts "SecretStore OK" + + password = Digest::SHA256.digest('My Secret Password!') + secret_val = Wx::SecretValue.new(password) + assert_true(Wx::SecretStore.get_default.save('My/Service', 'a_user', secret_val)) + + secret_val2 = Wx::SecretValue.new + rc, user = Wx::SecretStore.get_default.load('My/Service', secret_val2) + assert_true(rc) + assert_equal('a_user', user) + assert_equal(secret_val, secret_val2) + assert_equal(password, secret_val2.get_data) + + password = 'My Secret Password!' + secret_val = Wx::SecretValue.new(password) + assert_true(Wx::SecretStore.get_default.save('My/Service', 'a_user', secret_val)) + + secret_val2 = Wx::SecretValue.new + rc, user = Wx::SecretStore.get_default.load('My/Service', secret_val2) + assert_true(rc) + assert_equal('a_user', user) + assert_equal(secret_val, secret_val2) + assert_equal(password, secret_val2.get_as_string) + + else + puts "Default SecretStore not usable : #{err}" + end + else + puts 'Wx::SecretStore not available' + end + end + + end + +end From 717d5c029a3a85bc22e719bcd3cd6b7696f918cd Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 24 Feb 2024 16:02:28 +0100 Subject: [PATCH 166/168] add note for SecretValue doc --- rakelib/lib/generate/doc/secret_store.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rakelib/lib/generate/doc/secret_store.yaml b/rakelib/lib/generate/doc/secret_store.yaml index 3687294f..259125f0 100644 --- a/rakelib/lib/generate/doc/secret_store.yaml +++ b/rakelib/lib/generate/doc/secret_store.yaml @@ -45,3 +45,11 @@ - :pattern: !ruby/regexp /Otherwise\s+the\s+function.*arguments\./ :subst: | Otherwise the function returns true and the username and updates the provided password argument. + +:wxSecretValue: + :detail: + :post: + - :pattern: !ruby/regexp /\s+\Z/ + :subst: | + + @note Due to a bug using binary secrets will not work for wxWidgets<=3.2.4. This has been fixed for later versions. From 5c397b80059592fe0f62e4acbffe338e9c6c1b26 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 27 Feb 2024 09:20:59 +0100 Subject: [PATCH 167/168] improve SecretValue support and docs --- lib/wx/core/secret_store.rb | 20 ++++++++++++ lib/wx/doc/secret_store.rb | 19 ++++++++++++ rakelib/lib/director/secret_store.rb | 36 +++++++++++++--------- rakelib/lib/generate/doc/secret_store.yaml | 2 +- tests/test_secret_store.rb | 32 ++++++++++++++++++- 5 files changed, 93 insertions(+), 16 deletions(-) diff --git a/lib/wx/core/secret_store.rb b/lib/wx/core/secret_store.rb index aba42369..031aa081 100644 --- a/lib/wx/core/secret_store.rb +++ b/lib/wx/core/secret_store.rb @@ -15,4 +15,24 @@ def self.wipe(secret) end + class SecretValue + + # Redefine the initialize method to auto-convert UTF-16/-32 strings to UTF-8 if possible. + wx_init = self.instance_method(:initialize) + define_method(:initialize) do | *args | + if args.size == 1 && ::String === args.first + unless args.first.encoding == ::Encoding::UTF_8 || args.first.encoding == ::Encoding::ASCII_8BIT + # convert in place unless frozen + if !args.first.frozen? + args.first.encode!(::Encoding::UTF_8) rescue nil + else # create converted copy + (args = [args.first.encode(::Encoding::UTF_8)]) rescue nil + end + end + end + wx_init.bind(self).call(*args) + end + + end + end diff --git a/lib/wx/doc/secret_store.rb b/lib/wx/doc/secret_store.rb index 962bcf2e..838c0f86 100644 --- a/lib/wx/doc/secret_store.rb +++ b/lib/wx/doc/secret_store.rb @@ -18,6 +18,25 @@ def self.wipe(secret); end class SecretValue + # @overload initialize() + # Creates an empty secret value (not the same as an empty password). + # @return [Wx::SecretValue] + # @overload initialize(secret) + # Creates a secret value from the given string. + # The secret argument may contain NUL bytes. + # Any UTF-8 encoded (or encodable; wxRuby will attempt re-encoding as UTF-8 for any string not encoded UTF-8 or ASCII-8BIT) string will be stored as UTF-8 encoded string. + # In these cases use {#get_as_string} if needing to compare the original string to a restored string. + # Otherwise the string will be stored as ASCII-8BIT encoded string. + # In these cases use {#get_data} if needing to compare the original string to a restored string. + # See {#==} for comparing secret values opaquely. + # @param secret [String] + # @return [Wx::SecretValue] + # @overload initialize(other) + # Creates a copy of an existing secret. + # @param other [Wx::SecretValue] + # @return [Wx::SecretValue] + def initialize(*args) end + # Returns a copy of the secret data as an ASCII-8BIT encoded String. # Be aware this could be binary data and may contain embedded NUL characters. # For more security {Wx::SecretStore.wipe} should be used to wipe the secret data after use. diff --git a/rakelib/lib/director/secret_store.rb b/rakelib/lib/director/secret_store.rb index 2562a5de..205f455a 100644 --- a/rakelib/lib/director/secret_store.rb +++ b/rakelib/lib/director/secret_store.rb @@ -27,25 +27,33 @@ def setup 'wxSecretValue::GetSize', 'wxSecretValue::GetData', 'wxSecretValue::Wipe', - 'wxSecretValue::WipeString' - # customize ctor - spec.ignore 'wxSecretValue::wxSecretValue(const wxString&)', ignore_doc: false - spec.regard 'wxSecretValue::wxSecretValue(size_t, const void *)', regard_doc: false - spec.map 'size_t size, const void *data' do - map_in from: {type: 'String', index: 1}, temp: 'wxScopedCharBuffer tmp', code: <<~__CODE - if (RTEST($input) && TYPE($input) == T_STRING) + 'wxSecretValue::WipeString', + 'wxSecretValue::wxSecretValue(const wxString&)', + 'wxSecretValue::wxSecretValue(size_t, const void *)' + spec.regard 'wxSecretValue::wxSecretValue()', + 'wxSecretValue::wxSecretValue(const wxSecretValue&)', + regard_doc: false + # customize string arg ctor + spec.add_extend_code 'wxSecretValue', <<~__HEREDOC + wxSecretValue(VALUE secret_string) + { + if (RTEST(secret_string) && TYPE(secret_string) == T_STRING) { - $1 = RSTRING_LEN($input); - $2 = (void*)StringValuePtr($input); + if (ENCODING_GET(secret_string) == rb_utf8_encindex()) + { + return new wxSecretValue(RSTR_TO_WXSTR(secret_string)); + } + else + { + return new wxSecretValue(RSTRING_LEN(secret_string), (void*)StringValuePtr(secret_string)); + } } else { - rb_raise(rb_eArgError, "Expected String for #0"); + rb_raise(rb_eArgError, "Expected String or Wx::SecretValue for #0"); } - __CODE - - map_typecheck precedence: 'pointer', code: '$1 = (TYPE($input) == T_STRING);' - end + } + __HEREDOC # customize GetData spec.map 'const void*' => 'String', swig: false do diff --git a/rakelib/lib/generate/doc/secret_store.yaml b/rakelib/lib/generate/doc/secret_store.yaml index 259125f0..0f8d3ee7 100644 --- a/rakelib/lib/generate/doc/secret_store.yaml +++ b/rakelib/lib/generate/doc/secret_store.yaml @@ -52,4 +52,4 @@ - :pattern: !ruby/regexp /\s+\Z/ :subst: | - @note Due to a bug using binary secrets will not work for wxWidgets<=3.2.4. This has been fixed for later versions. + @note Due to a bug using binary secrets will not work for WXGTK wxWidgets<=3.2.4 (WXOSX and WXMSW work fine). This has been fixed for later versions. diff --git a/tests/test_secret_store.rb b/tests/test_secret_store.rb index 2cd5f4ce..82e521ea 100644 --- a/tests/test_secret_store.rb +++ b/tests/test_secret_store.rb @@ -16,7 +16,11 @@ def test_store if state puts "SecretStore OK" - password = Digest::SHA256.digest('My Secret Password!') + if Wx::WXWIDGETS_VERSION > '3.2.4' + password = Digest::SHA256.digest('My Secret Password!') + else + password = Digest::SHA256.hexdigest('My Secret Password!') # binary secrets does not work + end secret_val = Wx::SecretValue.new(password) assert_true(Wx::SecretStore.get_default.save('My/Service', 'a_user', secret_val)) @@ -38,6 +42,32 @@ def test_store assert_equal(secret_val, secret_val2) assert_equal(password, secret_val2.get_as_string) + password = 'My Secret Password!'.encode('UTF-16') + secret_val = Wx::SecretValue.new(password) + assert_true(Wx::SecretStore.get_default.save('My/Service', 'a_user', secret_val)) + + secret_val2 = Wx::SecretValue.new + rc, user = Wx::SecretStore.get_default.load('My/Service', secret_val2) + assert_true(rc) + assert_equal('a_user', user) + assert_equal(secret_val, secret_val2) + assert_equal(password, secret_val2.get_as_string) + assert_not_equal('My Secret Password!'.encode('UTF-16'), secret_val2.get_as_string) + assert_equal('My Secret Password!'.encode('UTF-16'), secret_val2.get_as_string.encode('UTF-16')) + + password = 'My Secret Password!'.encode('UTF-32') + secret_val = Wx::SecretValue.new(password) + assert_true(Wx::SecretStore.get_default.save('My/Service', 'a_user', secret_val)) + + secret_val2 = Wx::SecretValue.new + rc, user = Wx::SecretStore.get_default.load('My/Service', secret_val2) + assert_true(rc) + assert_equal('a_user', user) + assert_equal(secret_val, secret_val2) + assert_equal(password, secret_val2.get_as_string) + assert_not_equal('My Secret Password!'.encode('UTF-32'), secret_val2.get_as_string) + assert_equal('My Secret Password!'.encode('UTF-32'), secret_val2.get_as_string.encode('UTF-32')) + else puts "Default SecretStore not usable : #{err}" end From 2f113e1e8718bb21df42f274f78e2332bfbb82e6 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 27 Feb 2024 09:21:47 +0100 Subject: [PATCH 168/168] bump version --- lib/wx/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wx/version.rb b/lib/wx/version.rb index 688ce705..6c4f707e 100644 --- a/lib/wx/version.rb +++ b/lib/wx/version.rb @@ -3,5 +3,5 @@ # This software is released under the MIT license. module Wx - WXRUBY_VERSION = '0.9.7' + WXRUBY_VERSION = '0.9.8' end