parent
8602f68e44
commit
2708c614ab
|
@ -10,6 +10,12 @@ else
|
|||
export CXX=g++
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
|
||||
BUILD_TAG=${GITHUB_REF_NAME}
|
||||
else
|
||||
BUILD_TAG=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
# install deps
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y libsdl2-dev > /dev/null
|
||||
|
@ -19,4 +25,10 @@ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTS=ON -DDETHRACE_WERROR=ON -B
|
|||
cmake --build build -- -j 4
|
||||
|
||||
# package artifact
|
||||
tar -czvf linux-amd64.tar.gz build/dethrace
|
||||
releasename="dethrace-${BUILD_TAG}-linux-${PLATFORM_ARCH}"
|
||||
rm -rf "$releasename"
|
||||
mkdir "$releasename"
|
||||
cp build/dethrace "$releasename/dethrace"
|
||||
tar -czvf "$releasename.tar.gz" "$releasename"
|
||||
echo "::set-output name=filename::$releasename.tar.gz"
|
||||
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
|
||||
BUILD_TAG=${GITHUB_REF_NAME}
|
||||
else
|
||||
BUILD_TAG=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
# install deps
|
||||
brew install SDL2
|
||||
|
||||
# build
|
||||
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTS=ON -DDETHRACE_WERROR=ON -B build
|
||||
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES=x86_64 -DBUILD_TESTS=ON -DDETHRACE_WERROR=ON -B build
|
||||
cmake --build build -- -j 4
|
||||
|
||||
# package artifact
|
||||
tar -czvf darwin-amd64.tar.gz build/dethrace
|
||||
releasename="dethrace-${BUILD_TAG}-darwin-${PLATFORM_ARCH}"
|
||||
rm -rf "$releasename"
|
||||
mkdir "$releasename"
|
||||
cp build/dethrace "$releasename/dethrace"
|
||||
tar -czvf "$releasename.tar.gz" "$releasename"
|
||||
echo "::set-output name=filename::$releasename.tar.gz"
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
if ($($Env:MATRIX_PLATFORM) -eq "x86") {
|
||||
if ($($Env:PLATFORM_ARCH) -eq "x86") {
|
||||
$sdl_path = "x86"
|
||||
} else {
|
||||
$sdl_path = "x64"
|
||||
}
|
||||
|
||||
if ($($Env:GITHUB_REF_TYPE) -eq "tag") {
|
||||
$build_tag=$Env:GITHUB_REF_NAME
|
||||
} else {
|
||||
$build_tag=$(git rev-parse --short HEAD)
|
||||
}
|
||||
|
||||
$sdl2_version = "2.24.0"
|
||||
|
||||
# install deps
|
||||
|
@ -18,4 +24,12 @@ cmake --build build --config RelWithDebInfo
|
|||
cp $Env:TEMP\SDL2-$sdl2_version\lib\$sdl_path\SDL2.dll build
|
||||
|
||||
# package artifact
|
||||
7z a windows-$Env:MATRIX_PLATFORM.zip .\build\dethrace.exe .\build\dethrace.pdb $Env:TEMP\SDL2-$sdl2_version\lib\$sdl_path\SDL2.dll
|
||||
$releasename="dethrace-$build_tag-windows-$Env:PLATFORM_ARCH"
|
||||
mkdir "$releasename"
|
||||
cp build/dethrace.exe "$releasename/dethrace.exe"
|
||||
cp build/dethrace.pdb "$releasename/dethrace.pdb"
|
||||
cp build/SDL2.dll "$releasename/SDL2.dll"
|
||||
|
||||
7z a -tzip "$releasename.zip" "$releasename"
|
||||
|
||||
echo "::set-output name=filename::$releasename.zip"
|
||||
|
|
|
@ -1,80 +1,27 @@
|
|||
name: CI / CD
|
||||
name: Workflow
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'ci-*'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
# bump-tag:
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
# with:
|
||||
# fetch-depth: '0'
|
||||
# - id: bump_version
|
||||
# name: Bump version and push tag
|
||||
# uses: anothrNick/github-tag-action@1.46.0
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# WITH_V: true
|
||||
# outputs:
|
||||
# new_tag: ${{ steps.bump_version.outputs.new_tag }}
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
ci:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [gcc]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.10.2
|
||||
- name: Build
|
||||
env:
|
||||
CC: ${{ steps.vars.outputs.cc }}
|
||||
CXX: ${{ steps.vars.outputs.cxx }}
|
||||
MATRIX_PLATFORM: ${{ matrix.platform }}
|
||||
run: .github/scripts/build-linux.sh
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
ctest --verbose
|
||||
- name: Upload artifact
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: artifacts
|
||||
path: linux-amd64.tar.gz
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.10.2
|
||||
- name: Build
|
||||
run: |
|
||||
.github/scripts/build-macos.sh
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
ctest --verbose
|
||||
- name: Upload artifact
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: artifacts
|
||||
path: darwin-amd64.tar.gz
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [x86, amd64]
|
||||
platform:
|
||||
- { name: Linux, os: ubuntu-latest, arch: amd64, script: build-linux.sh }
|
||||
- { name: MacOS, os: macos-latest, arch: amd64, script: build-macos.sh }
|
||||
- { name: Windows, os: windows-latest, arch: amd64, script: build-msvc.ps1 }
|
||||
- { name: Windows, os: windows-latest, arch: x86, script: build-msvc.ps1 }
|
||||
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
name: CI (${{ matrix.platform.name }} ${{ matrix.platform.arch }})
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Ninja
|
||||
|
@ -82,96 +29,46 @@ jobs:
|
|||
with:
|
||||
version: 1.10.2
|
||||
- uses: ilammy/msvc-dev-cmd@v1.4.1
|
||||
if: runner.os == 'Windows'
|
||||
with:
|
||||
arch: ${{ matrix.platform }}
|
||||
arch: ${{ matrix.platform.arch }}
|
||||
- name: Build
|
||||
run: |
|
||||
.github/scripts/build-msvc.ps1
|
||||
id: build
|
||||
run: .github/scripts/${{ matrix.platform.script }}
|
||||
env:
|
||||
MATRIX_PLATFORM: ${{ matrix.platform }}
|
||||
PLATFORM_ARCH: ${{ matrix.platform.arch }}
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
ctest --verbose -C RelWithDebInfo
|
||||
- name: Upload artifact
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/upload-artifact@v1
|
||||
ctest --verbose
|
||||
- name: Upload Artifact
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref_name == 'main'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts
|
||||
path: windows-${{ matrix.platform }}.zip
|
||||
|
||||
name: ${{ steps.build.outputs.filename }}
|
||||
path: ${{ steps.build.outputs.filename }}
|
||||
|
||||
create-release:
|
||||
needs: [build-linux, build-macos, build-windows]
|
||||
name: Create Release
|
||||
needs: [ci]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch build artifacts
|
||||
uses: actions/download-artifact@v1
|
||||
- name: Fetch Build Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: artifacts
|
||||
# - name: "Build Changelog"
|
||||
# id: build_changelog
|
||||
# uses: mikepenz/release-changelog-builder-action@v3
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# with:
|
||||
# configurationJson: |
|
||||
# {
|
||||
# "template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
|
||||
# "categories": [
|
||||
# {
|
||||
# "title": "## 🚀 Enhancements",
|
||||
# "labels": ["feature"]
|
||||
# },
|
||||
# {
|
||||
# "title": "## 🐛 Fixes",
|
||||
# "labels": ["bug"]
|
||||
# }
|
||||
# ],
|
||||
# }
|
||||
- name: Create release
|
||||
path: artifacts
|
||||
- name: Calculate Variables
|
||||
id: vars
|
||||
run: |
|
||||
echo "::set-output name=ref_name_without_v::$(echo ${GITHUB_REF_NAME} | cut -c2-20)"
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v0.1.14
|
||||
with:
|
||||
draft: false
|
||||
prerelease: false
|
||||
name: Dethrace ${{github.ref_name}}
|
||||
#body: ${{steps.build_changelog.outputs.changelog}}
|
||||
name: Dethrace ${{ steps.vars.outputs.ref_name_without_v }}
|
||||
generate_release_notes: true
|
||||
- name: Upload linux-amd64 artifact
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/linux-amd64.tar.gz
|
||||
asset_name: dethrace-${{github.ref_name}}-linux-amd64.tar.gz
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Upload darwin-amd64 artifact
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/darwin-amd64.tar.gz
|
||||
asset_name: dethrace-${{github.ref_name}}-darwin-amd64.tar.gz
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Upload windows-x86 artifact
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/windows-x86.zip
|
||||
asset_name: dethrace-${{github.ref_name}}-windows-x86.zip
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Upload windows-amd64 artifact
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/windows-amd64.zip
|
||||
asset_name: dethrace-${{github.ref_name}}-windows-amd64.zip
|
||||
asset_content_type: application/octet-stream
|
||||
files: |
|
||||
artifacts/**
|
||||
|
|
Loading…
Reference in New Issue