-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (54 loc) · 2.03 KB
/
generate_pkg.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
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: Generate R package using savvy
jobs:
generate_pkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: check wrapper file generation
run: |
cargo run --manifest-path ./savvy-cli/Cargo.toml -- update ./R-package/
# If there's any change, exit with non-zero status
# (the code is derived from https://stackoverflow.com/a/3879077)
git add ./R-package/
git update-index --refresh
if ! git diff-index --quiet HEAD -- ./R-package/; then
echo
echo "some change on wrapper file generation was detected!"
echo
git diff ./R-package/
exit 1
fi
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
any::devtools
any::usethis
working-directory: R-package # this isn't the actual R package, but this is needed to avoid an error
- name: create tempdir
run: echo "TEMP_DIR=$(mktemp -d)" >> ${GITHUB_ENV}
- name: create package
run: |
Rscript -e "usethis::create_package('${{ runner.temp }}/sawy')"
cargo run --manifest-path ./savvy-cli/Cargo.toml -- init ${{ runner.temp }}/sawy
cd ${{ runner.temp }}/sawy
sed -i '/savvy/ s|".*"|{ path = "${{ github.workspace }}" }|' src/rust/Cargo.toml
Rscript -e "usethis::use_mit_license('foo')"
Rscript -e "devtools::document()"
- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual")'
working-directory: ${{ runner.temp }}/sawy
- name: Run Rust tests
run: |
cargo test --manifest-path ${{ runner.temp }}/sawy/src/rust/Cargo.toml
cargo r-test ${{ runner.temp }}/sawy/src/rust