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

Add CI tests for Windows with Appveyor #378

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
af72234
Refs #342, adding the basic appveyor yml file
stdevPavelmc Dec 9, 2019
dade6d0
Refs #342, renamed the appveyor file
stdevPavelmc Dec 9, 2019
0365ac3
Refs #342, remove duplicates and fix some pkg names
stdevPavelmc Dec 9, 2019
c5db482
Refs #342, replace the \&\& separator by a simple ;
stdevPavelmc Dec 9, 2019
9a398a9
Refs #342, add the install of the arm toolchain
stdevPavelmc Dec 9, 2019
19cd173
Refs #342, update a dep pkg and left just one line on the build
stdevPavelmc Dec 9, 2019
79729b1
Refs #342, add the git recursive pull
stdevPavelmc Dec 9, 2019
cf9fe92
Refs #342, improved the bash syntax of verify_protob_hash.sh file
stdevPavelmc Dec 9, 2019
470a8c4
Refs #342, tweak syntax of verify_protob_hash.sh
stdevPavelmc Dec 9, 2019
346b988
Refs #342, avoid to hit the travis related stuff
stdevPavelmc Dec 9, 2019
09e8e2d
Refs #342, enable lint
stdevPavelmc Dec 9, 2019
5f92452
Refs #342, use plain clang-format
stdevPavelmc Dec 9, 2019
7855cc3
Refs #342, add yamllint dependency
stdevPavelmc Dec 9, 2019
207ed17
Refs #342, add appveyor yml file to the linter step
stdevPavelmc Dec 9, 2019
269510d
Refs #342, build tiny-firmware
stdevPavelmc Dec 9, 2019
3f9edd8
Refs #342, sudo overide
stdevPavelmc Dec 9, 2019
6293252
Refs #342, fix yml trailing spaces, as per lint output
stdevPavelmc Dec 9, 2019
9e4ed79
Refs #342, explicit sudo alias
stdevPavelmc Dec 9, 2019
8da493f
Refs #342, adding final sudo fix
stdevPavelmc Dec 9, 2019
553bf42
Refs #342, adding the sudo path to the default path
stdevPavelmc Dec 9, 2019
161fc44
Refs #342, sudo install debug
stdevPavelmc Dec 10, 2019
151bd18
Refs #342, sudo new trick
stdevPavelmc Dec 10, 2019
fe2c010
Refs #342, force correct OS whn build the protob in tiny-formware
stdevPavelmc Dec 10, 2019
27c5c5c
Refs #342, test to build it as linux
stdevPavelmc Dec 10, 2019
a4e2b65
Refs #342, resume tiny-firmware/protob-c build after a PR on that rep…
stdevPavelmc Dec 11, 2019
0440554
Refs #342, fix a missing make
stdevPavelmc Dec 11, 2019
bae7c23
Refs #342, test
stdevPavelmc Dec 11, 2019
512a62f
Refs #342, Setting the GOPATH fow windows in the env
stdevPavelmc Dec 13, 2019
20d31b7
Refs #342, modify the deletion of a simbolic link to a directory: as …
stdevPavelmc Dec 13, 2019
54997cb
Refs #342, Adding granulated Os detection, fixing the deletion of a s…
stdevPavelmc Dec 13, 2019
ac1df7e
Refs #342, use python3 for the linter
stdevPavelmc Dec 13, 2019
caa2d47
Refs #342, update the skywallet-protob submodule
stdevPavelmc Dec 13, 2019
b42149b
Refs #342, regresion, no pip3 in MSYS2 yet
stdevPavelmc Dec 13, 2019
aa36df3
Refs #342, regresion, connection: there is a pip3 in mingw64
stdevPavelmc Dec 13, 2019
61aaa98
Refs #342, force the use of python3 on every possible spot
stdevPavelmc Dec 13, 2019
15aebd9
Refs #342, force the use of python3... another
stdevPavelmc Dec 13, 2019
34e8eb1
Refs #342, touch the pacman cache to avoid warnings on the appveyor logs
stdevPavelmc Dec 14, 2019
1b385d3
Refs #342, pipw not found, revert to python 2
stdevPavelmc Dec 14, 2019
0df2061
Refs #342, debug pip, it now must point to the python3 one
stdevPavelmc Dec 14, 2019
7059189
Refs #342, more debug on pip3
stdevPavelmc Dec 14, 2019
238eba7
Refs #342, Move the PYTHON=python3 statement to the global env level,…
stdevPavelmc Dec 14, 2019
d780a67
Refs #342, fix travis build python issue, OSX can use python3 but Lin…
stdevPavelmc Dec 14, 2019
16cdab2
Refs #342, mor regresion to python2, this time in the Makefile
stdevPavelmc Dec 14, 2019
1bbb3d2
Refs #342, more regresion to python2 to make travis happy
stdevPavelmc Dec 16, 2019
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
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
language: c
matrix:
include:
- os: linux
- name: "Linux Ubuntu"
# In linux you must keep the use of python2 ot it will fail
os: linux
env:
- PIP='sudo pip'
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- os: osx
- name: "MacOS / OSX"
os: osx
env:
- PYTHON=python3

