Skip to content

Commit 58c16cb

Browse files
committed
Add GitHub Actions config [ci skip]
1 parent d52e0fa commit 58c16cb

File tree

1 file changed

+193
-0
lines changed

1 file changed

+193
-0
lines changed

.github/workflows/ci.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: GitHub Actions CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
- githubactions*
10+
- feature/**
11+
- fix/**
12+
- pr/**
13+
14+
jobs:
15+
posix:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- name: "Job 0"
21+
buildtype: "boost"
22+
packages: ""
23+
packages_to_remove: ""
24+
os: "ubuntu-16.04"
25+
cxx: "g++"
26+
sources: ""
27+
llvm_os: ""
28+
llvm_ver: ""
29+
30+
runs-on: ${{ matrix.os }}
31+
container: ${{ matrix.container }}
32+
33+
steps:
34+
- name: Check if running in container
35+
if: matrix.container != ''
36+
run: echo "GHA_CONTAINER=${{ matrix.container }}" >> $GITHUB_ENV
37+
38+
- uses: actions/checkout@v2
39+
40+
- name: linux
41+
shell: bash
42+
env:
43+
CXX: ${{ matrix.cxx }}
44+
SOURCES: ${{ matrix.sources }}
45+
LLVM_OS: ${{ matrix.llvm_os }}
46+
LLVM_VER: ${{ matrix.llvm_ver }}
47+
PACKAGES: ${{ matrix.packages }}
48+
PACKAGES_TO_REMOVE: ${{ matrix.packages_to_remove }}
49+
JOB_BUILDTYPE: ${{ matrix.buildtype }}
50+
TRAVIS_BRANCH: ${{ github.base_ref }}
51+
TRAVIS_OS_NAME: "linux"
52+
run: |
53+
echo '==================================> SETUP'
54+
echo '==================================> PACKAGES'
55+
set -e
56+
if [ -n "$PACKAGES_TO_REMOVE" ]; then sudo apt-get purge -y $PACKAGES_TO_REMOVE; fi
57+
echo ">>>>> APT: REPO.."
58+
for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done
59+
60+
if test -n "${LLVM_OS}" ; then
61+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
62+
if test -n "${LLVM_VER}" ; then
63+
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS}-${LLVM_VER} main"
64+
else
65+
# Snapshot (i.e. trunk) build of clang
66+
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS} main"
67+
fi
68+
fi
69+
echo ">>>>> APT: UPDATE.."
70+
sudo -E apt-get -o Acquire::Retries=3 update
71+
if test -n "${SOURCES}" ; then
72+
echo ">>>>> APT: INSTALL SOURCES.."
73+
for SOURCE in $SOURCES; do
74+
sudo -E apt-add-repository ppa:$SOURCE
75+
done
76+
fi
77+
echo ">>>>> APT: INSTALL ${PACKAGES}.."
78+
sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install ${PACKAGES}
79+
80+
echo '==================================> INSTALL AND COMPILE'
81+
set -e
82+
export TRAVIS_BUILD_DIR=$(pwd)
83+
export TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
84+
export VCS_COMMIT_ID=$GITHUB_SHA
85+
export GIT_COMMIT=$GITHUB_SHA
86+
export REPO_NAME=$(basename $GITHUB_REPOSITORY)
87+
export USER=$(whoami)
88+
export CC=${CC:-gcc}
89+
export PATH=~/.local/bin:/usr/local/bin:$PATH
90+
91+
if [ "$JOB_BUILDTYPE" == "boost" ]; then
92+
93+
echo '==================================> INSTALL'
94+
95+
cd ..
96+
git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
97+
cd boost-root
98+
git submodule update --init tools/build
99+
git submodule update --init libs/config
100+
git submodule update --init tools/boostdep
101+
git submodule update --init tools/boost_install
102+
git submodule update --init libs/headers
103+
cp -r $TRAVIS_BUILD_DIR/* libs/tti
104+
python tools/boostdep/depinst/depinst.py tti
105+
./bootstrap.sh
106+
./b2 headers
107+
108+
echo '==================================> SCRIPT'
109+
110+
TOOLSET=gcc,clang
111+
if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
112+
./b2 --verbose-test libs/config/test//config_info toolset=$TOOLSET || true
113+
./b2 libs/tti/test toolset=$TOOLSET
114+
115+
fi
116+
osx:
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
include:
121+
- name: "Job 1"
122+
buildtype: "boost"
123+
packages: ""
124+
os: "macos-10.15"
125+
cxx: "g++"
126+
sources: ""
127+
llvm_os: ""
128+
llvm_ver: ""
129+
xcode_version: 11.7
130+
131+
runs-on: ${{ matrix.os }}
132+
133+
steps:
134+
- uses: actions/checkout@v2
135+
136+
- name: Set DEVELOPER_DIR
137+
if: matrix.xcode_version != ''
138+
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer" >> $GITHUB_ENV
139+
- name: Test DEVELOPER_DIR
140+
run: echo $DEVELOPER_DIR
141+
142+
- name: "osx"
143+
shell: bash
144+
env:
145+
CXX: ${{ matrix.cxx }}
146+
SOURCES: ${{ matrix.sources }}
147+
LLVM_OS: ${{ matrix.llvm_os }}
148+
LLVM_VER: ${{ matrix.llvm_ver }}
149+
PACKAGES: ${{ matrix.packages }}
150+
JOB_BUILDTYPE: ${{ matrix.buildtype }}
151+
TRAVIS_BRANCH: ${{ github.base_ref }}
152+
TRAVIS_OS_NAME: "osx"
153+
run: |
154+
echo '==================================> SETUP'
155+
set -e
156+
sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools.bck
157+
echo '==================================> PACKAGES'
158+
echo '==================================> INSTALL AND COMPILE'
159+
set -e
160+
export TRAVIS_BUILD_DIR=$(pwd)
161+
export TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
162+
export VCS_COMMIT_ID=$GITHUB_SHA
163+
export GIT_COMMIT=$GITHUB_SHA
164+
export REPO_NAME=$(basename $GITHUB_REPOSITORY)
165+
export USER=$(whoami)
166+
export CC=${CC:-gcc}
167+
export PATH=~/.local/bin:/usr/local/bin:$PATH
168+
169+
if [ "$JOB_BUILDTYPE" == "boost" ]; then
170+
171+
echo '==================================> INSTALL'
172+
173+
cd ..
174+
git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
175+
cd boost-root
176+
git submodule update --init tools/build
177+
git submodule update --init libs/config
178+
git submodule update --init tools/boostdep
179+
git submodule update --init tools/boost_install
180+
git submodule update --init libs/headers
181+
cp -r $TRAVIS_BUILD_DIR/* libs/tti
182+
python tools/boostdep/depinst/depinst.py tti
183+
./bootstrap.sh
184+
./b2 headers
185+
186+
echo '==================================> SCRIPT'
187+
188+
TOOLSET=gcc,clang
189+
if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
190+
./b2 --verbose-test libs/config/test//config_info toolset=$TOOLSET || true
191+
./b2 libs/tti/test toolset=$TOOLSET
192+
193+
fi

0 commit comments

Comments
 (0)