Skip to content

Commit

Permalink
refactor(CI): Added macOS targets, added publishing pipeline, and rem…
Browse files Browse the repository at this point in the history
…oved build script usage
  • Loading branch information
capnkenny authored Apr 24, 2022
1 parent 576d8e7 commit 31a3be2
Show file tree
Hide file tree
Showing 66 changed files with 1,100 additions and 1,329 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/build-system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Continuous Integration v2

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
pull_request:

jobs:
CI:
name: ${{ matrix.name }} - ${{ matrix.configuration }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}

strategy:
fail-fast: false
matrix:
configuration: [RelWithDebInfo, MinSizeRel]
os: [windows-latest, windows-2019, ubuntu-latest, macos-10.15]
include:
- os: ubuntu-latest
container: novelrt/novelrt-build:latest
profile: linux-clang10-amd64
name: Ubuntu - Clang 10
- os: windows-2019
profile: windows-vs2019-amd64
name: Windows - Visual Studio 2019
- os: windows-latest
profile: windows-vs2022-amd64
name: Windows - Visual Studio 2022
- os: macos-10.15
profile: macos-appleclang12-amd64
name: macOS 10.15 - Apple-Clang 12
configuration: Debug
- os: macos-10.15
profile: macos-appleclang12-amd64
name: macOS 10.15 - Apple-Clang 12
configuration: Release
exclude:
- os: macos-10.15
configuration: RelWithDebInfo
- os: macos-10.15
configuration: MinSizeRel

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Prepare build environment
run: |
pip3 install conan
conan config install https://github.com/NovelRT/ConanConfig.git
- name: Generate Build System
run: conan install . -if build --build=missing --profile ${{ matrix.profile }}-${{ matrix.configuration }}

- uses: novelrt/setup-cpp@v1
- name: Build and Test NovelRT - ${{ matrix.configuration }}
run: conan build . --build-folder build

