Skip to content

Commit

Permalink
Test external set shell
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 9, 2024
1 parent 551e859 commit 9d15843
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 8 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/rtools-make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Windows Rtools40

on:
pull_request:
branches: [ develop, master ]
push:
branches: [ tbb-sh-check ]
paths-ignore:
- 'doygen/**'
- 'hooks/**'
- 'licenses/**'
- 'LICENSE.md'
- 'README.md'
- 'RELEASE-NOTES.txt'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
rtools-build-check:
runs-on: windows-latest
name: R ${{ matrix.config.r }} with Rtools ${{ matrix.config.rtools }}

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: '4.3.2', rtools: '43', path: 'C:/rtools43/x86_64-w64-mingw32.static.posix/bin;C:/rtools43/usr/bin'}
- {os: windows-latest, r: '4.2.3', rtools: '42', path: 'C:/rtools42/x86_64-w64-mingw32.static.posix/bin;C:/rtools42/usr/bin'}
- {os: windows-latest, r: '4.1.3', rtools: '40', path: 'C:/rtools40/mingw64/bin;C:/rtools40/usr/bin'}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
rtools-version: ${{ matrix.config.rtools }}

- name: Set path for Rtools${{ matrix.config.rtools }}
run: echo "${{ matrix.config.path }}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8

- name: Build Math libs
shell: powershell
run: |
Add-Content make\local "O=1`n"
Add-Content make\local "STAN_THREADS=true`n"
make -f make/standalone math-libs -j2
- name: Add TBB to PATH
shell: powershell
run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8

- name: Run prim and rev unit tests
shell: powershell
run: |
python.exe runTests.py -j2 test/unit/*_test.cpp
python.exe runTests.py -j2 test/unit/math/*_test.cpp
python.exe runTests.py -j2 test/unit/math/prim
python.exe runTests.py -j2 test/unit/math/rev
python.exe runTests.py -j2 test/unit/math/memory
- name: Upload gtest_output xml
uses: actions/upload-artifact@v4
if: failure()
with:
name: gtest_outputs_xml
path: '**/*_test.xml'
6 changes: 1 addition & 5 deletions lib/tbb_2020.3/build/windows.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ifeq (true,$(USING_RTOOLS))
export SHELL = sh.exe
else
export SHELL = cmd
endif
export SHELL = cmd

ifdef tbb_build_dir
test_dir:=$(tbb_build_dir)
Expand Down
11 changes: 8 additions & 3 deletions make/libraries
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ ifeq (Windows_NT, $(OS))
ifeq ($(IS_UCRT),true)
TBB_CXXFLAGS += -D_UCRT
endif
USING_RTOOLS := true
ifneq (,$(shell sh --version 2>/dev/null))
WINDOWS_HAS_SH ?= true
endif
ifeq ($(WINDOWS_HAS_SH), true) # Stop TBB makefile changing SHELL on RTools
MAKEOVERRIDES += SHELL=sh.exe
endif
endif

# If brackets or spaces are found in MAKE on Windows
Expand All @@ -163,11 +168,11 @@ endif
$(TBB_BIN)/tbb.def: $(TBB_BIN)/tbb-make-check
@mkdir -p $(TBB_BIN)
touch $(TBB_BIN)/version_$(notdir $(TBB))
USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)"
tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbb" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y CXXFLAGS="$(TBB_CXXFLAGS)"

$(TBB_BIN)/tbbmalloc.def: $(TBB_BIN)/tbb-make-check
@mkdir -p $(TBB_BIN)
USING_RTOOLS=$(USING_RTOOLS) tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)"
tbb_root="$(TBB_RELATIVE_PATH)" CXX="$(CXX)" CC="$(TBB_CC)" LDFLAGS='$(LDFLAGS_TBB)' '$(MAKE)' -C "$(TBB_BIN)" -r -f "$(TBB_ABSOLUTE_PATH)/build/Makefile.tbbmalloc" compiler=$(TBB_CXX_TYPE) cfg=release stdver=c++1y malloc CXXFLAGS="$(TBB_CXXFLAGS)"

$(TBB_BIN)/libtbb.dylib: $(TBB_BIN)/tbb.def
$(TBB_BIN)/libtbbmalloc.dylib: $(TBB_BIN)/tbbmalloc.def
Expand Down

0 comments on commit 9d15843

Please sign in to comment.