Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aa422be

Browse files
committedApr 28, 2020
WIP: Add Cygwin to CI
1 parent a288ed4 commit aa422be

File tree

2 files changed

+267
-88
lines changed

2 files changed

+267
-88
lines changed
 

‎.github/workflows/build.yml

+251-88
Original file line numberDiff line numberDiff line change
@@ -16,107 +16,270 @@ on:
1616
pull_request:
1717

1818
jobs:
19+
Fetch-Source:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Determine Target Branches
23+
id: gittargets
24+
shell: bash
25+
run: |
26+
TESTING_REF="master" # Always use master for testing
27+
OS_REF=""
28+
APPS_REF=""
29+
30+
REF=$GITHUB_REF
31+
32+
# If a base ref is set this is a PR and we will want to use
33+
# the base ref instead of the ref that triggered the event
34+
if [ ${GITHUB_BASE_REF} ]; then
35+
REF=refs/heads/$GITHUB_BASE_REF
36+
fi
37+
38+
echo "Working with ref: $REF"
39+
40+
# We modify for all tags and release branches
41+
if [[ $REF =~ refs/heads/releases/*|refs/tags/* ]]; then
42+
if [[ $REF =~ refs/heads/* ]]
43+
then
44+
REF_NAME=${REF##refs/heads/}
45+
echo "Working with a branch: $REF_NAME"
46+
else
47+
REF_NAME=${REF##refs/tags/}
48+
echo "Working with a tag: $REF_NAME"
49+
fi
50+
51+
# Determine the repo and leave that unset to use the normal checkout behavior
52+
# of using the merge commit instead of HEAD
53+
case $GITHUB_REPOSITORY in
54+
"apache/incubator-nuttx")
55+
# OS
56+
echo "Triggered by change in OS"
57+
APPS_REF=$REF_NAME
58+
;;
59+
60+
"apache/incubator-nuttx-apps" )
61+
# APPS
62+
OS_REF=$REF_NAME
63+
echo "Triggered by change in APPS"
64+
;;
65+
66+
*)
67+
echo "Trigger by change on $GITHUB_REPOSITORY. This is unexpected."
68+
;;
69+
esac
70+
fi
71+
72+
echo ::set-output name=os_ref::$OS_REF
73+
echo ::set-output name=apps_ref::$APPS_REF
74+
echo ::set-output name=testing_ref::$TESTING_REF
75+
76+
- name: Checkout nuttx repo
77+
uses: actions/checkout@v2
78+
with:
79+
repository: apache/incubator-nuttx
80+
ref: ${{ steps.gittargets.outputs.os_ref }}
81+
path: sources/nuttx
82+
fetch-depth: 1
83+
84+
- name: Checkout apps repo
85+
uses: actions/checkout@v2
86+
with:
87+
repository: apache/incubator-nuttx-apps
88+
ref: ${{ steps.gittargets.outputs.apps_ref }}
89+
path: sources/apps
90+
fetch-depth: 1
91+
92+
- name: Checkout testing repo
93+
uses: actions/checkout@v2
94+
with:
95+
repository: apache/incubator-nuttx-testing
96+
ref: ${{ steps.gittargets.outputs.testing_ref }}
97+
path: sources/testing
98+
fetch-depth: 1
99+
100+
- name: Create Source Bundle
101+
run: tar -czf sources.tar.gz sources
102+
- name: Archive Source Bundle
103+
uses: actions/upload-artifact@v1
104+
with:
105+
name: source-bundle
106+
path: sources.tar.gz
107+
108+
- name: Cache Source
109+
id: cache-source
110+
uses: actions/cache@v1
111+
with:
112+
path: sources
113+
key: build-sources-${{ github.run_id }}
114+
19115
Linux:
20-
runs-on: ubuntu-18.04
116+
needs: Fetch-Source
117+
runs-on: ubuntu-latest
21118
env:
22119
DOCKER_BUILDKIT: 1
23120

24121
strategy:
25122
matrix:
26123
boards: [arm-01, arm-02, arm-03, arm-04, arm-05, arm-06, arm-07, arm-08, arm-09, arm-10, arm-11, arm-12, arm-13, mips-riscv-x86-xtensa, sim]
124+
27125
steps:
28-
- name: Checkout nuttx repo
29-
uses: actions/checkout@v2
30-
with:
31-
repository: apache/incubator-nuttx
32-
path: nuttx
33-
fetch-depth: 0
34-
35-
- name: Fetch nuttx tags
36-
run: |
37-
cd nuttx
38-
git fetch --tags
39-
40-
- name: Checkout apps repo
41-
uses: actions/checkout@v2
42-
with:
43-
repository: apache/incubator-nuttx-apps
44-
path: apps
45-
fetch-depth: 0
46-
47-
- name: Checkout testing repo
48-
uses: actions/checkout@v2
49-
with:
50-
repository: apache/incubator-nuttx-testing
51-
path: testing
52-
53-
- name: Docker Login
54-
uses: azure/docker-login@v1
55-
with:
56-
login-server: docker.pkg.github.com
57-
username: ${GITHUB_ACTOR}
58-
password: ${{ secrets.GITHUB_TOKEN }}
59-
60-
- name: Docker Pull
61-
uses: nick-invision/retry@v1
62-
with:
63-
timeout_minutes: 10
64-
max_attempts: 3
65-
retry_wait_seconds: 10
66-
command: docker pull docker.pkg.github.com/apache/incubator-nuttx-testing/nuttx-ci-linux
67-
68-
- name: Run builds
69-
uses: ./testing/.github/actions/ci-container
70-
env:
71-
BLOBDIR: /tools/blobs
72-
with:
73-
run: |
74-
cd testing
75-
./cibuild.sh -x -G testlist/${{matrix.boards}}.dat
126+
- name: Fetch Cached Source
127+
id: cache-source
128+
uses: actions/cache@v1
129+
with:
130+
path: sources-cache
131+
key: build-sources-${{ github.run_id }}
132+
- name: Prevent Updating Source Cache
133+
if: steps.cache-source.outputs.cache-hit == 'true'
134+
run: mv sources-cache sources
135+
- name: Download Source Artifact
136+
if: steps.cache-source.outputs.cache-hit != 'true'
137+
uses: actions/download-artifact@v1
138+
with:
139+
name: source-bundle
140+
path: ./
141+
- name: Extract Source Artifact
142+
if: steps.cache-source.outputs.cache-hit != 'true'
143+
run: tar -xf sources.tar.gz
144+
145+
- name: Docker Login
146+
uses: azure/docker-login@v1
147+
with:
148+
login-server: docker.pkg.github.com
149+
username: ${GITHUB_ACTOR}
150+
password: ${{ secrets.GITHUB_TOKEN }}
151+
152+
- name: Docker Pull
153+
uses: nick-invision/retry@v1
154+
with:
155+
timeout_minutes: 10
156+
max_attempts: 3
157+
retry_wait_seconds: 10
158+
command: docker pull docker.pkg.github.com/apache/incubator-nuttx-testing/nuttx-ci-linux
159+
160+
- name: Run builds
161+
uses: ./sources/testing/.github/actions/ci-container
162+
env:
163+
BLOBDIR: /tools/blobs
164+
with:
165+
run: |
166+
git -C sources/nuttx fetch --tags
167+
cd sources/testing
168+
./cibuild.sh -x -G testlist/${{matrix.boards}}.dat
76169
77170
macOS:
78171
runs-on: macos-10.15
79-
172+
needs: Fetch-Source
80173
strategy:
81174
matrix:
82175
boards: [arm-12, mips-riscv-x86-xtensa, sim]
176+
steps:
177+
- name: Fetch Cached Source
178+
id: cache-source
179+
uses: actions/cache@v1
180+
with:
181+
path: sources-cache
182+
key: build-sources-${{ github.run_id }}
183+
- name: Prevent Updating Source Cache
184+
if: steps.cache-source.outputs.cache-hit == 'true'
185+
run: mv sources-cache sources
186+
- name: Download Source Artifact
187+
if: steps.cache-source.outputs.cache-hit != 'true'
188+
uses: actions/download-artifact@v1
189+
with:
190+
name: source-bundle
191+
path: ./
192+
- name: Extract Source Artifact
193+
if: steps.cache-source.outputs.cache-hit != 'true'
194+
run: tar -xf sources.tar.gz
195+
196+
- name: Restore Tools Cache
197+
id: cache-tools
198+
uses: actions/cache@v1
199+
env:
200+
cache-name: ${{ runner.os }}-cache-tools
201+
with:
202+
path: prebuilt
203+
key: ${{ runner.os }}-tools-${{ hashFiles('./sources/testing/cibuild.sh') }}
204+
205+
- name: Run Builds
206+
run: |
207+
git -C sources/nuttx fetch --tags
208+
cd sources/testing
209+
./cibuild.sh -i -x -G testlist/${{matrix.boards}}.dat
83210
211+
Cygwin:
212+
runs-on: windows-latest
213+
needs: Fetch-Source
214+
strategy:
215+
matrix:
216+
boards: [sim-cygwin]
84217
steps:
85-
- name: Checkout nuttx repo
86-
uses: actions/checkout@v2
87-
with:
88-
repository: apache/incubator-nuttx
89-
path: nuttx
90-
fetch-depth: 0
91-
92-
- name: Fetch nuttx tags
93-
run: |
94-
cd nuttx
95-
git fetch --tags
96-
97-
- name: Checkout apps repo
98-
uses: actions/checkout@v2
99-
with:
100-
repository: apache/incubator-nuttx-apps
101-
path: apps
102-
fetch-depth: 0
103-
104-
- name: Checkout testing repo
105-
uses: actions/checkout@v2
106-
with:
107-
repository: apache/incubator-nuttx-testing
108-
path: testing
109-
110-
- name: Restore cache
111-
id: cache-tools
112-
uses: actions/cache@v1
113-
env:
114-
cache-name: ${{ runner.os }}-cache-tools
115-
with:
116-
path: prebuilt
117-
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
118-
119-
- name: Run builds
120-
run: |
121-
cd testing
122-
./cibuild.sh -i -x -G testlist/${{matrix.boards}}.dat
218+
- name: Fetch Cached Source
219+
id: cache-source
220+
uses: actions/cache@v1
221+
with:
222+
path: sources-cache
223+
key: build-sources-${{ github.run_id }}
224+
- name: Prevent Updating Source Cache
225+
if: steps.cache-source.outputs.cache-hit == 'true'
226+
run: mv sources-cache sources
227+
- name: Download Source Artifact
228+
if: steps.cache-source.outputs.cache-hit != 'true'
229+
uses: actions/download-artifact@v1
230+
with:
231+
name: source-bundle
232+
path: ./
233+
- name: Extract Source Artifact
234+
if: steps.cache-source.outputs.cache-hit != 'true'
235+
run: tar -xf sources.tar.gz
236+
237+
- name: Write Cygwin Package List # Needed for cache key hash
238+
shell: bash
239+
run: |
240+
echo -n "\
241+
make gcc-core gcc-g++ flex git bison byacc gperf gdb unzip awk automake-1.15 autoconf wget xxd
242+
libmpc-devel libncurses-devel libmpfr-devel zlib-devel" > cyg-requirements
243+
244+
# Cache is disabled here because cache breaks symlinks on Windows (https://github.com/actions/cache/issues/120)
245+
# - name: Cached Cygwin
246+
# id: cache-cygwin
247+
# uses: actions/cache@v1
248+
# with:
249+
# path: C:\tools\cygwin\
250+
# key: cygwin-3.1.4-${{ hashFiles('cyg-requirements') }}
251+
- name: Checkout tools repo
252+
run: |
253+
git config --global core.autocrlf false # We don't want CR to be added to the files
254+
git clone --depth 1 https://bitbucket.org/nuttx/tools.git sources/tools
255+
- name: Install cygwin base packages with chocolatey
256+
# if: steps.cache-cygwin.outputs.cache-hit != 'true'
257+
shell: pwsh
258+
run: |
259+
choco install --no-progress cygwin --version 3.1.4
260+
choco install cyg-get
261+
- name: Install NuutX Build Requirements for Cygwin
262+
# if: steps.cache-cygwin.outputs.cache-hit != 'true'
263+
shell: pwsh
264+
run: |
265+
cyg-get (Get-Content cyg-requirements)
266+
- name: Set ENV
267+
run: |
268+
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
269+
270+
- name: Build CI Tools
271+
shell: cmd
272+
run: |
273+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd sources/testing && mkdir ../prebuilt && install=\"kconfig-frontends gen-romfs\" ./cibuild.sh -i"
274+
- name: Fetch Git Tags
275+
run: |
276+
git -C sources/nuttx fetch --tags
277+
- name: Reset git repos from Linux cache
278+
shell: cmd
279+
run: |
280+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd sources/nuttx && git rm --cached -r . && git reset --hard"
281+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd sources/apps && git rm --cached -r . && git reset --hard"
282+
- name: Run Builds
283+
shell: cmd
284+
run: |
285+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd sources/testing && export PATH=$PATH:`pwd`/../prebuilt/kconfig-frontends/bin:`pwd`/../prebuilt/genromfs/usr/bin && ../nuttx/tools/testbuild.sh -c -x -G -j 2 -e \"-Wno-cpp -Werror\" testlist/${{matrix.boards}}.dat"

‎testlist/sim-cygwin.dat

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/sim
2+
-sim:cxxtest
3+
-sim:nxwm
4+
-sim:rpproxy
5+
-sim:rpserver
6+
7+
# X11
8+
-sim:nxlines
9+
-sim:touchscreen
10+
-sim:nx11
11+
-sim:nsh2
12+
13+
# Network Issues
14+
-sim:module
15+
-sim:nettest
16+
-sim:tcpblaster

0 commit comments

Comments
 (0)
Please sign in to comment.