- name: Publish Unit Test Results - ${{ matrix.name }} - ${{ matrix.configuration }}
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always()
with:
files: build/tests/results/*.xml

- name: Install NovelRT - ${{ matrix.configuration }}
run: cmake --install build --config "${{ matrix.configuration }}"

Formatting:
name: clang-format
runs-on: ubuntu-latest
if: "!contains(github.ref, 'main')"

steps:
- name: Checkout Code
id: checkout
uses: actions/checkout@v2

- name: Check Formatting
id: formatting
uses: DoozyX/[email protected]
with:
source: 'src tests include samples'
extensions: 'h,cpp,c,hpp'
clangFormatVersion: 10
inplace: True
style: file

- name: Confirm Results
id: results
run: scripts/ci-checkdiff.sh

- name: Upload Patch
uses: actions/upload-artifact@v1
if: ${{ failure() }}
with:
name: clang-format-patch
path: artifacts/clang-format.patch
15 changes: 12 additions & 3 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ jobs:

- name: Create documentation branch
run: git checkout -b gh-pages

- name: Prepare Secrets
run: echo "${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_WORKSPACE/secret.txt

#Mandatory step it appears otherwise pushing the commit will fail
#Switched username and e-mail to something identifiable?
- name: Configure Git
run: |
gh auth login --with-token < $GITHUB_WORKSPACE/secret.txt
git config user.name "Novel-chan"
git config user.email "[email protected]"
- name: Prepare build environment
run: |
pip3 install conan
conan config install https://github.com/NovelRT/ConanConfig.git
- name: Generate Build System
run: conan install . -if build --build=missing --profile linux-clang10-amd64-RelWithDebInfo

- name: Generate Documentation
run: scripts/cibuild.sh --documentation -DDOXYGEN_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/docs
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DDOXYGEN_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/docs
cmake --build build --config RelWithDebInfo --target Doxygen
- name: Commit Documentation Updates
if: ${{ success() }}
Expand Down
170 changes: 170 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Publish NovelRT

on:
workflow_dispatch:

jobs:
create-release:
runs-on: ubuntu-latest

outputs:
tag: ${{ steps.tag_version.outputs.new_tag }}
id: ${{ steps.create_release.outputs.id }}

steps:
- uses: actions/checkout@v2

- uses: mathieudutour/[email protected]
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: ncipollo/release-action@v1
id: create_release
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: NovelRT ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
prerelease: true
draft: true

build-release:
needs: create-release
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}

strategy:
matrix:
configuration: [ RelWithDebInfo, MinSizeRel ]
os: [ ubuntu-latest, windows-latest, macos-10.15 ]
exclude:
- os: macos-10.15
configuration: RelWithDebInfo
- os: macos-10.15
configuration: MinSizeRel
include:
- os: ubuntu-latest
container: novelrt/novelrt-build:latest
profile: linux-clang10-amd64
name: Ubuntu
- os: macos-10.15
profile: macos-appleclang12-amd64
configuration: Release
name: macOS
- os: macos-10.15
profile: macos-appleclang12-amd64
configuration: Debug
name: macOS
- os: windows-latest
profile: windows-vs2022-amd64
name: Windows
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Prepare build environment
run: |
pip3 install conan
conan config install https://github.com/NovelRT/ConanConfig.git
- name: Generate Build System
run: conan install . -if build --build=missing --profile ${{ matrix.profile }}-${{ matrix.configuration }} -o novelrt:buildsamples=False -o novelrt:buildinterop=False -o novelrt:documentation=False

- name: Build NovelRT
run: conan build . --build-folder build

- name: Install NovelRT - ${{ matrix.configuration }}
run: cmake --install build --config "${{ matrix.configuration }}"

- name: Copy Third Party Artifacts and Licence (Windows)
run: |
Get-ChildItem build/thirdparty -Filter *.dll | Copy-Item -Destination build/package/bin -Force -PassThru
Get-ChildItem . -Filter LICENCE-DIST.md | Copy-Item -Destination build/package/bin/LICENCE.md -Force -PassThru
if: "contains(matrix.os, 'windows')"

- name: Copy Third Party Artifacts and Licence (macOS)
run: |
cp -v -f build/thirdparty/*.dylib build/package/lib
cp -v -f build/thirdparty/*.json build/package/bin
cp -v -f ./LICENCE-DIST.md build/package/lib/LICENCE.md
if: "contains(matrix.os, 'macos')"

- name: Copy Licence (Ubuntu)
run: cp -v -f ./LICENCE-DIST.md build/package/lib/LICENCE.md
if: "contains(matrix.os, 'ubuntu')"

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: novelrt-${{ matrix.os }}-${{ matrix.configuration }}
path: build/package

merge-artifacts:
needs: [ build-release, create-release ]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-10.15]
include:
- os: windows-latest
name: Windows
- os: ubuntu-latest
name: Ubuntu
- os: macos-10.15
name: macOS

outputs:
release-id: ${{ needs.create-release.outputs.id }}

steps:
- uses: actions/download-artifact@v2
with:
path: artifacts
- name: Merge build artifacts
run: |
mkdir merged
for artifact in $(find ./artifacts/ -type d -name "novelrt-${{ matrix.os }}-*"); do
cp -RT "$artifact" merged/
done
- name: Upload merged artifacts
uses: actions/upload-artifact@v2
with:
name: NovelRT-${{ matrix.os }}
path: merged

- uses: actions/download-artifact@v2
with:
name: NovelRT-${{ matrix.os }}

- name: Create release artifact
run: |
cd merged
zip -r "../NovelRT-${{ needs.create-release.outputs.tag }}-${{ matrix.name }}.zip" .
cd ..
- name: Add merged artifacts to release
run: gh release upload "${{ needs.create-release.outputs.tag }}" "NovelRT-${{ needs.create-release.outputs.tag }}-${{ matrix.name }}.zip" --repo "$GITHUB_REPOSITORY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-release:
needs: merge-artifacts
runs-on: ubuntu-latest

steps:
- run: gh api "repos/$GITHUB_REPOSITORY/releases/${{ needs.merge-artifacts.outputs.release-id }}" -X PATCH -F draft=false --silent
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

delete-release:
needs: [ build-release, create-release ]
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- run: gh release delete "${{ needs.create-release.outputs.tag }}" -y --repo "$GITHUB_REPOSITORY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: gh api "repos/$GITHUB_REPOSITORY/git/refs/tags/${{ needs.create-release.outputs.tag}}" -X DELETE --silent
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

18 changes: 0 additions & 18 deletions .github/workflows/ubuntu_debug_x64.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/ubuntu_release_x64.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/windows_debug_x64.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/windows_release_x64.yml

This file was deleted.

Loading

0 comments on commit 31a3be2

Please sign in to comment.