makefile: run make with -j4 on unix CIs

pull/3177/head
Delyan Angelov 2019-12-21 23:09:33 +02:00 committed by Alexander Medvednikov
parent 24739c9f5a
commit faca61c50a
3 changed files with 74 additions and 42 deletions

View File

@ -6,7 +6,7 @@ pwd
uname -a uname -a
make make -j4
./v --version ./v --version

View File

@ -2,6 +2,25 @@ name: CI
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
ubuntu-tcc:
runs-on: ubuntu-18.04
env:
VFLAGS: -cc tcc
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build v
run: echo $VFLAGS && make -j4 && ./v -o v v.v
- name: Test v->c
run: |
sudo ln -s /var/tmp/tcc/bin/tcc /usr/local/bin/tcc
tcc -version
./v -o v2 v.v # Make sure vtcc can build itself
./v test-compiler
- name: Test v binaries
run: ./v build-vbinaries
alpine-docker-musl-gcc: alpine-docker-musl-gcc:
name: alpine-musl name: alpine-musl
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -35,7 +54,7 @@ jobs:
brew install freetype glfw openssl postgres sdl2 sdl2_ttf sdl2_mixer sdl2_image brew install freetype glfw openssl postgres sdl2 sdl2_ttf sdl2_mixer sdl2_image
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/" export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V - name: Build V
run: make && ./v -o v v.v run: make -j4 && ./v -o v v.v
- name: Build V using V - name: Build V using V
run: ./v -o v2 v.v && ./v2 -o v3 v.v run: ./v -o v2 v.v && ./v2 -o v3 v.v
- name: Test symlink - name: Test symlink
@ -72,7 +91,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y postgresql libpq-dev libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y postgresql libpq-dev libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build V - name: Build V
run: make && ./v -cc gcc -o v v.v run: make -j4 && ./v -cc gcc -o v v.v
- name: Test V - name: Test V
run: ./v test-compiler run: ./v test-compiler
- name: Test v binaries - name: Test v binaries
@ -121,26 +140,6 @@ jobs:
- name: Test V - name: Test V
run: echo "test" #./v.exe examples/hello_world.v && examples/hello_world.exe run: echo "test" #./v.exe examples/hello_world.v && examples/hello_world.exe
ubuntu-tcc:
runs-on: ubuntu-18.04
env:
VFLAGS: -cc tcc
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build v
run: echo $VFLAGS && make && ./v -o v v.v
- name: Test v->c
run: |
sudo ln -s /var/tmp/tcc/bin/tcc /usr/local/bin/tcc
tcc -version
./v -o v2 v.v # Make sure vtcc can build itself
./v test-compiler
- name: Test v binaries
run: ./v build-vbinaries
ubuntu-musl: ubuntu-musl:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
env: env:
@ -153,7 +152,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y musl musl-tools libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev run: sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update; sudo apt-get install --quiet -y musl musl-tools libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build v - name: Build v
run: echo $VFLAGS && make && ./v -o v v.v run: echo $VFLAGS && make -j4 && ./v -o v v.v
- name: Test v binaries - name: Test v binaries
run: ./v build-vbinaries run: ./v build-vbinaries
# - name: Test v->js # - name: Test v->js

View File

@ -1,5 +1,14 @@
CC ?= cc CC ?= cc
VCFILE := v.c
TMPVC := /tmp/vc
TMPTCC := /var/tmp/tcc
VCREPO := https://github.com/vlang/vc
TCCREPO := https://github.com/vlang/tccbin
GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet
#### Platform detections and overrides:
_SYS := $(shell uname 2>/dev/null || echo Unknown) _SYS := $(shell uname 2>/dev/null || echo Unknown)
_SYS := $(patsubst MSYS%,MSYS,$(_SYS)) _SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS)) _SYS := $(patsubst MINGW%,MinGW,$(_SYS))
@ -20,14 +29,20 @@ ifdef ANDROID_ROOT
ANDROID := 1 ANDROID := 1
undefine LINUX undefine LINUX
endif endif
#####
all: fresh_vc fresh_tcc
ifdef WIN32 ifdef WIN32
$(CC) -std=c99 -w -o v0.exe vc/v_win.c $(LDFLAGS) TCCREPO := https://github.com/vlang/tccbin_win
VCFILE := v_win.c
endif
all: latest_vc latest_tcc
ifdef WIN32
$(CC) -std=c99 -w -o v0.exe $(TMPVC)/$(VCFILE) $(LDFLAGS)
./v0.exe -o v.exe v.v ./v0.exe -o v.exe v.v
rm -f v0.exe rm -f v0.exe
else else
$(CC) -std=gnu11 -w -o v vc/v.c $(LDFLAGS) -lm $(CC) -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm
ifdef ANDROID ifdef ANDROID
chmod 755 v chmod 755 v
endif endif
@ -35,32 +50,50 @@ endif
V_V=`git rev-parse --short HEAD`; \ V_V=`git rev-parse --short HEAD`; \
if [ $$VC_V != $$V_V ]; then \ if [ $$VC_V != $$V_V ]; then \
echo "Self rebuild ($$VC_V => $$V_V)"; \ echo "Self rebuild ($$VC_V => $$V_V)"; \
./v -o v v.v; \ $(MAKE) selfcompile; \
fi) fi)
ifndef ANDROID ifndef ANDROID
./v build module vlib/builtin > /dev/null $(MAKE) modules
./v build module vlib/strings > /dev/null
./v build module vlib/strconv > /dev/null
endif endif
endif endif
rm -rf vc/
@echo "V has been successfully built" @echo "V has been successfully built"
clean:
rm -rf $(TMPTCC)
rm -rf $(TMPVC)
git clean -xf
latest_vc: $(TMPVC)/.git/config
cd $(TMPVC) && $(GITCLEANPULL)
fresh_vc: fresh_vc:
rm -rf vc/ rm -rf $(TMPVC)
git clone --depth 1 --quiet https://github.com/vlang/vc $(GITFASTCLONE) $(VCREPO) $(TMPVC)
#cp fns.h vc/fns.h
latest_tcc: $(TMPTCC)/.git/config
ifndef ANDROID
cd $(TMPTCC) && $(GITCLEANPULL)
endif
fresh_tcc: fresh_tcc:
ifdef WIN32 ifndef ANDROID
rm -rf /var/tmp/tcc/ rm -rf $(TMPTCC)
git clone --depth 1 --quiet https://github.com/vlang/tccbin_win /var/tmp/tcc $(GITFASTCLONE) $(TCCREPO) $(TMPTCC)
endif
ifdef LINUX
rm -rf /var/tmp/tcc/
git clone --depth 1 --quiet https://github.com/vlang/tccbin /var/tmp/tcc
endif endif
$(TMPTCC)/.git/config:
$(MAKE) fresh_tcc
$(TMPVC)/.git/config:
$(MAKE) fresh_vc
selfcompile: selfcompile:
./v -o v v.v ./v -o v v.v
modules: module_builtin module_strings module_strconv
module_builtin:
./v build module vlib/builtin > /dev/null
module_strings:
./v build module vlib/strings > /dev/null
module_strconv:
./v build module vlib/strconv > /dev/null