Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
Fixed gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWillard committed Dec 12, 2020
1 parent 40036c9 commit 469257c
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 189 deletions.
83 changes: 59 additions & 24 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,93 @@ jobs:
buildConfig: release
displayName: grad_replay_intercept_windows
triplet: x64-windows-static
vcpkgCommitId: 'c4937039b0704c711dff11ffa729f1c105b20e42'
vcpkgPackages: 'nlohmann-json boost-program-options boost-property-tree cpr'
configuration: 'x64.*'
cmakeArgs: '-DCMAKE_BUILD_TYPE=Release'
installPath: 'install/bin/'
installPath: 'install/bin/'
- os: ubuntu-latest
buildConfig: release
displayName: grad_replay_intercept_ubuntu
triplet: x64-linux
vcpkgCommitId: 'c4937039b0704c711dff11ffa729f1c105b20e42'
vcpkgPackages: 'nlohmann-json boost-program-options boost-property-tree cpr'
configuration: 'x64.*'
cmakeArgs: '-DCMAKE_BUILD_TYPE=Release'
installPath: 'install/lib/'

steps:
- name: Use gcc-9/g++-9 on ubuntu
run: |
echo "::set-env name=CC::gcc-9"
echo "::set-env name=CXX::g++-9"
echo "CC=gcc-9" >> $GITHUB_ENV
echo "CXX=g++-9" >> $GITHUB_ENV
shell: bash
if: matrix.os == 'ubuntu-latest'

- uses: actions/checkout@v1

# Checkout
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0

- uses: lukka/get-cmake@master
- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
# Install latest CMake
- uses: lukka/get-cmake@latest

# Setup vcpkg and build deps
- name: Restore artifacts, or Run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@v2
uses: lukka/run-vcpkg@v5
id: runvcpkg
with:
vcpkgArguments: '${{ matrix.vcpkgPackages }}'
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
#setupOnly: true
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgTriplet: '${{ matrix.triplet }}'
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'
vcpkgArguments: 'nlohmann-json boost-program-options boost-property-tree cpr'
vcpkgGitCommitId: 'acb6b10e7fdf5e8519c18398d0b069e1d58ca025'

# Build with CMake and Ninja
- name: Run CMake+Ninja
uses: lukka/run-cmake@v2
uses: lukka/run-cmake@v3
id: runcmake
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildWithCMakeArgs: ' -- install -v'
buildDirectory: '${{ runner.workspace }}/b/ninja/'
cmakeAppendedArgs: '-G Ninja ${{ matrix.cmakeArgs }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install'

cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install'
useVcpkgToolchainFile: true
buildWithCMake: true

# Build the mod
- uses: gruppe-adler/action-release-with-hemtt@60f7195
name: 'Build Mod with HEMTT'
id: build

# Upload the mod
- uses: actions/upload-artifact@v1
with:
name: ${{ matrix.displayName }}
path: ${{ matrix.installPath }}
path: ${{ steps.build.outputs.release_path }}

job_release:
runs-on: windows-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [job_build_cpp]
steps:
# Download the build mod
- name: Download windows build
uses: actions/download-artifact@v2
with:
name: grad_replay_intercept_windows
- name: Download ubuntu build
uses: actions/download-artifact@v2
with:
name: grad_replay_intercept_ubuntu

# zip it
- uses: papeloto/action-zip@v1
with:
files: \@grad_replay_intercept/
dest: \@grad_replay_intercept.zip

# release it
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
files: |
\@grad_replay_intercept.zip
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
*.out
*.app

