aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/ci.md
blob: 6f31b6f1f3a33ebc0c07a336b53a96c5bf8be4ff (plain) (blame)
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
`ci-boost` and `ci-build` are thin wrappers around `boost-download`/`boost-build`
and `project-build` accordingly.  They work by reading environment variables
and passing their values as command line parameters to the more generic scripts.
This facilitates matrix-building the project without too much fuss.

For example, the following Travis workflow:

```
language: cpp
os: linux
dist: focal

env:
  global:
    BOOST_VERSION: 1.65.0
  jobs:
    - CONFIGURATION=Debug   PLATFORM=x64
    - CONFIGURATION=Release PLATFORM=x64

before_script: ci-boost -- --with-filesystem
script: ci-build --install
```

is roughly equivalent to running

```
boost-download --cache "$TRAVIS_BUILD_DIR/../build" -- 1.65.0
mv -- \
    "$TRAVIS_BUILD_DIR/../build/boost_1_65_0" \
    "$TRAVIS_BUILD_DIR/../build/boost"

boost-build                            \
    --platform x64                     \
    --configuration Debug Release      \
    --                                 \
    "$TRAVIS_BUILD_DIR/../build/boost" \
    --with-filesystem

for configuration in Debug Release; do
    project-build                                      \
        --platform x64                                 \
        --configuration "$configuration"               \
        --boost "$TRAVIS_BUILD_DIR/../build/boost"     \
        --build "$TRAVIS_BUILD_DIR/../build/cmake"     \
        --install "$TRAVIS_BUILD_DIR/../build/install" \
        --                                             \
        "$TRAVIS_BUILD_DIR"                            \
        TMP
done
```

Caching
-------

`ci-boost` downloads the Boost distribution archive to the "../build/"
directory (resolved relatively to the root checkout directory).  You can cache
the archive like this (using GitHub Actions as an example):

```
- name: Cache Boost
  uses: actions/cache@v2
  with:
    path: '${{ runner.workspace }}/build/boost_*.tar.gz'
    key: 'boost_${{ env.BOOST_VERSION }}'

- name: Build Boost
  # This won't re-download the archive unnecessarily.
  run: ci-boost -- --with-filesystem
```