-
Notifications
You must be signed in to change notification settings - Fork 45
186 lines (166 loc) · 6.57 KB
/
build.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
# This workflow will run on all pull-request branches and on 'master',
# 'staging', and 'trying'
#
# In all cases it will incrementally build: riotdocker-base, static-test-tools
# and riotbuild
#
# If riotbuild is successfully built then it will run a simple compile test on
# a subset of BOARDs using gcc and llvm
#
# On master if the building and testing succeeds it will push the generated image
# to ${DOCKER_REGISTRY}
#
# * Requirements:
# * Add the following secrets:
# * DOCKER_REGISTRY: the registry to pull and push images from/to
# * DOCKERHUB_USERNAME: the Docker Hub username account that can
# publish to ${DOCKER_REGISTRY}
# * DOCKERHUB_TOKEN: the Docker Hub access token for ${DOCKERHUB_USERNAME}
#
name: build
on:
push:
branches:
- trying
- staging
- master
pull_request:
branches:
- '*'
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
env:
RIOT_BRANCH: '2023.04-branch'
VERSION_TAG: '2023.07'
DOCKER_REGISTRY: "${{ secrets.DOCKER_REGISTRY || 'local' }}"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
- name: Build riotdocker-base
uses: docker/build-push-action@v2
with:
context: ./riotdocker-base
tags: |
${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}
- name: Build static-test-tools
uses: docker/build-push-action@v2
with:
context: ./static-test-tools
tags: |
${{ env.DOCKER_REGISTRY }}/static-test-tools:latest
${{ env.DOCKER_REGISTRY }}/static-test-tools:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
- name: Set environment variables
run: |
echo "RIOTBUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
echo "RIOTBUILD_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "RIOTBUILD_VERSION=$(git describe --always)" >> $GITHUB_ENV
- name: Build riotbuild
uses: docker/build-push-action@v2
with:
context: ./riotbuild
tags: |
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
${{ env.DOCKER_REGISTRY }}/riotbuild:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
RIOTBUILD_BRANCH=${{ env.RIOTBUILD_BRANCH }}
RIOTBUILD_COMMIT=${{ env.RIOTBUILD_COMMIT }}
RIOTBUILD_VERSION=${{ env.RIOTBUILD_VERSION }}
- name: Checkout RIOT
uses: actions/checkout@v2
with:
repository: RIOT-OS/RIOT
ref: ${{ env.RIOT_BRANCH }}
path: RIOT
- name: GNU build test
run: |
make -CRIOT/examples/hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "arduino-uno esp32-wroom-32 hifive1b msb-430h native samr21-xpro"
- name: GNU microbit qemu test
run: >
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
make -Ctests/fmt_print all test
env:
BOARD: "microbit"
EMULATE: 1
- name: tests/nanopb test
run: >
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
make -Ctests/pkg_nanopb all test
- name: LLVM build test
run: |
make -CRIOT/examples/hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
env:
TOOLCHAIN: llvm
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "native samr21-xpro"
- name: Rust build test
run: |
# Some of the above are executed by root, creating ~/.cargo/git as
# that user, blocking downloads of own libraries.
rm -rf ~/.cargo
make -CRIOT/examples/rust-hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
make -CRIOT/examples/rust-gcoap BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
# Not all of them are actually available; still using the "canonical"
# list of representative boards above to keep this stable whil Rust
# support expands
BOARDS: "arduino-uno esp32-wroom-32 hifive1b msb-430h native samr21-xpro"
- name: C++ build test
run: |
make -C RIOT/tests/cpp11_condition_variable BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "esp32-wroom-32 hifive1b native samr21-xpro"
- name: Run static tests
run: |
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild \
-e CI_BASE_BRANCH=${{ env.RIOT_BRANCH }} ${{ env.DOCKER_REGISTRY }}/riotbuild:latest \
./dist/tools/ci/static_tests.sh
- name: Build murdock worker
uses: docker/build-push-action@v2
with:
context: ./murdock-worker
tags: |
${{ env.DOCKER_REGISTRY }}/murdock-worker:latest
${{ env.DOCKER_REGISTRY }}/murdock-worker:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
- name: Login to DockerHub
if: "${{ github.ref == 'refs/heads/master' }}"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Images
if: "${{ github.ref == 'refs/heads/master' }}"
run: |
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/static-test-tools:latest
docker image push ${{ env.DOCKER_REGISTRY }}/static-test-tools:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
docker image push ${{ env.DOCKER_REGISTRY }}/riotbuild:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/murdock-worker:latest
docker image push ${{ env.DOCKER_REGISTRY }}/murdock-worker:${{ env.VERSION_TAG }}