Skip to content

Commit

Permalink
update readme and test github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
p0358 committed Oct 24, 2024
1 parent b74dffa commit 9e31447
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 32 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

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

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: libuncso2
path: build/

- name: Test
#working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
#run: ctest --build-config ${{ matrix.build_type }}
run: ./ci/test.ps1
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ PKG is an encrypted archive file format used in Counter-Strike Online 2 and Tita

It's based on the ekey's reversing work of at [XeNTaX's forums](https://forum.xentax.com/viewtopic.php?f=21&t=11117).

Used as the back-end for the GUI program [UnCSO2](https://github.com/L-Leite/UnCSO2).
Used as the back-end for the GUI program [UnCSO2](https://github.com/harmonytf/UnCSO2).

Tested on:
- GNU/Linux - GCC 8.3.0 (32 and 64 bits)
- GNU/Linux - Clang 8.0.0 (32 and 64 bits)
- Windows 10 - MSVC 2017 (32 and 64 bits)
- GNU/Linux - GCC 8.3.0 (64 bits)
- GNU/Linux - Clang 8.0.0 (64 bits)
- Windows 10 - MSVC 2022 (64 bits)

## Features

Expand All @@ -20,10 +20,6 @@ Tested on:
- Decrypt '.e*' files, such as files with .etxt, .escv or .ecfg extensions.
- Decompress LZMA deflated textures.

## Build status

[![Build status](https://ci.appveyor.com/api/projects/status/oygibb8s9c3xxdba/branch/master?svg=true)](https://ci.appveyor.com/project/L-Leite/libuncso2/branch/master)

## Examples

Decrypting and parsing a PKG file, then, extract its entries to the disk:
Expand Down Expand Up @@ -188,8 +184,8 @@ add_subdirectory("libuncso2")
file(GLOB SOMEAPP_ALL_SOURCES
"main.cpp")
# C++17 is required
set(CMAKE_CXX_STANDARD 17)
# C++20 is required
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(someapp ${SOMEAPP_ALL_SOURCES})
Expand Down
9 changes: 3 additions & 6 deletions ci/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function SetupVsToolsPath {
# from https://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html

# split location to shorten the command
Push-Location 'C:\Program Files (x86)\Microsoft Visual Studio\2017'
Push-Location 'C:\Program Files\Microsoft Visual Studio\2022'
Push-Location '.\Community\VC\Auxiliary\Build'

cmd /c "vcvars64.bat&set" |
Expand All @@ -26,8 +26,6 @@ $curConfig = $env:CONFIGURATION

$isMsvcBuild = $curBuildCombo -eq 'windows-msvc'

$clangFsOption = 'DPKG_USE_CLANG_FSAPI=OFF';

Write-Host "Running build script..."
Write-Host "Current script build combo is: $curBuildCombo $curConfig"

Expand All @@ -43,7 +41,6 @@ switch ($curBuildCombo) {
"linux-clang" {
$targetCompilerCC = 'clang-8'
$targetCompilerCXX = 'clang++-8'
$clangFsOption = 'DPKG_USE_CLANG_FSAPI=ON';
break
}
"windows-mingw" {
Expand All @@ -54,7 +51,7 @@ switch ($curBuildCombo) {
"windows-msvc" {
$targetCompilerCC = 'cl'
$targetCompilerCXX = 'cl'
# add msvc 17 tools to path
# add msvc tools to path
SetupVsToolsPath
break
}
Expand All @@ -74,7 +71,7 @@ CreateDirectory ./build
Push-Location ./build

if ($isMsvcBuild) {
cmake -G "Visual Studio 15 2017" -A "x64" ../
cmake -G "Visual Studio 17 2022" -A "x64" ../
}
else {
cmake -G "Ninja" `
Expand Down
2 changes: 1 addition & 1 deletion ci/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function SetupVsToolsPath {
# from https://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html

# split location to shorten the command
Push-Location 'C:\Program Files (x86)\Microsoft Visual Studio\2017'
Push-Location 'C:\Program Files\Microsoft Visual Studio\2022'
Push-Location '.\Community\VC\Auxiliary\Build'

cmd /c "vcvars64.bat&set" |
Expand Down
16 changes: 2 additions & 14 deletions ci/test.ps1
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
Write-Host 'Running test script...'

$curBuildCombo = $env:BUILD_COMBO

$isMingwBuild = $curBuildCombo -eq 'windows-mingw'
$isMsvcBuild = $curBuildCombo -eq 'windows-msvc'

# go to the test binary dir
Push-Location ./build/tests

if ($isLinux) {
./pkg_test
}
elseif ($isWindows) {
if ($isMingwBuild) {
# copy libuncso2 and crypto++ dlls to the tests directory
Copy-Item "..\libuncso2.dll" -Destination ".\"
Copy-Item "..\external\cryptopp\libcryptopp.dll" -Destination ".\"
}
elseif ($isMsvcBuild) {
# copy libuncso2 dll to the tests directory
Copy-Item "..\uncso2.dll" -Destination ".\"
}
# copy libuncso2 dll to the tests directory
Copy-Item "..\uncso2.dll" -Destination ".\"

./pkg_test.exe
}
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.5
1.2.0

0 comments on commit 9e31447

Please sign in to comment.