-
Notifications
You must be signed in to change notification settings - Fork 8
166 lines (138 loc) · 5.9 KB
/
main.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
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
161
162
163
164
165
166
name: Linux Tests
on:
push:
branches: [ master ]
tags: ['v*']
pull_request:
branches: [ master ]
release:
types: [published]
jobs:
build_and_test:
if: "github.repository == 'libamtrack/library' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
name: Compile and test library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install necessary packages
run: sudo apt-get -y install libgsl-dev
- name: compile and install
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../ -DCMAKE_INSTALL_PREFIX=$HOME/usr
cmake --build . --target install -- -j
- name: tests
run: |
LD_LIBRARY_PATH=$HOME/usr/lib $HOME/usr/bin/amtrack_test
LD_LIBRARY_PATH=$HOME/usr/lib $HOME/usr/bin/amtrack_demo
javascript_package:
if: "github.repository == 'libamtrack/library' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
needs: [build_and_test]
steps:
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v14
- name: Cache compiled GSL
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: $HOME/usr
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/main.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Compile GSL
run: |
wget -q "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz"
mkdir $HOME/gsl-latest
tar -xzf gsl-latest.tar.gz -C $HOME/gsl-latest
mv $HOME/gsl-latest/** $HOME/gsl-latest/gsl
mkdir $HOME/usr
cd $HOME/gsl-latest/gsl/ && emconfigure ./configure --prefix=$HOME/usr --disable-shared && emmake make -j && emmake make install
ls -al $HOME/usr/lib/
- name: Compile libamtrack webassembly package
run: |
GSL_INCLUDE_DIRS=$HOME/usr/include GSL_LIBRARY=$HOME/usr/lib/libgsl.a GSL_CBLAS_LIBRARY=$HOME/usr/lib/libgslcblas.a ./compile_to_js.sh
working-directory: distributions/JavaScript
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: wasm file
path: |
distributions/JavaScript/output/libat.wasm
distributions/JavaScript/output/libat.js
if-no-files-found: error
retention-days: 5
python_package:
if: "github.repository == 'libamtrack/library' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
name: Make and test python bindings
runs-on: ubuntu-latest
needs: [build_and_test]
steps:
- uses: actions/checkout@v4
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Default: 1
fetch-depth: '0'
- name: make python package
run: sudo ./make_wheel_package.sh
working-directory: distributions/Python/pyamtrack
- name: test python package
run: sudo ./test_wheel_package.sh
working-directory: distributions/Python/pyamtrack
- name: check generated files
run: ls -alh distributions/Python/pyamtrack/generated/dist/wheelhouse/
- name: publish package to pypi
uses: pypa/gh-action-pypi-publish@v1.10.2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
password: ${{ secrets.TWINE_PASSWORD }}
repository_url: "https://upload.pypi.org/legacy/"
packages_dir: distributions/Python/pyamtrack/generated/dist/wheelhouse/
verbose: true
r_package:
if: "github.repository == 'libamtrack/library' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
needs: [build_and_test]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install deps
run: |
sudo apt-get install -y r-base-core libgsl-dev
pip install -r distributions/R/generator/requirements.txt
pip install "robotpy-cppheaderparser==5.1.1"
- name: make R package source
run: |
python generator/scripts/header_parser.py --namespace ./NAMESPACE --out-dir ./out/ libamtrack "../../include/*.h"
python generator/scripts/prepare.py --desc-path ./DESCRIPTION --version 0.12.0 --out-dir ./out ../../include ../../src
working-directory: distributions/R
- name: install R deps
run: |
sudo R --vanilla -e 'install.packages("roxygen2", repos="http://cran.us.r-project.org")'
sudo R --vanilla -e 'install.packages("pkgbuild", repos="http://cran.us.r-project.org")'
- name: install R binary package
run: |
R --vanilla -e 'setwd("out"); roxygen2::roxygenise(load_code = "source")'
R --vanilla -e 'setwd("out"); pkgbuild::build(binary = TRUE, needs_compilation = TRUE)'
working-directory: distributions/R
- name: test R binary package
run: |
sudo R --vanilla -e 'install.packages("libamtrack_0.12.0_R_x86_64-pc-linux-gnu.tar.gz")'
R --vanilla -e 'library(libamtrack); AT.beta.from.E.single(60)'
working-directory: distributions/R
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: R package
path: distributions/R/libamtrack_0.12.0_R_x86_64-pc-linux-gnu.tar.gz
if-no-files-found: error
retention-days: 5