Skip to content

refactored container execution process #125

refactored container execution process

refactored container execution process #125

name: Automated CMake Test Workflow
on:
workflow_dispatch: # Enables manual triggering
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
issues: write
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
ccache \
build-essential \
libncurses-dev \
bsdutils \
libboost-dev \
libboost-filesystem-dev \
libboost-thread-dev \
nlohmann-json3-dev \
libcurl4-openssl-dev \
expect \
bc \
software-properties-common \
wget \
apt-transport-https \
gnupg cmake libsfml-dev libasio-dev libc6-dev
- name: Configure
run: |
cmake -B build -S . \
-D CMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build build --parallel 16 --target AppImage
- name: Test
env:
TERM: xterm-256color
run: |
ctest --test-dir build --extra-verbose -LE "NotTestable"
########################################################################
# OPEN ISSUE IF ANY TEST FAILURE OCCURRED
########################################################################
- name: Open an Issue on Test Failure
# This step runs only if a previous step in the same job has failed
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Test Failure in Automated CMake Test Workflow",
body: "# One or more tests have failed!"
})
- name: Get Git commit hash
id: get_commit
run: echo "GIT_HASH=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV
- name: Set up Git for pushing tag
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Create Git tag for release
run: |
git tag "Sysdarft.NightlyBuild.${{ env.GIT_HASH }}"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} "Sysdarft.NightlyBuild.${{ env.GIT_HASH }}"
- name: Create a GitHub release
uses: softprops/action-gh-release@v1
with:
files: build/sysdarft-system
tag_name: "Sysdarft.NightlyBuild.${{ env.GIT_HASH }}"
prerelease: true # Marking this as a pre-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: Sysdarft.NightlyBuild.${{ env.GIT_HASH }}