Skip to content

Commit 36a4fce

Browse files
author
Jorge Aparicio
committed
add CI
1 parent a0f66f8 commit 36a4fce

File tree

5 files changed

+91
-2
lines changed

5 files changed

+91
-2
lines changed

.travis.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cache: cargo
2+
dist: trusty
3+
env: TARGET=x86_64-unknown-linux-gnu
4+
language: rust
5+
rust: nightly-2016-09-30
6+
services: docker
7+
sudo: required
8+
9+
script:
10+
- cargo generate-lockfile
11+
- sh ci/run-docker.sh $TARGET
12+
# Travis can't cache files that are not readable by "others"
13+
- chmod -R a+r $HOME/.cargo
14+
15+
branches:
16+
only:
17+
- auto
18+
- try
19+
20+
notifications:
21+
email:
22+
on_success: never
23+
webhooks: https://homu.herokuapp.com/travis

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name = "svd2rust"
55
version = "0.1.0"
66

77
[dependencies]
8-
aster = "*"
8+
aster = "0.29.0"
99
clap = "2.14.0"
1010
inflections = "1.0.0"
11-
quasi = "*"
11+
quasi = "0.21.0"
1212
quasi_macros = "*"
1313
svd-parser = "0.1.1"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
curl \
6+
gcc \
7+
libc6-dev

ci/run-docker.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
set -ex
2+
3+
run() {
4+
local target=$1
5+
6+
echo $target
7+
8+
# This directory needs to exist before calling docker, otherwise docker will create it but it
9+
# will be owned by root
10+
mkdir -p target
11+
12+
docker build -t $target ci/docker/$target
13+
docker run \
14+
--rm \
15+
--user $(id -u):$(id -g) \
16+
-e CARGO_HOME=/cargo \
17+
-e CARGO_TARGET_DIR=/target \
18+
-e HOME=/tmp \
19+
-v $HOME/.cargo:/cargo \
20+
-v `pwd`/target:/target \
21+
-v `pwd`:/checkout:ro \
22+
-v `rustc --print sysroot`:/rust:ro \
23+
-w /checkout \
24+
-it $target \
25+
sh -c "PATH=\$PATH:/rust/bin ci/run.sh $target"
26+
}
27+
28+
if [ -z $1 ]; then
29+
for d in `ls ci/docker/`; do
30+
run $d
31+
done
32+
else
33+
run $1
34+
fi

ci/run.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set -ex
2+
3+
gen() {
4+
cargo run --release -- -i /tmp/STM32F30x.svd $1 > /dev/null
5+
}
6+
7+
main() {
8+
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib/rustlib/${1}/lib
9+
echo $LD_LIBRARY_PATH
10+
11+
curl -L \
12+
https://raw.githubusercontent.com/posborne/cmsis-svd/master/data/STMicro/STM32F30x.svd \
13+
> /tmp/STM32F30x.svd
14+
15+
cargo build --release
16+
17+
gen
18+
gen gpioa
19+
gen dbgmcu
20+
gen tim6
21+
gen i2c1
22+
gen rcc
23+
}
24+
25+
main $1

0 commit comments

Comments
 (0)