diff --git a/.github/workflows/build-installers.yml b/.github/workflows/build-installers.yml new file mode 100644 index 000000000..22ee3b52a --- /dev/null +++ b/.github/workflows/build-installers.yml @@ -0,0 +1,119 @@ +name: Build Installers + +on: + workflow_dispatch: + inputs: + openstudio_version: + description: 'OpenStudio Version (e.g. 3.11.0)' + required: true + default: '3.11.0' + openstudio_version_sha: + description: 'OpenStudio Version SHA (e.g. 241b8abb4d)' + required: true + default: '241b8abb4d' + openstudio_version_ext: + description: 'OpenStudio Version Extension (e.g. -rc1)' + required: false + default: '' + push: + branches: + - master + - develop + pull_request: + +env: + OPENSTUDIO_VERSION: ${{ inputs.openstudio_version || '3.11.0' }} + OPENSTUDIO_VERSION_SHA: ${{ inputs.openstudio_version_sha || '241b8abb4d' }} + OPENSTUDIO_VERSION_EXT: ${{ inputs.openstudio_version_ext || '' }} + +jobs: + build-linux: + runs-on: ubuntu-24.04 + steps: + - name: Delete huge unnecessary tools folder + run: rm -rf /opt/hostedtoolcache + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup + shell: bash + run: ./ci/github-actions/setup.sh + env: + BUILD_TYPE: build + - name: Build Gem Package + shell: bash + run: ./ci/github-actions/export_build_linux.sh + - name: Upload Linux Artifact + uses: actions/upload-artifact@v4 + with: + name: openstudio-server-gems-linux + path: build/NREL/export/*.tar.gz + + build-macos: + runs-on: macos-15-intel # Intel runner required for x86_64 architecture compatibility with OpenStudio (matching the test workflow) + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup + shell: bash + run: ./ci/github-actions/setup.sh + env: + BUILD_TYPE: build + - name: Build Gem Package + shell: bash + run: ./ci/github-actions/export_build_osx.sh + - name: Upload macOS Artifact + uses: actions/upload-artifact@v4 + with: + name: openstudio-server-gems-darwin + path: build/NREL/export/*.tar.gz + + build-macos-arm: + runs-on: macos-15 + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup + shell: bash + run: ./ci/github-actions/setup.sh + env: + BUILD_TYPE: build + - name: Build Gem Package + shell: bash + run: ./ci/github-actions/export_build_osx.sh + - name: Upload macOS ARM Artifact + uses: actions/upload-artifact@v4 + with: + name: openstudio-server-gems-darwin-arm + path: build/NREL/export/*.tar.gz + + build-windows: + runs-on: windows-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.2' + bundler-cache: false # We manage gems manually via openstudio_meta + + - name: Setup Windows Environment + shell: cmd + run: ci\github-actions\setup_win.bat + + - name: Build Gem Package + shell: cmd + env: + BUNDLE_VERSION: 2.4.10 + GEM_HOME: C:\projects\openstudio-server\gems + GEM_PATH: C:\projects\openstudio-server\gems;C:\projects\openstudio-server\gems\bundler\gems + RUBYLIB: C:\projects\openstudio\Ruby + OPENSTUDIO_TEST_EXE: C:\projects\openstudio\bin\openstudio.exe + run: ci\github-actions\export_build_win.bat + + - name: Upload Windows Artifact + uses: actions/upload-artifact@v4 + with: + name: openstudio-server-gems-win32 + path: build/NREL/export/*.tar.gz diff --git a/bin/openstudio_meta b/bin/openstudio_meta index 485f4eeef..9f46241e3 100755 --- a/bin/openstudio_meta +++ b/bin/openstudio_meta @@ -334,9 +334,11 @@ class InstallGems sys_cmds << "#{$ruby_path} #{bundler_bin} config build.libxml-ruby --use-system-libraries --with-xml2-config=/usr/bin/xml2-config" end if options[:test_dev_build] - sys_cmds << "#{$ruby_path} #{bundler_bin} install --retry=3 --jobs=1 --with default development test" + sys_cmds << "#{$ruby_path} #{bundler_bin} config set --local with 'default development test'" + sys_cmds << "#{$ruby_path} #{bundler_bin} install --retry=3 --jobs=1" else - sys_cmds << "#{$ruby_path} #{bundler_bin} install --retry=3 --jobs=1 --without development test" + sys_cmds << "#{$ruby_path} #{bundler_bin} config set --local without 'development test'" + sys_cmds << "#{$ruby_path} #{bundler_bin} install --retry=3 --jobs=1" end sys_cmds << "#{$ruby_path} #{bundler_bin} update" #unless Gem.win_platform? diff --git a/ci/github-actions/export_build_win.bat b/ci/github-actions/export_build_win.bat new file mode 100644 index 000000000..ffd0ee9b8 --- /dev/null +++ b/ci/github-actions/export_build_win.bat @@ -0,0 +1,20 @@ +@echo off +setlocal + +REM Create export directory +if not exist "C:\export" mkdir C:\export + +REM Install Bundler +call gem install bundler -v %BUNDLE_VERSION% --no-document +if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +REM Run Build +call ruby bin\openstudio_meta install_gems --export="C:\export" --debug +if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +REM Move export to workspace for upload +if not exist "build\NREL" mkdir build\NREL +move C:\export build\NREL\export +if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +endlocal diff --git a/ci/github-actions/setup_win.bat b/ci/github-actions/setup_win.bat new file mode 100644 index 000000000..2eaefed59 --- /dev/null +++ b/ci/github-actions/setup_win.bat @@ -0,0 +1,43 @@ +@echo off +setlocal + +REM --- Install OpenStudio --- +set "InstallerName=OpenStudio-%OPENSTUDIO_VERSION%%OPENSTUDIO_VERSION_EXT%+%OPENSTUDIO_VERSION_SHA%-Windows.exe" +set "Url=https://github.com/NREL/OpenStudio/releases/download/v%OPENSTUDIO_VERSION%%OPENSTUDIO_VERSION_EXT%/%InstallerName%" + +echo Downloading %Url%... +powershell -Command "Invoke-WebRequest -Uri '%Url%' -OutFile '%InstallerName%'" +if %ERRORLEVEL% neq 0 ( + echo Failed to download OpenStudio from %Url% (exit code %ERRORLEVEL%) + exit /b %ERRORLEVEL% +) + +echo Installing OpenStudio... +start /wait "" ".\%InstallerName%" /S /D=C:\projects\openstudio +if %ERRORLEVEL% neq 0 ( + echo Failed to install OpenStudio from "%InstallerName%" (exit code %ERRORLEVEL%) + exit /b %ERRORLEVEL% +) + +REM Verify OpenStudio +set "PATH=C:\projects\openstudio\bin;%PATH%" +call openstudio openstudio_version +if %ERRORLEVEL% neq 0 ( + echo Failed to verify OpenStudio installation - 'openstudio openstudio_version' command failed (exit code %ERRORLEVEL%) + exit /b %ERRORLEVEL% +) + +REM --- Setup MSYS2 and Dependencies --- +call ridk install 2 3 +if %ERRORLEVEL% neq 0 ( + echo Failed to install MSYS2 dependencies via ridk (exit code %ERRORLEVEL%) + exit /b %ERRORLEVEL% +) + +call gcc --version +if %ERRORLEVEL% neq 0 ( + echo Error: gcc not found + exit /b %ERRORLEVEL% +) + +endlocal diff --git a/docker/deployment/scripts/deploy_docker_github_actions.sh b/docker/deployment/scripts/deploy_docker_github_actions.sh index 668bd88cb..f3db36444 100755 --- a/docker/deployment/scripts/deploy_docker_github_actions.sh +++ b/docker/deployment/scripts/deploy_docker_github_actions.sh @@ -15,7 +15,7 @@ elif [ "${GITHUB_REF}" == "refs/heads/master" ]; then elif [ "${GITHUB_REF}" == "refs/heads/setup_github_actions" ]; then IMAGETAG=experimental elif [ "${GITHUB_REF}" == "refs/heads/3.11.0" ]; then - IMAGETAG="3.11.0-rc2" + IMAGETAG="3.11.0" fi if [ "${IMAGETAG}" != "skip" ]; then