build: remove Docker since it's useless and refactor CI (#6)

This commit is contained in:
6arelyFuture 2025-04-14 11:29:09 +02:00 committed by GitHub
commit 3b1787a185
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 58 additions and 90 deletions

View File

@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true
env:
PREMAKE_VERSION: "5.0.0-beta2"
PREMAKE_VERSION: "5.0.0-beta6"
jobs:
build-windows:
@ -26,8 +26,10 @@ jobs:
fail-fast: false
matrix:
configuration:
- debug
- release
compiler:
- msvc
- clang
arch:
- x86
- x64
@ -55,19 +57,24 @@ jobs:
with:
version: ${{ env.PREMAKE_VERSION }}
- name: Generate project files
- name: Generate project files (clang)
if: matrix.compiler == 'clang'
run: premake5 --cc=${{matrix.compiler}} vs2022
- name: Generate project files (msvc)
if: matrix.compiler == 'msvc'
run: premake5 vs2022
- name: Set up problem matching
uses: ammaraskar/msvc-problem-matcher@master
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/iw4-validator.sln
- name: Build ${{matrix.arch}} ${{matrix.configuration}} ${{matrix.compiler}} binaries
run: msbuild /m /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/iw4-validator.sln
- name: Upload ${{matrix.arch}} ${{matrix.configuration}} binaries
- name: Upload ${{matrix.arch}} ${{matrix.configuration}} ${{matrix.compiler}} binaries
uses: actions/upload-artifact@main
with:
name: windows-${{matrix.arch}}-${{matrix.configuration}}
name: windows-${{matrix.arch}}-${{matrix.configuration}}-${{matrix.compiler}}
path: |
build/bin/${{matrix.arch}}/${{matrix.configuration}}/iw4-validator.exe
build/bin/${{matrix.arch}}/${{matrix.configuration}}/iw4-validator.pdb
@ -75,17 +82,22 @@ jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
container: ubuntu:noble
strategy:
fail-fast: false
matrix:
configuration:
- debug
- release
arch:
- x86
- x64
- amd64
- arm64
steps:
- name: Install g++ and multilib
run: |
apt-get update
apt-get install -y wget tar git make gcc g++ gcc-multilib g++-multilib
- name: Check out files
uses: actions/checkout@main
with:
@ -96,15 +108,15 @@ jobs:
- name: Install dependencies (arm64)
if: matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install crossbuild-essential-arm64 -y
apt-get update
apt-get install -y crossbuild-essential-arm64
- name: Install dependencies (x86)
if: matrix.arch == 'x86'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install gcc-multilib g++-multilib
dpkg --add-architecture i386
apt-get update
apt-get -y install gcc-multilib g++-multilib
- name: Install Premake5
uses: diamante0018/setup-premake@master
@ -112,7 +124,7 @@ jobs:
version: ${{ env.PREMAKE_VERSION }}
- name: Generate project files
run: premake5 gmake2
run: premake5 gmake
- name: Set up problem matching
uses: ammaraskar/gcc-problem-matcher@master
@ -129,8 +141,7 @@ jobs:
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
run: |
pushd build
make config=${{matrix.configuration}}_${{matrix.arch}} -j$(nproc)
make -C build config=${{matrix.configuration}}_${{matrix.arch}} -j$(nproc)
- name: Upload ${{matrix.arch}} ${{matrix.configuration}} binaries
uses: actions/upload-artifact@main
@ -165,61 +176,3 @@ jobs:
- name: Upload iw4-validator binary
run: rsync -avz iw4-validator.exe ${{ secrets.ALTERWARE_MASTER_SSH_USER }}@${{ secrets.ALTERWARE_MASTER_SSH_ADDRESS }}:${{ env.ALTERWARE_MASTER_PATH }}/tools/
docker:
name: Create Docker Image
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: Check out files
uses: actions/checkout@main
with:
sparse-checkout: |
Dockerfile
README.md
sparse-checkout-cone-mode: false
- name: Download Release binaries
uses: actions/download-artifact@main
- name: Compress Binaries
run: |
for dir in */; do
if [[ $dir == *"windows"* ]]; then
cd "$dir" && zip -r "../${dir%/}.zip" . && cd ..
else
tar -czvf "${dir%/}.tar.gz" -C "$dir" .
fi
done
shell: bash
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.3.0
- name: Login to DockerHub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5.5.1
with:
images: |
alterware/iw4-validator
tags: |
${{ github.ref_name }}
latest
- name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v5.3.0
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -1,9 +0,0 @@
FROM alpine:latest
RUN apk add --no-cache gcompat libstdc++
COPY --chmod=755 ./linux-x64-release/iw4-validator /usr/local/bin/
RUN addgroup -S iw4 && adduser -S iw4 -G iw4
USER iw4
ENTRYPOINT ["/usr/local/bin/iw4-validator"]

View File

@ -8,7 +8,7 @@ You may use this tool to validate "client effects" GSC files for the IW4 engine
- Install [Premake5][premake5-link] and add it to your system PATH
- Clone this repository using [Git][git-link]
- Update the submodules using ``git submodule update --init --recursive``
- Run Premake with either of these two options ``premake5 vs2022`` (Windows) or ``premake5 gmake2`` (Linux/macOS)
- Run Premake with either of these two options ``premake5 vs2022`` (Windows) or ``premake5 gmake`` (Linux/macOS)
#### Command line arguments

View File

@ -6,9 +6,11 @@ targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}"
configurations {"debug", "release"}
if os.istarget("darwin") then
platforms {"x64", "arm64"}
else
if os.istarget("linux") then
platforms {"x86", "amd64", "arm64"}
elseif os.istarget("macosx") then
platforms {"amd64", "arm64"}
else
platforms {"x86", "x64", "arm64"}
end
@ -20,6 +22,10 @@ filter "platforms:x64"
architecture "x86_64"
filter {}
filter "platforms:amd64"
architecture "x86_64"
filter {}
filter "platforms:arm64"
architecture "ARM64"
filter {}
@ -39,7 +45,25 @@ filter {"system:linux", "system:macosx"}
linkoptions "-pthread"
filter {}
filter {"system:macosx", "platforms:arm64"}
if os.istarget("linux") then
-- this supports cross-compilation for arm64
filter { "toolset:clang*", "platforms:arm64" }
buildoptions "--target=arm64-linux-gnu"
linkoptions "--target=arm64-linux-gnu"
filter {}
filter { "toolset:clang*" }
-- always try to use lld. LD or Gold will not work
linkoptions "-fuse-ld=lld"
filter {}
end
filter { "system:macosx", "platforms:amd64" }
buildoptions "-arch x86_64"
linkoptions "-arch x86_64"
filter {}
filter { "system:macosx", "platforms:arm64" }
buildoptions "-arch arm64"
linkoptions "-arch arm64"
filter {}
@ -53,7 +77,7 @@ flags {"NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64Bi
filter "configurations:release"
optimize "Speed"
defines "NDEBUG"
flags "FatalCompileWarnings"
fatalwarnings {"All"}
filter {}
filter "configurations:debug"