CI: Cleanup release process (#1659)

* ci: overhaul workflows

* ci: some fixes
This commit is contained in:
Tyler Wilding
2022-07-16 19:25:10 -04:00
committed by GitHub
parent 8005af05ee
commit 0a7a791571
22 changed files with 457 additions and 1042 deletions
+44
View File
@@ -0,0 +1,44 @@
name: Build
on:
push:
branches:
- '*'
pull_request:
branches:
- master
jobs:
# Windows
build_windows_clang:
name: "🖥️ Windows"
uses: ./.github/workflows/windows-build-clang.yaml
with:
cmakePreset: "Release-windows-clang"
cachePrefix: ""
secrets: inherit
build_windows_msvc:
name: "🖥️ Windows"
uses: ./.github/workflows/windows-build-msvc.yaml
with:
cmakePreset: "Release-windows-msvc"
cachePrefix: ""
secrets: inherit
# Linux
build_linux_clang:
name: "🐧 Linux"
uses: ./.github/workflows/linux-build-clang.yaml
with:
cmakePreset: "Release-linux-clang-asan"
cachePrefix: ""
secrets: inherit
build_linux_gcc:
name: "🐧 Linux"
uses: ./.github/workflows/linux-build-gcc.yaml
with:
cmakePreset: "Release-linux-gcc"
cachePrefix: ""
secrets: inherit
+5 -24
View File
@@ -1,4 +1,4 @@
name: Draft Release
name: 🏭 Draft Release
on:
workflow_dispatch:
@@ -17,8 +17,6 @@ jobs:
cut-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Docs - https://github.com/mathieudutour/github-tag-action
# Workflows cannot trigger other workflows implicitly
# - https://github.community/t/github-actions-workflow-not-triggering-with-tag-push/17053/7
@@ -31,24 +29,7 @@ jobs:
tag_prefix: v
default_bump: ${{ github.event.inputs.bump }}
# Generate the Release Notes
# TODO
# - name: Generate Release Notes
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COMMIT_SHA: ${{ github.SHA }}
# run: |
# cd ./.github/workflows/scripts/releases/generate-release-notes
# npm ci
# node index.js
# mv ./release-notes.md ${GITHUB_WORKSPACE}/release-notes.md
# ls
# Docs - https://github.com/softprops/action-gh-release
- name: Create a GitHub Release
uses: softprops/action-gh-release@v1
if: github.repository == 'open-goal/jak-project' && steps.tag_version.outputs.new_tag
with:
draft: true
prerelease: false
tag_name: ${{ steps.tag_version.outputs.new_tag }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
run: gh release create ${{ steps.tag_version.outputs.new_tag }} --generate-notes --draft --repo open-goal/jak-project
+1 -1
View File
@@ -14,12 +14,12 @@ on:
jobs:
inform:
name: Inform Pages Repo
if: github.repository == 'open-goal/jak-project'
runs-on: ubuntu-latest
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 10
steps:
- name: Send Dispatch
if: github.repository == 'open-goal/jak-project'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.BOT_PAT }}
@@ -1,24 +1,21 @@
name: Linter
name: Lint
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
- '*'
pull_request:
branches:
- master
jobs:
lint:
name: Linting & Formatting
name: 📝 Formatting
runs-on: ubuntu-20.04
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Get Package Dependencies
run: |
+65
View File
@@ -0,0 +1,65 @@
name: Linux Build Clang
on:
workflow_call:
inputs:
cmakePreset:
required: true
type: string
cachePrefix:
required: true
type: string
jobs:
build:
name: Clang
runs-on: ubuntu-20.04
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Package Dependencies
run: >
sudo apt install build-essential cmake
clang gcc g++ lcov make nasm libxrandr-dev
libxinerama-dev libxcursor-dev libpulse-dev
libxi-dev zip ninja-build
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: linux-ubuntu-20.04-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
- name: CMake Generation
env:
CC: clang
CXX: clang++
run: |
cmake -B build --preset=${{ inputs.cmakePreset }} \
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
- name: Build Project
run: cmake --build build -j$((`nproc`+1))
- name: Run Tests
run: ./test.sh
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: opengoal-linux-${{ inputs.cachePrefix }}
if-no-files-found: error
path: |
./build/goalc/goalc
./build/decompiler/extractor
./build/game/gk
+64
View File
@@ -0,0 +1,64 @@
name: Linux Build GCC
on:
workflow_call:
inputs:
cmakePreset:
required: true
type: string
cachePrefix:
required: true
type: string
jobs:
build:
name: GCC
runs-on: ubuntu-20.04
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Package Dependencies
run: >
sudo apt install build-essential cmake
clang gcc g++ lcov make nasm libxrandr-dev
libxinerama-dev libxcursor-dev libpulse-dev
libxi-dev zip ninja-build
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: linux-ubuntu-20.04-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
- name: CMake Generation
env:
CC: gcc
CXX: g++
run: |
cmake -B build --preset=${{ inputs.cmakePreset }} \
-DCODE_COVERAGE=ON \
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
- name: Build Project
run: cmake --build build -j$((`nproc`+1)) -- -w dupbuild=warn
- name: Run Tests - With Coverage
working-directory: ./build
run: ninja goalc-test_coverage -w dupbuild=warn
- name: Submit Coverage Report to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_KEY }}
coverage-reports: ./build/goalc-test_coverage.info
-146
View File
@@ -1,146 +0,0 @@
name: Linux
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [clang, gcc]
name: ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
# TODO - separate clang and gcc into separate workflows
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Package Dependencies
run: >
sudo apt install build-essential cmake
clang gcc g++ lcov make nasm libxrandr-dev
libxinerama-dev libxcursor-dev libpulse-dev
libxi-dev zip
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
# TODO - CMake - replace with presets!
- name: CMake Generation - Clang - ASAN
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/') == false
env:
CC: clang
CXX: clang++
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DASAN_BUILD=ON \
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
# TODO - CMake - replace with presets!
- name: CMake Generation - Clang - Statically Linked
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/')
env:
CC: clang
CXX: clang++
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DSTATICALLY_LINK=ON \
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
- name: CMake Generation - GCC
if: matrix.compiler == 'gcc'
env:
CC: gcc
CXX: g++
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCODE_COVERAGE=ON \
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
- name: Build Project
working-directory: ./build
run: make -j$((`nproc`+1))
- name: Run Tests
if: matrix.compiler == 'clang'
run: ./test.sh
- name: Run Tests - With Coverage
if: matrix.compiler == 'gcc'
run: ./test_code_coverage.sh
- name: Submit Coverage Report to Codacy
if: matrix.compiler == 'gcc'
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_KEY }}
coverage-reports: ./build/goalc-test_coverage.info
- name: Upload artifact
# NOTE - the GCC executables are huge as they've been compiled with coverage support
if: matrix.compiler == 'clang'
uses: actions/upload-artifact@v3
with:
name: opengoal-${{ matrix.os }}-${{ matrix.compiler }}
path: |
./build/**/*.so
./build/**/*.a
./build/decompiler/decompiler
./build/decompiler/extractor
./build/game/gk
./build/sound/sndplay
./build/goalc/goalc
./build/tools/dgo_packer
./build/tools/dgo_unpacker
./build/tools/memory_dump_tolls
./build/tools/level_tools/level_dump
# ---- Release / Tagging related steps ----
- name: Prepare Build Artifacts
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
run: |
mkdir -p ./ci-artifacts/out
./.github/scripts/releases/extract_build_linux.sh ./ci-artifacts/out ./
cd ci-artifacts/out
tar czf ../linux.tar.gz .
- name: Upload Assets and Potential Publish Release
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts
ASSET_EXTENSION: gz
TAG_TO_SEARCH_FOR: ${{ github.REF }}
run: |
cd ./.github/scripts/releases/upload-release-artifacts
npm ci
node index.js
+76
View File
@@ -0,0 +1,76 @@
name: 🏭 Release Pipeline
on:
push:
tags:
- v*
jobs:
# Windows
build_windows_clang:
name: "🖥️ Windows"
uses: ./.github/workflows/windows-build-clang.yaml
with:
cmakePreset: "Release-windows-clang-static"
cachePrefix: "static"
secrets: inherit
# Linux
build_linux_clang:
name: "🐧 Linux"
uses: ./.github/workflows/linux-build-clang.yaml
with:
cmakePreset: "Release-linux-clang-static"
cachePrefix: "static"
secrets: inherit
# Upload the Artifacts
upload_artifacts:
if: github.repository == 'open-goal/jak-project'
needs:
- build_windows_clang
- build_linux_clang
name: "Upload Artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare Artifact Folder
run: mkdir -p ./ci-artifacts/final
- uses: actions/download-artifact@v3
name: Download all Artifacts
with:
path: ./ci-artifacts/
- name: Display structure of downloaded files
run: ls -Rl ./ci-artifacts/
- name: Prepare Linux Release Asset
run: |
mkdir -p ./ci-artifacts/linux
./.github/scripts/releases/extract_build_linux.sh ./ci-artifacts/linux ./ci-artifacts/opengoal-linux-static ./
cd ci-artifacts/linux
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
tar czf ../final/opengoal-linux-${TAG_VAL}.tar.gz .
- name: Prepare Windows Build Asset
run: |
mkdir -p ./ci-artifacts/windows
./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/windows ./ci-artifacts/opengoal-windows-static ./
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
7z a -tzip ./ci-artifacts/final/opengoal-windows-${TAG_VAL}.zip ./ci-artifacts/windows/*
- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
gh release upload "${TAG_VAL}" ${{ github.WORKSPACE }}/ci-artifacts/final/* --repo open-goal/jak-project --clobber
- name: Publish Release
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
gh release edit ${TAG_VAL} --draft=false --repo open-goal/jak-project
@@ -20,7 +20,4 @@ jobs:
- name: commit version bump
uses: EndBug/add-and-commit@v9
with:
default_author: github_actor
author_name: "OpenGOALBot"
author_email: "OpenGOALBot@users.noreply.github.com"
message: "Updating Controller Database"
@@ -0,0 +1,58 @@
name: Windows Build Clang
on:
workflow_call:
inputs:
cmakePreset:
required: true
type: string
cachePrefix:
required: true
type: string
jobs:
build:
name: Clang
runs-on: windows-2022
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install NASM
run: choco install ${{ github.workspace }}/third-party/nasm/nasm.2.15.05.nupkg
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: windows-2022-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
- uses: ilammy/msvc-dev-cmd@v1
- name: CMake Generation
shell: cmd
run: cmake -B build --preset=${{ inputs.cmakePreset }} -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: Build Project
shell: cmd
run: cmake --build build -j 2
- name: Run Tests
timeout-minutes: 10
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: opengoal-windows-${{ inputs.cachePrefix }}
if-no-files-found: error
path: ./build/bin
+52
View File
@@ -0,0 +1,52 @@
name: Windows Build MSVC
on:
workflow_call:
inputs:
cmakePreset:
required: true
type: string
cachePrefix:
required: true
type: string
jobs:
build:
name: MSVC
runs-on: windows-2022
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install NASM
run: choco install ${{ github.workspace }}/third-party/nasm/nasm.2.15.05.nupkg
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: windows-2022-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
- uses: ilammy/msvc-dev-cmd@v1
- name: CMake Generation - MSVC
shell: cmd
run: cmake -B build --preset=${{ inputs.cmakePreset }} -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: Build Project
shell: cmd
run: |
set CL=/MP
cmake --build build -j 2
- name: Run Tests
timeout-minutes: 10
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*"
-107
View File
@@ -1,107 +0,0 @@
name: Windows
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
build:
strategy:
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
fail-fast: false
matrix:
os: [windows-2022]
compiler: [msvc, clang]
experimental: [false]
name: ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install NASM
run: choco install ${{ github.workspace }}/third-party/nasm/nasm.2.15.05.nupkg
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.3.0
with:
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
- uses: ilammy/msvc-dev-cmd@v1
# TODO - separate workflows!
- name: CMake Generation - Clang
shell: cmd
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/') == false
run: cmake -B build --preset=Release-clang -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: CMake Generation - Clang - Statically Linked
shell: cmd
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/')
run: cmake -B build --preset=Release-clang-static -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: CMake Generation - MSVC
shell: cmd
if: matrix.compiler == 'msvc'
run: cmake -B build --preset=Release-msvc -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: Build Project
shell: cmd
run: |
if "${{ matrix.compiler }}" == "msvc" (
set CL=/MP
)
cmake --build build -j 2
- name: Run Tests
timeout-minutes: 10
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*"
- name: Upload artifact
if: matrix.compiler == 'clang'
uses: actions/upload-artifact@v3
with:
name: opengoal-${{ matrix.os }}-${{ matrix.compiler }}
path: ./build/bin
# ---- Release / Tagging related steps ----
- name: Prepare Build Artifacts
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
shell: bash
run: |
mkdir -p ./ci-artifacts/out
./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/out ./
7z a -tzip ./ci-artifacts/windows.zip ./ci-artifacts/out/*
- name: Upload Assets and Potential Publish Release
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts
ASSET_EXTENSION: zip
TAG_TO_SEARCH_FOR: ${{ github.REF }}
run: |
cd ./.github/scripts/releases/upload-release-artifacts
npm ci
node index.js