Skip to content

Commit

Permalink
🔀 Fix Github Actions workflows
Browse files Browse the repository at this point in the history
This fixes the broken Github Actions workflows, which were previously
broken by Github's removal of support for their `::set-env`
commands.

Several bugs have been discovered through this process, and several
builds are currently on-hold pending investigation. New issues have
been opened up in the Github repository to track these problems, they
are #8 and #9 respectively.

As an added benefit, the CI for this project has also been updated now
to additionally include _some_ support for sanitizers -- though these
sanitizers are not run on Ubuntu yet (pending resolution of #9).
  • Loading branch information
bitwizeshift committed Jan 5, 2021
2 parents 2479dc8 + 075f5e4 commit 644847d
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 254 deletions.
100 changes: 0 additions & 100 deletions .github/workflows/build-linux.yaml

This file was deleted.

119 changes: 70 additions & 49 deletions .github/workflows/build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,101 @@ name: build-macos
on: [push, pull_request]

jobs:
ci:
name: macOS ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
test:
name: macoS Xcode ${{matrix.compiler.version}} ${{matrix.arch}} ${{matrix.build_type}}
runs-on: macos-latest

env:
CMAKE_GENERATOR: Ninja
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
build-directory: build

strategy:
fail-fast: false
matrix:
os: [macOS-latest]
compiler: [xcode]
compiler:
- { name: "xcode", version: "12.3" }
arch: [x86_64]
build_type: [Debug, Release]

include:

- os: macOS-latest
compiler: xcode
version: "11.3"

steps:

- name: Checkout
- name: Clone
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
submodules: true

- name: Install
- name: Prepare Environment
run: |
brew install cmake ninja
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.version }}
echo "::set-env name=CC::gcc-${{ matrix.version }}"
echo "::set-env name=CXX::g++-${{ matrix.version }}"
else
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "::set-env name=CC::clang"
echo "::set-env name=CXX::clang++"
fi
python -m pip install --upgrade pip
pip install conan
conan --version
- name: Create Conan Profile
run: |
conan profile new --detect default
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{matrix.compiler.version}}.app
brew install ninja
cmake -E make_directory ${{env.build-directory}}
- name: Configure
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: |
cmake -E remove_directory build
mkdir build
cd build
conan install .. -s build_type=${{ matrix.build_type }}
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-GNinja \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \
-DALLOY_COMPILE_TESTS=On \
-DALLOY_COMPILE_EXTRAS=On \
-DALLOY_COMPILE_EXAMPLES=On \
-DALLOY_ENABLE_EXCEPTIONS=On
- name: Build
run: |
cd build
cmake --build .
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

sanitize:
name: macOS Xcode ${{matrix.compiler.version}} '${{matrix.sanitizer}}' sanitizer
runs-on: macos-latest
needs: test

env:
build-directory: build

strategy:
matrix:
sanitizer: [address, undefined]

steps:
- name: Clone
uses: actions/checkout@v2
with:
submodules: true

- name: Prepare Environment
run: |
cd build
ctest --output-on-failure
brew install ninja
cmake -E make_directory ${{env.build-directory}}
- name: Configure
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: |
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \
-DALLOY_COMPILE_TESTS=On \
-DALLOY_COMPILE_EXTRAS=On \
-DALLOY_COMPILE_EXAMPLES=On \
-DALLOY_ENABLE_EXCEPTIONS=On \
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}"
- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Sanitize)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure
124 changes: 124 additions & 0 deletions .github/workflows/build-ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: build-linux

on: [push, pull_request]

jobs:
test:
name: Ubuntu ${{matrix.compiler.cc}} ${{matrix.arch}} ${{matrix.build_type}}
runs-on: ubuntu-20.04

env:
build-directory: build

strategy:
fail-fast: false
matrix:
compiler:
- { cc: gcc-10, cxx: g++-10 }
- { cc: clang-10, cxx: clang++-10 }
arch: [x86, x86_64]
build_type: [Debug, Release]

steps:

- name: Clone
uses: actions/checkout@v2
with:
submodules: true

- name: Prepare Environment
run: |
if [[ "${{matrix.arch}}" == "x86" ]]; then
sudo dpkg --add-architecture i386
fi
sudo apt-get update
sudo apt-get install -y ninja-build
if [[ "${{matrix.compiler.cc}}" =~ "gcc" ]]; then
sudo apt-get install -y ${{matrix.compiler.cxx}} ${{matrix.compiler.cxx}}-multilib
else
sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib
fi
cmake -E make_directory ${{env.build-directory}}
- name: Prepare Architecture
run: |
if [[ "${{matrix.arch}}" = "x86" ]]; then
echo "CXXFLAGS=${CXXFLAGS} -m32" >> ${GITHUB_ENV}
fi
- name: Configure
working-directory: ${{env.build-directory}}
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \
-DALLOY_COMPILE_TESTS=On \
-DALLOY_COMPILE_EXTRAS=On \
-DALLOY_COMPILE_EXAMPLES=On \
-DALLOY_ENABLE_EXCEPTIONS=On
- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

# TODO(#9): Enable sanitizer on Ubuntu
# sanitize:
# name: ${{matrix.compiler.cc}} '${{matrix.sanitizer}}' sanitizer
# runs-on: ubuntu-20.04
# needs: test
#
# env:
# build-directory: build
#
# strategy:
# matrix:
# compiler:
# - { cc: gcc, cxx: g++ }
# - { cc: clang, cxx: clang++ }
# sanitizer: [address, undefined]
#
# steps:
# - name: Clone
# uses: actions/checkout@v2
#
# - name: Prepare Environment
# run: |
# sudo apt-get install -y ninja-build
# if [[ "${{matrix.compiler.cc}}" =~ "gcc" ]]; then
# sudo apt-get install -y ${{matrix.compiler.cxx}} ${{matrix.compiler.cxx}}-multilib
# else
# sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib
# fi
# cmake -E make_directory ${{env.build-directory}}
#
# - name: Configure
# working-directory: ${{env.build-directory}}
# env:
# CC: ${{matrix.compiler.cc}}
# CXX: ${{matrix.compiler.cxx}}
# run: |
# cmake .. \
# -GNinja \
# -DCMAKE_BUILD_TYPE=Debug \
# -DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}" \
# -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \
# -DALLOY_COMPILE_TESTS=On \
# -DALLOY_COMPILE_EXTRAS=On \
# -DALLOY_COMPILE_EXAMPLES=On \
# -DALLOY_ENABLE_EXCEPTIONS=On
#
# - name: Build
# working-directory: ${{env.build-directory}}
# run: cmake --build .
#
# - name: Test (Sanitize)
# working-directory: ${{env.build-directory}}
# run: ctest --output-on-failure
Loading

0 comments on commit 644847d

Please sign in to comment.