-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (136 loc) · 4.1 KB
/
Copy pathrelease.yml
File metadata and controls
160 lines (136 loc) · 4.1 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Build and Release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86_64
id: windows-x86_64
runner: windows-2022
generator: Visual Studio 17 2022
platform: x64
osx_architectures: ""
- name: Ubuntu 22.04 x86_64
id: ubuntu-22.04-x86_64
runner: ubuntu-22.04
generator: Ninja
platform: ""
osx_architectures: ""
- name: Ubuntu 22.04 arm64
id: ubuntu-22.04-arm64
runner: ubuntu-22.04-arm
generator: Ninja
platform: ""
osx_architectures: ""
# - name: macOS x86_64
# id: macos-x86_64
# runner: macos-13
# generator: Ninja
# platform: ""
# osx_architectures: ""
# - name: macOS arm64
# id: macos-arm64
# runner: macos-14
# generator: Ninja
# platform: ""
# osx_architectures: ""
- name: macOS universal
id: macos-universal
runner: macos-14
generator: Ninja
platform: ""
osx_architectures: x86_64;arm64
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libreadline-dev \
libncurses-dev
- name: Install macOS dependencies
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew install readline ncurses
- name: Configure Unix
if: runner.os != 'Windows'
shell: bash
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/install" \
-DR_HOME="$(R RHOME)"
- name: Configure Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
$rhome = (R.exe RHOME) | Out-String
$rhome = $rHome.Trim()
$env:R_HOME = $rhome
cmake -S . -B build `
-G "Visual Studio 17 2022" `
-DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/install" `
-DR_HOME="$rhome"
- name: Build and package
shell: bash
run: cmake --build build --config Release --target package
- name: Upload package artifact
uses: actions/upload-artifact@v7
with:
name: package-${{ matrix.id }}
path: build/*.zip
if-no-files-found: error
release:
name: Create release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: build
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
pattern: package-*
path: dist
merge-multiple: true
- name: Create or update GitHub release
shell: bash
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tag_name="ci-${GITHUB_SHA}"
release_title="CI build ${GITHUB_SHA:0:12}"
release_flags=(--prerelease)
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
tag_name="${GITHUB_REF_NAME}"
release_title="${GITHUB_REF_NAME}"
release_flags=()
fi
notes="Automated packages for ${GITHUB_SHA}."
if gh release view "${tag_name}" >/dev/null 2>&1; then
gh release upload "${tag_name}" dist/*.zip --clobber
else
gh release create "${tag_name}" dist/*.zip \
--target "${GITHUB_SHA}" \
--title "${release_title}" \
--notes "${notes}" \
"${release_flags[@]}"
fi