-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
95 lines (92 loc) · 3.46 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: 'Install Toolchain'
description: 'Install UCRT toolchain to build R/R packages'
inputs:
ucrt3-release:
description: 'release tag for UCRT3'
required: false
default: 'v0.10'
toolchain-type:
description: 'none/base/full toolchain'
required: false
default: none
runs:
using: 'composite'
steps:
# Caching does not pay off (for full toolchain it slows things down)
#
# - name: Cache toolchain
# uses: actions/cache@v2
# env:
# cache-name: cache-toolchain
# with:
# path: ~/x86_64-w64-mingw32.static.posix
# key: ${{ env.cache-name }}-${{ inputs.ucrt3-release }}
- name: Install toolchain
run: |
TYPE="${{ inputs.toolchain-type }}"
TDIR=~/x86_64-w64-mingw32.static.posix
# connectivity can be flaky so allow re-tries
RCURL='curl --retry 4 --retry-all-errors -fsSL'
if [ "${{ runner.os }}" = Windows -a $TYPE != "none" -a -r $TDIR/type ] ; then
# FIXME: add toolchain version check, not only type
CTYPE="`cat $TDIR/type`"
if [ $CTYPE = $TYPE -o $CTYPE = full ] ; then
echo "Re-using cached $CTYPE toolchain."
else
echo "Deleting cached $CTYPE toolchain."
rm -rf $TDIR
fi
fi
if [ "${{ runner.os }}" = Windows -a $TYPE != "none" -a ! -d $TDIR ] ; then
echo "::group::Downloading and installing the toolchain"
TAG="${{ inputs.ucrt3-release }}"
if [ $TYPE = "base" ] ; then
SUFF="_base"
else
SUFF="_full"
fi
URL=`$RCURL https://api.github.com/repos/kalibera/ucrt3/releases | \
sed -n 's!^ *\"*browser_download_url\"*: \"\(.*/download/'$TAG'/gcc13_ucrt3'$SUFF'_[0-9]\+\.tar.zst\)\"!\1!p'`
echo "Toolchain URL is $URL"
$RCURL -o toolchain.tar.zst $URL
if [ ! -r toolchain.tar.zst ] ; then
echo "::error ::ERROR: failed to download toolchain"
exit 1
fi
ls -l toolchain.tar.zst
tar xf toolchain.tar.zst -C ~
if [ ! -d $TDIR ] ; then
echo "::error ::ERROR: failed to install toolchain"
exit 1
fi
if [ ! -x $TDIR/bin/pkg-config ] ; then
# make sure packages won't use non-Rtools pkg-config
# recent Rtools already have the file
echo "#! /bin/bash" > $TDIR/bin/pkg-config
fi
if [ ! -r $TDIR/bin/pkg-config.bat ] ; then
# make sure packages find Rtools pkg-config even outside bash
# recent Rtools already have the wrapper
echo '@sh %~dp0/pkg-config %*' > $TDIR/bin/pkg-config.bat
fi
rm -f toolchain.tar.zst
echo $TYPE > $TDIR/type
echo "GCC version:"
$TDIR/bin/gcc -v
echo "MXE packages installed:"
ls $TDIR/installed/
echo "::endgroup::"
fi
shell: bash
- name: Set up environment for the toolchain
run: |
TYPE="${{ inputs.toolchain-type }}"
TDIR=`cygpath -m ~/x86_64-w64-mingw32.static.posix`
if [ "${{ runner.os }}" = Windows -a $TYPE != "none" ] ; then
echo "::group::Setting up environment for the toolchain"
echo $TDIR/bin >> $GITHUB_PATH
echo "R_CUSTOM_TOOLS_SOFT=$TDIR" >> $GITHUB_ENV
echo "R_CUSTOM_TOOLS_PATH=$TDIR/bin;c:/msys64/usr/bin" >> $GITHUB_ENV
echo "::endgroup::"
fi
shell: bash