env:
global:
- GOPATH: "$HOME/go"
- APPVEYOR: false

before_script:
- mkdir -p ~/bin
Expand Down
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ define is_version_correct
$(if $(shell echo $1 | egrep '^[0-9]+\.[0-9]+\.[0-9]+$$'),1,0)
endef

ifeq ($(TRAVIS),true)
OS_NAME=$(TRAVIS_OS_NAME)
else
ifeq ($(UNAME_S),Linux)
OS_NAME=linux
endif
ifeq ($(UNAME_S),Darwin)
OS_NAME=osx
endif
UNAME_W = $(shell uname -s | cut -d "_" -f1 )
ifeq ($(UNAME_W),MINGW64)
OS_NAME=windows
endif
endif

VERSION_IS_SEMANTIC_COMPLIANT = 0
ifeq ($(call is_version_correct,$(VERSION_FIRMWARE)),0)
VERSION_FIRMWARE = $(VERSION_FIRMWARE_RAW)
Expand All @@ -69,11 +84,12 @@ ID_PRODUCT=1
LANG=1
COMBINED_VERSION=v$(VERSION_BOOTLOADER)-v$(VERSION_FIRMWARE)-$(ID_VENDOR)-$(ID_PRODUCT)-$(LANG)

ifeq ($(UNAME_S), Darwin)
ifeq ($(OS_NAME), osx)
LD_VAR=DYLD_LIBRARY_PATH
else
LD_VAR=LD_LIBRARY_PATH
endif

check-version: ## Check that the tiny-firmware/VERSION match the current tag
@./ci-scripts/version.sh > tiny-firmware/VERSION
@if [ $$VERSION_IS_SEMANTIC_COMPLIANT -eq 1 ]; then git diff --exit-code tiny-firmware/VERSION; fi
Expand All @@ -93,6 +109,7 @@ install-linters: install-linters-$(UNAME_S) ## Install code quality checking too

lint: check-format ## Check code quality
yamllint -d relaxed .travis.yml
yamllint -d relaxed appveyor.yml

