add option to enable testing without nel unit tests #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Snowballs: CI / CD" | |
on: | |
push: | |
branches: [ "core4", "feature/*" ] | |
paths: | |
- .github/workflows/ci-snowballs.yml | |
- snowballs2/** | |
- CMakeLists.txt | |
- CMakePresets.json | |
pull_request: | |
branches: [ "core4" ] | |
paths: | |
- .github/workflows/ci-snowballs.yml | |
- snowballs2/** | |
- CMakeLists.txt | |
- CMakePresets.json | |
jobs: | |
strings: | |
runs-on: ubuntu-latest | |
outputs: | |
build-dir: ${{ steps.strings.outputs.build-dir }} | |
install-dir: ${{ steps.strings.outputs.install-dir }} | |
build-version: ${{ steps.strings.outputs.build-version }} | |
project-name: ${{ steps.strings.outputs.project-name }} | |
steps: | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
BUILD_DIR=${{ github.workspace }}/build | |
echo "build-output-dir=${BUILD_DIR}" >> "$GITHUB_OUTPUT" | |
echo "build-dir=${BUILD_DIR}" >> "$GITHUB_OUTPUT" | |
echo "install-dir=${BUILD_DIR}/install" >> "$GITHUB_OUTPUT" | |
COMMIT_HASH=${{ github.sha }} | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
[ "$VERSION" == "main" ] && VERSION=latest | |
VERSION="$VERSION+sha.${COMMIT_HASH:0:8}" | |
echo VERSION=$VERSION | |
echo "build-version=${VERSION}" >> "$GITHUB_OUTPUT" | |
echo "project-name=snowballs" >> "$GITHUB_OUTPUT" | |
build: | |
needs: [ strings ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04 ] | |
include: | |
- os: ubuntu-22.04 | |
preset: linux-${{ needs.strings.outputs.project-name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lukka/get-cmake@latest | |
- name: Dependencies Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install --yes \ | |
build-essential ccache \ | |
bison autoconf automake \ | |
libpng-dev \ | |
libjpeg-dev \ | |
libgif-dev libfreetype6-dev \ | |
freeglut3-dev \ | |
liblua5.2-dev libluabind-dev libcpptest-dev \ | |
libogg-dev libvorbis-dev libopenal-dev \ | |
libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ | |
libmysqlclient-dev \ | |
libcurl4-openssl-dev libssl-dev \ | |
libsquish-dev \ | |
liblzma-dev \ | |
libgsf-1-dev \ | |
qtbase5-dev qttools5-dev qttools5-dev-tools \ | |
- uses: dawidd6/action-download-artifact@v6 | |
id: download-from-branch | |
with: | |
workflow: ci-nel.yml | |
workflow_conclusion: success | |
branch: "${{ github.ref }}" | |
event: push | |
name: package-nel-.* | |
name_is_regexp: true | |
path: build | |
if_no_artifact_found: ignore | |
- uses: dawidd6/action-download-artifact@v6 | |
if: ${{ ! steps.download-from-branch.outputs.found_artifact }} | |
with: | |
workflow: ci-nel.yml | |
workflow_conclusion: success | |
branch: "core4" | |
event: push | |
name: package-nel-.* | |
name_is_regexp: true | |
path: build | |
- name: Install Dependency | |
run: > | |
sh ${{ needs.strings.outputs.build-dir }}/package-nel-*/nel-*.sh | |
--skip-license | |
--include-subdir | |
--prefix=${{ needs.strings.outputs.install-dir }} | |
- name: Configure CMake | |
run: cmake --preset ${{ matrix.preset }} | |
- name: Build | |
run: cmake --build --preset ${{ needs.strings.outputs.project-name }} | |
- name: Test | |
run: ctest --preset ${{ needs.strings.outputs.project-name }} | |
- name: Package | |
run: cpack --preset ${{ needs.strings.outputs.project-name }} -R "${{ needs.strings.outputs.build-version }}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: package-${{ needs.strings.outputs.project-name }}-${{ matrix.os }}-${{ needs.strings.outputs.build-version }} | |
path: ${{ needs.strings.outputs.build-dir }}/${{ needs.strings.outputs.project-name }}-* | |