# Arma Addons
# Arma
*.pbo
*.biprivatekey
keys/*

# HEMTT
!tools/hemtt.exe
!tools/hemtt
releases/
keys/
.hemtt/local
releases/*

# Others
.vs
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ message("COMPILER USED: '${CMAKE_CXX_COMPILER_ID}'")
set(CMAKE_CL_64 ${USE_64BIT_BUILD})

if(USE_64BIT_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win64/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/lib64/")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/lib64/")
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win32/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/lib32/")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/lib32/")
endif()

set(CMAKE_CXX_STANDARD 17)
Expand All @@ -38,4 +40,4 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

add_subdirectory(src)
add_subdirectory(src)
17 changes: 8 additions & 9 deletions addons/replay_intercept/config.cpp → addons/main/config.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#include "script_component.hpp"

class CfgPatches {
class grad_replay_intercept {
class grad_replay_intercept_main {
name = "Gruppe Adler Replay Intercept Client";
units[] = {};
weapons[] = {};
requiredVersion = 1.82;
requiredVersion = 1.92;
requiredAddons[] = {"intercept_core"};
author = "Willard";
authors[] = {"Willard"};
url = "/~https://github.com/gruppe-adler";
version = "1.0";
versionStr = "1.0";
versionAr[] = {1,0};
authors[] = { "Willard" };
url = "/~https://github.com/gruppe-adler/grad_replay_intercept";
VERSION_CONFIG;
};
};
class Intercept {
class Willard {
class grad {
class grad_replay_intercept {
pluginName = "grad_replay_intercept";
};
Expand Down
1 change: 1 addition & 0 deletions addons/main/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "script_mod.hpp"
6 changes: 6 additions & 0 deletions addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "script_version.hpp"

#define VERSION MAJOR.MINOR.PATCHLVL-BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD

#define VERSION_CONFIG version = #VERSION; versionStr = #VERSION; versionAr[] = {VERSION_AR}
4 changes: 4 additions & 0 deletions addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MAJOR 1
#define MINOR 0
#define PATCHLVL 10
#define BUILD 2
95 changes: 0 additions & 95 deletions appveyor.yml

This file was deleted.

8 changes: 8 additions & 0 deletions cmake/hemtt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
find_program(HEMTT "hemtt")
if(HEMTT)
message("Found hemtt!")
execute_process(COMMAND HEMTT build --release --force-release WORKING_DIRECTORY ${SRC_PATH})
execute_process(COMMAND HEMTT zip)
else()
message("Could not find hemtt!")
endif()
68 changes: 68 additions & 0 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# From https://www.mattkeeter.com/blog/2018-01-06-versioning/

message("Writing script_version.hpp")

find_program(GIT "git")

if(GIT)
message("Found git at:")
message(${GIT})
else()
message("Did not find git!")
endif()

execute_process(COMMAND ${GIT} log --pretty=format:'%h' -n 1
OUTPUT_VARIABLE GIT_REV
WORKING_DIRECTORY ${SRCDIR}
# ERROR_QUIET
)

# Check whether we got any revision (which isn't
# always the case, e.g. when someone downloaded a zip
# file from Github instead of a checkout)
if ("${GIT_REV}" STREQUAL "")
set(VERSION_MAJOR "0")
set(VERSION_MINOR "0")
set(VERSION_PATCH "0")
set(VERSION_BUILD "0")
else()
execute_process(
COMMAND ${GIT} describe --tag --always
OUTPUT_VARIABLE GIT_TAG ERROR_QUIET
WORKING_DIRECTORY ${SRCDIR})

message("Using git tag ${GIT_TAG}")

string(REPLACE "-" ";" GIT_TAG_LIST ${GIT_TAG})
list(LENGTH GIT_TAG_LIST GIT_TAG_LIST_LENGTH)

list(GET GIT_TAG_LIST 0 VERSION_TAG)
if(GIT_TAG_LIST_LENGTH GREATER 1)
list(GET GIT_TAG_LIST 1 VERSION_BUILD)
else()
set(VERSION_BUILD "0")
endif()
message("Tag: ${VERSION_TAG}")
message("Build: ${VERSION_BUILD}")
message("")
string(REPLACE "." ";" GIT_VERSION_LIST ${VERSION_TAG})
list(GET GIT_VERSION_LIST 0 VERSION_MAJOR)
list(GET GIT_VERSION_LIST 1 VERSION_MINOR)
list(GET GIT_VERSION_LIST 2 VERSION_PATCH)
endif()

set(VERSION "#define MAJOR ${VERSION_MAJOR}
#define MINOR ${VERSION_MINOR}
#define PATCHLVL ${VERSION_PATCH}
#define BUILD ${VERSION_BUILD}
")

if(EXISTS ${VERSIONFILE_PATH})
file(READ ${VERSIONFILE_PATH} VERSION_)
else()
set(VERSION_ "")
endif()

if (NOT "${VERSION}" STREQUAL "${VERSION_}")
file(WRITE ${VERSIONFILE_PATH} "${VERSION}")
endif()
Loading

0 comments on commit 469257c

Please sign in to comment.