format: # Format C code in the project
$(eval SRC := $(shell find . -type f -name *.c -o -name *.h | egrep -v "^(./tiny-firmware/protob/|./tiny-firmware/vendor/|./check-0.12.0)"))
Expand All @@ -105,7 +122,7 @@ build-deps: ## Build common dependencies (protob)
$(MAKE) -C tiny-firmware/protob/ build-c
# UNIX symbolic links don't supported by Windows, so the best way
# to use them is to create proper one in the begining of build
ifeq ($(OS),Windows_NT)
ifeq ($(OS_NAME), windows)
( cd ./tiny-firmware/vendor && rm skycoin-crypto)
( cd ./tiny-firmware/vendor && cmd /c 'mklink /d skycoin-crypto ..\..\skycoin-api\')
endif
Expand Down Expand Up @@ -286,7 +303,11 @@ clean-lib: ## Delete all files generated by tiny-firmware library dependencies

clean: bootloader-clean firmware-clean setup-libskycoin ## Delete all files generated by build
make -C tiny-firmware/vendor/libskycoin clean-libc
ifeq ($(OS_NAME), windows)
rm -rdf ./tiny-firmware/vendor/libskycoin
else
rm -f ./tiny-firmware/vendor/libskycoin
endif
$(MAKE) -C skycoin-api/ clean
$(MAKE) -C tiny-firmware/emulator/ clean
$(MAKE) -C tiny-firmware/protob/ clean-c
Expand Down
70 changes: 68 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,72 @@
os: Windows Server 2012 R2
platform: x64

environment:
global:
APPVEYOR: true
GOPATH: C:\Users\appveyor\go
PYTHON: python3

install:
# deps via pacman
- ps: |
$env:MSYSTEM="MINGW64"
C:\msys64\usr\bin\bash --login -c "mkdir -p /var/cache/pacman/pkg"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm unzip"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm protobuf"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-SDL2"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-check"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-clang"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-protobuf-c"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-go"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm tree"
choco install python3 --params "/InstallDir:C:\python3.8"

# ARM toolchain
- if not exist "gcc-arm-none-eabi.zip" curl -L -o gcc-arm-none-eabi.zip https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-win32.zip
- unzip -o -q gcc-arm-none-eabi.zip -d c:\gcc\
- set PATH=%PATH%;c:\gcc\bin

# git recursive
- git submodule update --init --recursive

# python stuff
- pip --version
- which pip
- pip install yamllint

# sudo stuff
- ps: |
$env:MSYSTEM="MINGW64"
C:\msys64\usr\bin\bash --login -c "curl -s https://raw.githubusercontent.com/imachug/win-sudo/master/install.sh | sh"
C:\msys64\usr\bin\bash --login -c "mkdir -p /usr/local/bin && cp ~/bin/win-sudo/s/* /usr/local/bin/"
C:\msys64\usr\bin\bash --login -c "sudo mkdir testing_sudo_power"

cache:
- gcc-arm-none-eabi.zip

build_script:
- ps: |
$env:MSYSTEM="MINGW64"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make check-protob"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make lint"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make -C tiny-firmware/protob build-c"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; FIRMWARE_SIGNATURE_PUB_KEY1=0241d51e593f681006f9f3c4a0ec744d459c960601b4ed770d979c32ace63b0a7a make test"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make clean"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make emulator"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make clean"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make bootloader-mem-protect"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make bootloader-clean"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make full-firmware
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make clean"

build: off

test_script:
- echo "No tests here yet"
- ps: |
$env:MSYSTEM="MINGW64"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; make check"

on_finish:
- ps: |
$env:MSYSTEM="MINGW64"
#C:\msys64\usr\bin\bash -l -c "cd /c/projects/skywallet-mcu ; cat ./test.log"
6 changes: 3 additions & 3 deletions ci-scripts/verify_protob_hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ PROTOB_HASH=$(git -C tiny-firmware/protob/ rev-parse HEAD)

# make sure submodule has correct origin url
SUBMODULE_ORIGIN_URL=$(git -C tiny-firmware/protob remote get-url origin)
if ! echo "$SUBMODULE_ORIGIN_URL" | grep -q "https://github.com/fibercrypto/skywallet-protob.git"; then
if ! echo "$SUBMODULE_ORIGIN_URL" | grep -q "https://github.com/fibercrypto/skywallet-protob.git" ; then
echo "invalid repository $SUBMODULE_ORIGIN_URL"
exit 1
fi

# if PR then determine base branch and do checks below
if "$TRAVIS_PULL_REQUEST" != "false" ; then
if [ "$APPVEYOR" == "false" -a "$TRAVIS_PULL_REQUEST" != "false" ] ; then
echo "Merging changes into $TRAVIS_PULL_REQUEST_BRANCH"
# fetch recent 50 commits
# hardware wallet should not get too behind protob repository
git -C tiny-firmware/protob/ fetch origin $TRAVIS_PULL_REQUEST_BRANCH
PROTOB_REMOTE_HASH=$(git -C tiny-firmware/protob log remotes/origin/$TRAVIS_PULL_REQUEST_BRANCH --pretty=oneline | head -50 | cut -c 1-40)

if ! echo "$PROTOB_REMOTE_HASH" | grep -q "$PROTOB_HASH"; then
if [ ! echo "$PROTOB_REMOTE_HASH" | grep -q "$PROTOB_HASH" ] ; then
echo "commit hash $PROTOB_HASH not present in recent 50 '$TRAVIS_PULL_REQUEST_BRANCH' commits"
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion tiny-firmware/protob
Submodule protob updated 1 files
+25 −6 Makefile