Skip to content

Commit

Permalink
Merge pull request #8 from NcStudios/cal/release_workflow
Browse files Browse the repository at this point in the history
Release publishing
  • Loading branch information
McCallisterRomer authored Jul 11, 2022
2 parents 89576aa + 83add8a commit 8a526bb
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 59 deletions.
96 changes: 73 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,88 @@
name: Build

on:
workflow_dispatch:
pull_request:
branches: [ release, vnext ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.config'
- '**/*.ini'
workflow_dispatch:
inputs:
createRelease:
required: false
type: boolean

env:
VERSION: '0.1.1'

jobs:
Build:
Windows-Build:
runs-on: windows-2022
steps:
- name: Checkout Branch
uses: actions/checkout@v2

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

- name: Setup Artifact Cache
id: cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/artifacts/nc-tools.exe
key: ${{ runner.os }}_cache_key

- name: Configure
run: cmake -S ${{github.workspace}}/ -B ${{github.workspace}}/build -DNC_BUILD_TESTS=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config "Release"

# TODO: Tests are for v2 only. Enable once we start working on it again.
# - name: Run Tests
# run: ./nc-tools_tests test/collateral/input.txt

- name: Copy artifacts to cache
if: steps.cache.output.cache-hit != true
run: |
mkdir ${{ github.workspace }}/artifacts
cp ./nc-tools.exe ${{ github.workspace }}/artifacts/
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nc-tools
path: |
nc-tools.exe
CreateRelease:
runs-on: windows-2022
if: inputs.createRelease && github.ref == 'refs/heads/release'
needs: Windows-Build
steps:
- name: Checkout Branch
uses: actions/checkout@v2

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

- name: Configure
run: cmake -S ${{github.workspace}}/ -B ${{github.workspace}}/build -DNC_BUILD_TESTS=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config "Release"

- name: Run Tests
run: ./nc-tools_tests test/collateral/input.txt

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nc-tools
path: |
nc-tools.exe
- name: Setup Artifact Cache
id: cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/artifacts/nc-tools.exe
key: ${{ runner.os }}_cache_key

- name: Create archive
run: 7z a -tzip -mx=9 ${{ github.workspace }}/artifacts/nc-tools.zip ${{ github.workspace }}/artifacts/nc-tools.exe

- name: Hash artifacts
shell: pwsh
run: |
$hash = Get-FileHash -Path ${{ github.workspace }}/artifacts/nc-tools.zip -Algorithm SHA256
"nc-tools.zip {0}: {1}" -f $hash.Algorithm, $hash.Hash | Out-File -FilePath ${{ github.workspace }}/hash.txt
- name: Create release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ format('v{0}', env.VERSION) }}
body_path: ${{ github.workspace }}/hash.txt
fail_on_unmatched_files: true
files: ${{ github.workspace }}/artifacts/nc-tools.zip
29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ test/temp/
!assimp-vc143-mt.dll
!assimp-vc143-mt.lib
!assimp-vc143-mt.exp
!assimp-vc143-mt.pdb
!assimp-vc143-mt.pdb
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project("nc-tools" VERSION "0.1.0" LANGUAGES CXX)
project("nc-tools" VERSION "0.1.1" LANGUAGES CXX)

if(${PROJECT_SOURCE_DIR} EQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "Don't be a fool, out-of-source build with your tool.")
Expand All @@ -16,12 +16,17 @@ endif()

option(NC_BUILD_TESTS "Include tests in build" ON)

# Fetch Assimp
# Assimp Options
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ZLIB ON CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE)
set(ASSIMP_NO_EXPORT OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_FBX_IMPORTER ON CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_OBJ_IMPORTER ON CACHE BOOL "" FORCE)

include(FetchContent)

Expand Down
4 changes: 2 additions & 2 deletions source/Version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define NC_ASSET_TOOLS_VERSION "0.1.0"
#define NC_ASSET_TOOLS_VERSION "0.1.1"
#define NC_ASSET_TOOLS_VERSION_MAJOR "0"
#define NC_ASSET_TOOLS_VERISION_MINOR "1"
#define NC_ASSET_TOOLS_VERSION_PATCH "0"
#define NC_ASSET_TOOLS_VERSION_PATCH "1"

0 comments on commit 8a526bb

Please sign in to comment.