-
Notifications
You must be signed in to change notification settings - Fork 36
104 lines (86 loc) · 3.04 KB
/
release_cross_compiled.yaml
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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
tags:
- "**" # Push events to every tag including hierarchical tags like v1.0/beta
workflow_dispatch:
name: Release_cross_compiled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RPOLARS_FULL_FEATURES: "true"
RPOLARS_CARGO_CLEAN_DEPS: "true"
RPOLARS_PROFILE: release-optimized
jobs:
build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
permissions:
contents: write
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release', target: 'x86_64-apple-darwin'}
- {os: ubuntu-latest, r: 'release', target: 'aarch64-apple-darwin'}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Fix path for Windows caching
if: runner.os == 'Windows'
shell: bash
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
rtools-version: ${{ matrix.config.rtools-version }}
Ncpus: 2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: dev
pak-version: devel
env:
CI: false
- name: cross compile
run: |
pwd
rustup target add "${{ runner.target }}"
rustup default "${{ runner.target }}"
cargo build --lib --profile release-optimized --manifest-path=./src/rust/Cargo.toml
mv ./src/rust/target/release-optimized/libr_polars.a ./inst/
echo "${{ runner.os }}" > .inst/target.txt
cat .inst/target.txt
ls -l
ls ./inst/ -l
shell: bash
- name: build source (with object file)
run: |
runner_os <- readLines("./inst/target.txt")[1]
fn = devtools::build(vignettes = FALSE)
if (R.version$os != "mingw32") {
newfn = paste0(substr(fn,1,regexpr("_",fn)),"_cross_",runner_os,"_",R.version$platform,".",tools::file_ext(fn))
file.rename(fn, newfn)
} else {
file.rename(fn,"../polars.zip") #R expects specific windows binary filename
}
shell: Rscript {0}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
with:
files: |
../polars_*
../polars.zip
- name: print files
run: print(list.files("..",recursive = TRUE,full.names=TRUE))
shell: Rscript {0}
- name: print wd
run: print(getwd())
shell: Rscript {0}