Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Cygwin to CI #39

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,65 @@ jobs:
ccache -M 400M
ccache -c

cygwin:
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
boards: [arm-12-win, sim]

steps:
- run: git config --global core.autocrlf false
- name: Checkout nuttx repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx
path: nuttx
fetch-depth: 0

- name: Fetch nuttx tags
run: |
cd nuttx
git fetch --tags

- name: Checkout apps repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx-apps
path: apps
fetch-depth: 0

- name: Checkout testing repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx-testing
path: testing

- name: Restore tools cache
id: cache-tools
uses: actions/cache@v2
env:
cache-name: ${{ runner.os }}-cache-tools
with:
path: prebuilt
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}

- name: Install cygwin base packages with chocolatey
shell: pwsh
run: |
choco install --no-progress cygwin --version 3.1.4
choco install cyg-get
- name: Install Build Requirements for Cygwin
run: |
cyg-get make gcc-core gcc-g++ flex git bison byacc gperf gdb unzip awk `
automake-1.15 autoconf wget xxd libmpc-devel libncurses-devel `
libmpfr-devel zlib-devel patch
- name: Set Cygwin PATH env
run: |
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
echo "::add-matcher::nuttx/.github/gcc.json"
- name: Run builds
shell: cmd
run: |
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd testing &&./cibuild.sh -i testlist/${{matrix.boards}}.dat"
52 changes: 42 additions & 10 deletions cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ nuttx=$WORKSPACE/nuttx
apps=$WORKSPACE/apps
tools=$WORKSPACE/tools
prebuilt=$WORKSPACE/prebuilt
os=$(uname -s)
EXTRA_PATH=


kernel="$(uname -s)"
case $kernel in
Linux*) os=Linux;;
Darwin*) os=Darwin;;
CYGWIN*) os=Cygwin;;
MINGW*) os=MinGw;;
*) os="UNKNOWN:$kernel"
esac

case $os in
Darwin)
install="python-tools u-boot-tools elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
Expand All @@ -44,6 +53,9 @@ case $os in
Linux)
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
;;
Cygwin)
install="gen-romfs kconfig-frontends arm-gcc-toolchain"
;;
esac

function add_path {
Expand Down Expand Up @@ -115,6 +127,9 @@ function kconfig-frontends {
add_path $prebuilt/kconfig-frontends/bin

if [ ! -f "$prebuilt/kconfig-frontends/bin/kconfig-conf" ]; then
if [ ! -d "$tools" ]; then
git clone https://bitbucket.org/nuttx/tools.git $tools
fi
cd $tools/kconfig-frontends
./configure --prefix=$prebuilt/kconfig-frontends \
--disable-kconfig --disable-nconf --disable-qconf \
Expand Down Expand Up @@ -142,22 +157,33 @@ function bloaty {

function arm-gcc-toolchain {
add_path $prebuilt/gcc-arm-none-eabi/bin
urlbase="https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/"
releasebase="gcc-arm-none-eabi-9-2019-q4-major"

if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
local flavor
cd $prebuilt
local filename
case $os in
Darwin)
flavor=mac
;;
filename="$releasebase-mac.tar.bz2"
wget --quiet $urlbase/$filename
tar jxf $filename
mv $releasebase gcc-arm-none-eabi
;;
Linux)
flavor=x86_64-linux
filename="$releasebase-x86_64.tar.bz2"
wget --quiet $urlbase/$filename
tar jxf $filename
mv $releasebase gcc-arm-none-eabi
;;
Cygwin)
filename="$releasebase-win32.zip"
wget --quiet $urlbase/$filename
mkdir -p gcc-arm-none-eabi
unzip -qq $filename -d ./gcc-arm-none-eabi
;;
esac
cd $prebuilt
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
rm $filename
fi
arm-none-eabi-gcc --version
}
Expand Down Expand Up @@ -322,6 +348,9 @@ function binutils {
case $os in
Darwin)
brew install binutils
# It is possible we cached prebuilt but did brew install so recreate
# simlink if it exists
rm -f $prebuilt/bintools/bin/objcopy
ln -s /usr/local/opt/binutils/bin/objcopy $prebuilt/bintools/bin/objcopy
;;
esac
Expand Down Expand Up @@ -391,6 +420,9 @@ function run_builds {
Linux)
ncpus=`grep -c ^processor /proc/cpuinfo`
;;
Cygwin)
ncpus=`grep -c ^processor /proc/cpuinfo`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no difference between Linux and Cygwin?

;;
esac

options+="-j $ncpus"
Expand Down
5 changes: 5 additions & 0 deletions testlist/arm-12-win.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/arm/stm32f0l0g0,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we remove CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIx from all datalist?


/arm/stm32f7,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW

/arm/stm32h7,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW