-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (165 loc) · 6.63 KB
/
c.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
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
167
#
# c.yaml
# Created by Perry Naseck on 6/25/21.
#
# Copyright (c) 2021, Wireless Sensing and Embedded Systems Lab, Carnegie
# Mellon University
# All rights reserved.
#
# This source code is licensed under the BSD-3-Clause license found in the
# LICENSE file in the root directory of this source tree.
#
name: C
on: [push, pull_request]
jobs:
test-c:
name: 'Test (${{ matrix.id }}: ${{ matrix.os }})'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
compiler: 'gcc'
id: 'linux-gcc'
- os: windows-2019
compiler: 'gcc'
id: 'windows-gcc'
- os: windows-2019
compiler: 'cl'
id: 'windows-cl'
- os: macos-10.15
compiler: 'gcc'
id: 'macos-gcc'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add VS build tools
if: runner.os == 'Windows' && matrix.compiler == 'cl'
uses: ilammy/msvc-dev-cmd@v1
- name: Build tests
shell: bash
run: >
(if [[ "${{ matrix.os }}" = *"windows"* ]]; then export SHARED_EXT=".exe";
else export SHARED_EXT=""; fi) &&
mkdir build &&
${{ matrix.compiler }} -o build/test-${{ matrix.id }}$SHARED_EXT -Iparticlefilter/include particlefilter/src/*.c test/test.c -lm
- name: SHA256 files
shell: bash
run: find . -type f -exec sha256sum {} \;
working-directory: build
- uses: actions/upload-artifact@v2
with:
name: c-test
path: ./build/*
- name: Run test
shell: bash
run: >
(if [[ "${{ matrix.os }}" = *"windows"* ]]; then export SHARED_EXT=".exe";
else export SHARED_EXT=""; fi) &&
time ./build/test-${{ matrix.id }}$SHARED_EXT ./test/data/ ./test/out/test1_ParticleFilterLoc_test_out_c_${{ matrix.id }}.csv ./test/data/test1_ParticleFilterLoc_expected_out_${{ matrix.id }}.csv
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: c-test-out
path: ./test/out/*.csv
build-c-shared-lib-dockcross:
name: 'Build Linux Cross Shared Library (${{ matrix.note }}${{ matrix.arch }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { arch: web-wasm, ext: wasm, note: "" }
- { arch: linux-x64, ext: so, note: "" }
- { arch: linux-x86, ext: so, note: "" }
- { arch: linux-arm64, ext: so, note: "" } # aarch64
- { arch: linux-arm64-musl, ext: so, note: "" } # aarch64
- { arch: linux-armv5, ext: so, note: "" }
- { arch: linux-armv5-musl, ext: so, note: "" }
- { arch: linux-armv6, ext: so, note: "" }
- { arch: linux-armv6-musl, ext: so, note: "" }
- { arch: linux-armv7, ext: so, note: "" }
- { arch: linux-armv7a, ext: so, note: "" }
- { arch: linux-armv7l-musl, ext: so, note: "" }
- { arch: linux-s390x, ext: so, note: "" }
- { arch: linux-ppc64le, ext: so, note: "" }
- { arch: windows-static-x64, ext: dll, note: "mingw-" }
- { arch: windows-static-x64-posix, ext: dll, note: "mingw-" }
- { arch: windows-static-x86, ext: dll, note: "mingw-" }
- { arch: windows-shared-x64, ext: dll, note: "mingw-" }
- { arch: windows-shared-x64-posix, ext: dll, note: "mingw-" }
- { arch: windows-shared-x86, ext: dll, note: "mingw-" }
container:
image: dockcross/${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
- name: Build shared library
shell: bash
run: >
mkdir build &&
gcc -fPIC -shared -o build/particlefilter-gcc-${{ matrix.note }}${{ matrix.arch }}.${{ matrix.ext }} -Iparticlefilter/include particlefilter/src/*.c -lm
- name: SHA256 files
shell: bash
run: find . -type f -exec sha256sum {} \;
working-directory: build
- uses: actions/upload-artifact@v2
with:
name: c-shared-lib
path: ./build/*
build-c-shared-lib-windows:
name: 'Build Windows Shared Libraries (${{ matrix.arch }})'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { arch: amd64, args: '/MT', name: "static-x64" }
- { arch: amd64_x86, args: '/MT', name: "static-x86" }
- { arch: amd64_arm, args: '/MT', name: "static-arm" }
- { arch: amd64_arm64, args: '/MT', name: "static-arm64" }
steps:
- uses: actions/checkout@v2
- name: Add VS build tools
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build shared library
run: >
mkdir build &&
cl particlefilter/src/*.c /Iparticlefilter/include ${{ matrix.args }} /link /DLL /OUT:build/particlefilter-cl-windows-${{ matrix.name }}.dll
- name: SHA256 files
shell: bash
run: find . -type f -exec sha256sum {} \;
working-directory: build
- uses: actions/upload-artifact@v2
with:
name: c-shared-lib
path: ./build/*
publish-release-artifacts:
name: Publish Release Artifacts to GitHub
needs: [build-c-shared-lib-dockcross, build-c-shared-lib-windows]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Download C Shared Library artifacts
uses: actions/[email protected]
with:
name: c-shared-lib
path: c-shared-lib/
- name: Display structure of c-shared-lib files
run: ls -R
working-directory: c-shared-lib
- name: Archive c-shared-lib
run: 'tar -czvf particlefilter-${GITHUB_REF##*/}-c-shared-lib-all.tar.gz -C c-shared-lib .'
- name: SHA256 files
run: find . -type f -name "*.tar.gz" -exec sha256sum {} \;
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ contains(github.event.ref, '-pre') || contains(github.event.ref, '-alpha') || contains(github.event.ref, '-beta') || contains(github.event.ref, '-rc') || contains(github.event.ref, '-dev') }}
files: |
*.tar.gz