-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (85 loc) · 2.96 KB
/
CMake_GitHub_Action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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 }}