Skip to content

Commit

Permalink
More improvement to github action script
Browse files Browse the repository at this point in the history
make ubuntu and macos build using boost 1.79.0 too
Make use of caching for boost folder
+ some minor changes
  • Loading branch information
cyberium committed May 28, 2022
1 parent e562ffd commit 78c131d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 18 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/macos.yml
Expand Up @@ -7,13 +7,18 @@ env:
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_PLATFORM_VERSION: "11"
BOOST_VERSION: "1.79.0"
BOOST_INSTALL_DIR: "${{github.workspace}}/bin"

permissions:
contents: read

jobs:
build:
runs-on: macos-10.15
runs-on: macos-11
permissions:
contents: read

steps:
- name: Checkout
Expand All @@ -23,12 +28,38 @@ jobs:

- name: Install dependencies
run: |
brew install boost mysql-client
brew install mysql-client
brew install openssl
echo "OPENSSL_ROOT_DIR=$(brew --prefix --installed openssl)" >> $GITHUB_ENV
mkdir -p ${{env.BOOST_INSTALL_DIR}}
- name: Cache Windows boost
uses: actions/cache@v2
id: cache-boost
with:
path: "${{env.BOOST_INSTALL_DIR}}/boost"
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/macos.yml') }}

- if: steps.cache-boost.outputs.cache-hit != 'true'
name: Install boost
uses: MarkusJx/install-boost@v2.3.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# https://github.com/actions/boost-versions/blob/main/versions-manifest.json
boost_version: ${{env.BOOST_VERSION}}
# OPTIONAL: Specify a platform version
platform_version: ${{env.BOOST_PLATFORM_VERSION}}
# OPTIONAL: Specify a custom install location
boost_install_dir: ${{env.BOOST_INSTALL_DIR}}
# OPTIONAL: Specify a toolset
toolset: clang

- name: Configure
run: cmake -DBoost_ARCHITECTURE=-x64 -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}
env:
BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost"
run: cmake -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} -DBoost_ARCHITECTURE=-x64

- name: Build
env:
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/ubuntu.yml
Expand Up @@ -7,13 +7,16 @@ env:
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_PLATFORM_VERSION: "18.04"
BOOST_VERSION: "1.73.0"
BOOST_PLATFORM_VERSION: "20.04"
BOOST_VERSION: "1.79.0"
BOOST_INSTALL_DIR: "${{github.workspace}}/bin"

jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read

strategy:
matrix:
include:
Expand All @@ -40,14 +43,12 @@ jobs:

- name: Create Build Environment
run: |
echo "BOOST_ROOT=${{env.BOOST_INSTALL_DIR}}/boost/boost-${{env.BOOST_VERSION}}-linux-${{env.BOOST_PLATFORM_VERSION}}-gcc-x64" >> $GITHUB_ENV
echo "GITHUB_SHORT_REV=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "ARCHIVE_FILENAME=${{ github.event.repository.name }}-$(git rev-parse --short HEAD).zip" >> $GITHUB_ENV
echo "CC=${{matrix.COMPILER_CC}}" >> $GITHUB_ENV
echo "CXX=${{matrix.COMPILER_PP}}" >> $GITHUB_ENV
cmake -E make_directory ${{ env.BUILD_DIR }}
# install dependencies
cmake -E make_directory ${{ env.BUILD_DIR }}
- name: Cache Windows boost
uses: actions/cache@v2
id: cache-boost
Expand All @@ -57,23 +58,26 @@ jobs:

- if: steps.cache-boost.outputs.cache-hit != 'true'
name: Install boost
uses: MarkusJx/install-boost@v1.0.1
uses: MarkusJx/install-boost@v2.3.0
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# A list of supported versions can be found here:
# https://github.com/actions/boost-versions/blob/main/versions-manifest.json
boost_version: ${{env.BOOST_VERSION}}
# OPTIONAL: Specify a platform version on ubuntu
# OPTIONAL: Specify a platform version
platform_version: ${{env.BOOST_PLATFORM_VERSION}}
# OPTIONAL: Specify a custon install location
# OPTIONAL: Specify a custom install location
boost_install_dir: ${{env.BOOST_INSTALL_DIR}}
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
# OPTIONAL: Specify a toolset
toolset: ${{env.COMPILER_CC}}
# OPTIONAL: Specify an architecture
arch: x86

- name: Configure
env:
USE_PCH: ${{ matrix.USE_PCH }}
BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost"
run: cmake -DBoost_ARCHITECTURE=-x64 -DPCH=$USE_PCH -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}

- name: Build
Expand All @@ -82,10 +86,10 @@ jobs:
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}

notify:
permissions:
contents: none
name: Discord Notification
runs-on: ubuntu-20.04
permissions:
contents: none
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()
Expand All @@ -112,4 +116,3 @@ jobs:
footer: Next time ${{github.event.pusher.name}}!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png

0 comments on commit 78c131d

Please sign in to comment.