Skip to content

Commit

Permalink
Add CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
timniederhausen committed Jul 1, 2020
1 parent b552b98 commit 2727893
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 1.0.{build}
image: Visual Studio 2017

environment:
VISUAL_STUDIO_PATH: "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Community"

matrix:
- TARGET_CPU: x86
SLUG: "win-i386"
- TARGET_CPU: x64
SLUG: "win-amd64"

branches:
except:
- infra/config

matrix:
fast_finish: true

init:
- call "%VISUAL_STUDIO_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %TARGET_CPU%

install:
# All external dependencies are installed in C:\projects\deps
- mkdir C:\projects\deps
- echo %PATH%

# Install Ninja
- set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip"
- appveyor DownloadFile %NINJA_URL% -FileName C:\projects\deps\ninja.zip
- 7z x C:\projects\deps\ninja.zip -oC:\projects\deps > nul
- ninja --version

- git fetch --tags

build_script:
- build\gen.py --use-lto --use-icf
- ninja -C out

test_script:
- out\gn_unittests.exe

after_build:
- 7z a -tzip out\gn-%SLUG%.zip .\out\gn.exe

artifacts:
- path: out\gn-$(SLUG).zip

deploy:
- provider: GitHub
auth_token:
secure: xGft8eTCnPKawtkbprgpN4z0RMU5xxmQT8nBTTF2mZzkpIhUwNM/uLDaubIlf6dL
draft: false
prerelease: false
on:
branch: master # release from master branch only
APPVEYOR_REPO_TAG: true # deploy on tag push only
115 changes: 115 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
language: cpp

env:
global:
- NINJA_LNX_ZIP: https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip
- NINJA_MAC_ZIP: https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-mac.zip

addons:
apt:
sources: &sources
# this is needed for gcc and clang
- ubuntu-toolchain-r-test

git:
# we need all everything for `git describe` to work correctly
depth: false

matrix:
include:
- compiler: gcc
os: linux
env:
- CC="gcc-8"
- CXX="g++-8"
- CFLAGS="-m32"
- LDFLAGS="-m32"
- LIBFLAGS="-m32"
- SLUG="linux-i386"
addons:
apt:
sources:
- *sources
packages:
- g++-8
- g++-8-multilib
- linux-libc-dev:i386

- compiler: gcc
os: linux
env:
- CC="gcc-8"
- CXX="g++-8"
- CFLAGS="-m64"
- SLUG="linux-amd64"
addons:
apt:
sources:
- *sources
packages:
- g++-8

- os: osx
env:
- CC="clang"
- CXX="clang++"
- CFLAGS="-m64"
- SLUG="macos-amd64"
- GEN_ARGS="--use-lto --use-icf"

install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export NINJA_ZIP="$NINJA_LNX_ZIP"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export NINJA_ZIP="$NINJA_MAC_ZIP"; fi

# Install recent Ninja
- travis_retry wget --no-check-certificate --quiet -O ninja.zip $NINJA_ZIP
- python -c 'import sys,zipfile;zipfile.ZipFile(sys.argv[1]).extractall()' ninja.zip
- chmod +x ninja

- DEPS_DIR="${HOME}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}

# following install steps are taken from
# https://github.com/boostorg/hana/blob/master/.travis.yml

############################################################################
# Install libc++ and libc++abi if needed
############################################################################
- |
if [[ "$CC" == "clang" ]]; then
LLVM_VERSION="8.0.1"
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
travis_retry wget -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm || exit 1
travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx || exit 1
travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi || exit 1
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install) || exit 1
(cd llvm/build/projects/libcxx && make install -j2) || exit 1
(cd llvm/build/projects/libcxxabi && make install -j2) || exit 1
export CXXFLAGS="-stdlib=libc++ -nostdinc++ -cxx-isystem ${DEPS_DIR}/llvm/install/include/c++/v1"
export LDFLAGS="-L ${DEPS_DIR}/llvm/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/llvm/install/lib"
fi
before_script:
- cd "${TRAVIS_BUILD_DIR}"

script:
- build/gen.py $(GEN_ARGS)
- ./ninja -C out
- out/gn_unittests

before_deploy:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -C out -czf "out/gn-${SLUG}.tar.gz" gn; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -C out -czf "out/gn-${SLUG}.tar.gz" gn -C ${DEPS_DIR}/llvm/install/lib $(ls ${DEPS_DIR}/llvm/install/lib); fi

deploy:
provider: releases
file: out/gn-${SLUG}.tar.gz
token:
secure: "uEPwiGk25/u3R1/iox2uTldRx6V3C5LOP4iwtPreg0B4Vy2Jt+WX+70XhZ9pjwrvHBzvfStJnbBIVGK26RHthxdgbHEzYAnZCEFR9A5I4oKKMHtZA4sgd4BkDja81pBPSctV2WZhYZWCNG0xYHCzCTPjW/TGTdfRwSLJ2DZOSqaai6JLnFn1bxfIPvwmR+KXlGN66QBa8+DgJh2e/J2H94odgWBAKFe2fOGm6mGSCkp+g+W+hkGS9BrVGIXwj+RmHIRd5Mllt6hCVTs14mbOr6SZKL2PR57apNmRm8SqxMngxrUvlJtI6f7ULKPM46imilXeZaHLYGVvb2PjKoU82zUtqfIAVeEdFfEuFuY8UdljEbzFNW6uo7PU3qqJKUmmzrRYf6ET7RSVXQo4v5msx/b8SN4Y+prlcwUlY0vQkOzGEyLOi8QbvnfEwpGLvgfcAllrvlOjToMXvDy/7ll16as7KH22gNlOxjli6MLaPdVfqfWZNiww3g3zWLuERsNtHU6+ZEc1d88U/AGMgCRtUGwWQ08z8DUilVZpp4g4+n5GV9Ov5+wcMc78rS+QRiyNkPWD98dh508OAv6LXJOCvHt7Oc4rzjD5PRPw4eiHzMUY9TFiiO1TAX0wVDsSS4zhCo+XjzxiKYGkXjHW1q8WVj58Vu7QdbE4mAYQepXyps0="
on:
tags: true
edge: true
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# GN

[![Build Status](https://travis-ci.com/timniederhausen/gn.svg?branch=master)](https://travis-ci.com/timniederhausen/gn)
[![Build status](https://ci.appveyor.com/api/projects/status/h6csk52w7dr73tgn/branch/master?svg=true)](https://ci.appveyor.com/project/timniederhausen/gn/branch/master)

GN is a meta-build system that generates build files for
[Ninja](https://ninja-build.org).

Expand Down
1 change: 1 addition & 0 deletions build/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ def WriteGNNinja(path, platform, host, options):
min_mac_version_flag = '-mmacosx-version-min=10.9'
cflags.append(min_mac_version_flag)
ldflags.append(min_mac_version_flag)
ldflags.append('-Wl,-rpath,@loader_path/.')
elif platform.is_aix():
cflags.append('-maix64')
ldflags.append('-maix64')
Expand Down

0 comments on commit 2727893

Please sign in to comment.