Skip to content

Commit

Permalink
feat: main ci action (#11)
Browse files Browse the repository at this point in the history
+ auto build (no test suites) for msvc/clang-cl with debug/release
configuration
+ mainteinance set to on build success
+ mainteinance also updates vcpkg.json `version-date`, **not vcpkg
registry**
+ updates README.md with vcpkg version and build status accordingly
  • Loading branch information
gottyduke authored Sep 7, 2023
1 parent f9f00ec commit 2d8b65b
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 17 deletions.
File renamed without changes.
30 changes: 30 additions & 0 deletions .github/update-registry.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#Requires -Version 5

# args
param (
[string]$PathIn
)

# test-path
if (!(Test-Path "$PathIn/CommonLibSF") -or !(Test-Path "$PathIn/CommonLibSF/vcpkg.json") -or !(Test-Path "$PathIn/README.md")) {
Write-Output "::set-output name=VCPKG_SUCCESS::false"
exit
}

# commit time
$version = (Get-Date -AsUTC -Format "yyyy-MM-dd")

# update vcpkg
$vcpkg = [IO.File]::ReadAllText("$PathIn/CommonLibSF/vcpkg.json") | ConvertFrom-Json
$vcpkg.'version-date' = $version
$vcpkg = $vcpkg | ConvertTo-Json -Depth 9 | ForEach-Object { $_ -replace "(?m) (?<=^(?: )*)", " " }
[IO.File]::WriteAllText("$PathIn/CommonLibSF/vcpkg.json", $vcpkg)

# update readme
$readme = [IO.File]::ReadAllLines("$PathIn/README.md")
$readme = $readme -replace "(?<=label=vcpkg&message=).+?(?=&color)", $version
[IO.File]::WriteAllLines("$PathIn/README.md", $readme)

# status
Write-Output "::set-output name=VCPKG_SUCCESS::true"
Write-Output "::set-output name=VCPKG_VERSION::$version"
49 changes: 49 additions & 0 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Main CI

on:
push:
branches: [ main ]
paths:
- '.github/workflows/main_ci.yml'
- 'CommonLibSF/**'
pull_request:
branches: [ main, feature/* ]
workflow_dispatch:

env:
VCPKG_COMMIT_ID: 095ee8757ec933b22d445738d2dbb1ce89bb8021

jobs:
build-and-test-vcpkg:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build-type:
- debug
- release
compiler:
- msvc
- clang-cl
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup MSVC Environment
uses: ilammy/[email protected]

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}

- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.26'

- name: Generate
run: cmake -B "${{ github.workspace }}/build" -S "${{ github.workspace }}/CommonLibSF" --preset=build-debug-${{ matrix.compiler }}

- name: Build
run: cmake --build "${{ github.workspace }}/build" --config ${{ matrix.build-type }}
36 changes: 28 additions & 8 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
on: [push]
name: "Maintainance"

on:
workflow_run:
workflows: ["Main CI"]
types:
- completed

jobs:
maintainance:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

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

- shell: pwsh
run: "& ${{ github.workspace }}/CommonLibSF/cmake/make-directives.ps1 ${{ github.workspace }}/CommonLibSF"
- name: Update Starfield.h
shell: pwsh
run: "& ${{ github.workspace }}/.github/make-directives.ps1 ${{ github.workspace }}/CommonLibSF"

- uses: DoozyX/[email protected]
- name: Enforce style formatting
uses: DoozyX/[email protected]
with:
source: '.'
exclude: './docs'
extensions: 'c,cc,cpp,cxx,h,hpp,hxx,inl,inc,ixx'
extensions: 'c,cc,cpp,cppm,cxx,h,hpp,hxx,inl,inc,ixx,mxx'
clangFormatVersion: 16
inplace: True

- name: Update vcpkg version-date
id: versioning
shell: pwsh
run: "& ${{ github.workspace }}/.github/update-registry.ps1 ${{ github.workspace }}"

- name: Check for success
run: exit 1
if: ${{ steps.versioning.outputs.VCPKG_SUCCESS == 'false' }}

- uses: EndBug/add-and-commit@v9
- name: Check for commit
uses: EndBug/add-and-commit@v9
with:
author_name: maintenance
message: 'chore: maintenance'
message: 'ci: maintenance `${{ steps.versioning.outputs.VCPKG_VERSION }}`'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions CommonLibSF/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"minor": 26,
"patch": 0
},
"configurePresets": [
Expand Down Expand Up @@ -114,7 +114,7 @@
"environment": {
"CC": "clang-cl",
"CXX": "clang-cl",
"PROJECT_COMPILER_FLAGS": "/permissive- /EHsc /W4 /WX -Wno-overloaded-virtual -Wno-delete-non-abstract-non-virtual-dtor -Wno-inconsistent-missing-override -Wno-reinterpret-base-class"
"PROJECT_COMPILER_FLAGS": "/permissive- /EHsc /W4 /WX -Wno-overloaded-virtual -Wno-delete-non-abstract-non-virtual-dtor -Wno-inconsistent-missing-override -Wno-reinterpret-base-class -D__cpp_consteval"
}
},
{
Expand Down Expand Up @@ -202,7 +202,7 @@
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-minsizerel",
"buildtype-debug",
"generator-msvc",
"compiler-msvc"
]
Expand All @@ -213,7 +213,7 @@
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-minsizerel",
"buildtype-debug",
"generator-msvc",
"compiler-clang-cl"
]
Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "commonlibsf",
"version-semver": "1.0.0",
"version-date": "2023-09-07",
"port-version": 0,
"description": "CommonLibSF, the collaborative effort with advanced features for modern SFSE development.",
"homepage": "https://github.com/Starfield-Reverse-Engineering/CommonLibSF",
"license": "MIT",
"license": "GPL-3.0-or-later",
"supports": "windows & x64",
"dependencies": [
{
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

A collaborative reverse-engineered library for Starfield.

[![C++23](https://img.shields.io/static/v1?label=standard&message=c%2B%2B23&color=blue&logo=c%2B%2B&&logoColor=red&style=flat)](
https://en.cppreference.com/w/cpp/compiler_support)
[![C++23](https://img.shields.io/static/v1?label=standard&message=c%2B%2B23&color=blue&logo=c%2B%2B&&logoColor=red&style=flat)](https://en.cppreference.com/w/cpp/compiler_support)
![Platform](https://img.shields.io/static/v1?label=platform&message=windows&color=dimgray&style=flat&logo=windows)
[![Game version](https://img.shields.io/badge/game%20version-1.7.23-orange)](#use)
[![Game version](https://img.shields.io/badge/game%20version-1.7.23-orange)](#Get-started)
[![VCPKG_VER](https://img.shields.io/static/v1?label=vcpkg&message=2023-09-07&color=green&style=flat)](https://github.com/Starfield-Reverse-Engineering/Starfield-RE-vcpkg)
[![Main CI](https://img.shields.io/github/actions/workflow/status/Starfield-Reverse-Engineering/CommonLibSF/main_ci.yml)](https://github.com/Starfield-Reverse-Engineering/CommonLibSF/actions/workflows/main_ci.yml)

## Build Dependencies
+ [CMake 3.26+](https://cmake.org/)
Expand All @@ -15,6 +16,8 @@ https://en.cppreference.com/w/cpp/compiler_support)
+ Add the environment variable VCPKG_ROOT with the value as the path to the folder containing vcpkg
+ [Visual Studio Community 2022](https://visualstudio.microsoft.com/)
+ Desktop development with C++
+ *ClangCL toolset and build support if using clang-cl configuration


## Get started
### use example plugin template
Expand Down

0 comments on commit 2d8b65b

Please sign in to comment.