Skip to content

Commit bb8c930

Browse files
Daniel Wyattni4
Daniel Wyatt
authored andcommitted
ci: Make local CI runs simpler.
1 parent 091595d commit bb8c930

File tree

4 files changed

+37
-26
lines changed

4 files changed

+37
-26
lines changed

ci/local.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
rsync -a /usr/local/rnp /tmp
5+
sudo -iu travis bash <<EOF
6+
cd /tmp/rnp
7+
env GPG_VERSION=$GPG_VERSION BUILD_MODE=$BUILD_MODE ci/run-local.sh
8+
EOF
9+

ci/run-local.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
export LOCAL_BUILDS="$HOME/local-builds"
5+
export BOTAN_INSTALL="${LOCAL_BUILDS}/botan-install"
6+
export CMOCKA_INSTALL="${LOCAL_BUILDS}/cmocka-install"
7+
export JSONC_INSTALL="${LOCAL_BUILDS}/jsonc-install"
8+
export GPG_INSTALL="${LOCAL_BUILDS}/gpg-install"
9+
export CC=clang
10+
export CORES=$(grep -c '^$' /proc/cpuinfo)
11+
ci/install.sh
12+
ci/main.sh
13+

doc/DEVELOPMENT-GUIDE.md

+2-25
Original file line numberDiff line numberDiff line change
@@ -94,37 +94,14 @@ We can use a container for this, like so:
9494

9595
``` sh
9696
./travis.sh
97-
# or
98-
# docker run -ti --rm travisci/ci-garnet:packer-1490989530 bash -l
9997
```
10098

101-
(Refer to
102-
[here](https://docs.travis-ci.com/user/common-build-problems/#Troubleshooting-Locally-in-a-Docker-Image)
103-
and [here](https://hub.docker.com/r/travisci/ci-garnet/tags/))
104-
105-
Inside the container, you will need to perform steps like the following:
99+
Inside the container, you can do local CI runs like so:
106100

107101
``` sh
108-
cd ~/
109-
git clone https://github.com/riboseinc/rnp
110-
# or if testing local copy
111-
# git clone /usr/local/rnp
112-
cd rnp
113-
export LOCAL_BUILDS="$HOME/local-builds"
114-
export BOTAN_INSTALL="${LOCAL_BUILDS}/botan-install"
115-
export CMOCKA_INSTALL="${LOCAL_BUILDS}/cmocka-install"
116-
export JSONC_INSTALL="${LOCAL_BUILDS}/jsonc-install"
117-
export GPG_INSTALL="${LOCAL_BUILDS}/gpg-install"
118-
export GPG_VERSION=stable
119-
export BUILD_MODE=normal
120-
ci/install.sh
121-
env CC=clang ci/main.sh
102+
env GPG_VERSION=beta BUILD_MODE=sanitize-leaks ci/local.sh
122103
```
123104

124-
(The above uses clang as the compiler -- use `CC=gcc` for GCC)
125-
Refer to the current `.travis.yml` for the most up-to-date information
126-
on what environment variables need to be set.
127-
128105
# Code Coverage
129106

130107
CodeCov is used for assessing our test coverage.

travis.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
#!/bin/bash
2-
docker run -ti -v $(pwd):/usr/local/rnp --rm travisci/ci-garnet:packer-1490989530 bash -l
2+
3+
[ $# -eq 0 ] && CMD='bash -l' || CMD=$*
4+
5+
docker run \
6+
--tty \
7+
--interactive \
8+
--cap-add SYS_PTRACE \
9+
--volume "$(pwd):/usr/local/rnp" \
10+
--workdir /usr/local/rnp \
11+
--user 2000 \
12+
--rm \
13+
travisci/ci-garnet:packer-1512502276-986baf0 \
14+
$CMD
315

0 commit comments

Comments
 (0)