Skip to content

Commit 55ffa3e

Browse files
authored
github(actions): more github actions added (#51)
* github(actions): more github actions added
1 parent 25492c9 commit 55ffa3e

File tree

3 files changed

+155
-2
lines changed

3 files changed

+155
-2
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ name: CMake on multiple platforms
55
on:
66
push:
77
branches: ["main"]
8-
pull_request:
9-
branches: ["main", "*"]
108

119
jobs:
1210
build:
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Post examples to releases
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
12+
fail-fast: false
13+
14+
# Set up a matrix to run the following 3 configurations:
15+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
16+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
17+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
18+
#
19+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
20+
matrix:
21+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
22+
build_type: [Release]
23+
cpp_compiler: [g++, clang++, cl]
24+
exclude:
25+
# windows
26+
- os: windows-latest
27+
cpp_compiler: g++
28+
- os: windows-latest
29+
cpp_compiler: clang++
30+
# ubuntu
31+
- os: ubuntu-latest
32+
cpp_compiler: cl
33+
# ubuntu
34+
- os: ubuntu-24.04-arm
35+
cpp_compiler: cl
36+
# macos
37+
- os: macos-latest
38+
cpp_compiler: cl
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Set reusable strings
44+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
45+
id: strings
46+
shell: bash
47+
run: |
48+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
49+
50+
- name: Configure CMake
51+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
52+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
53+
run: >
54+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
55+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
56+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
57+
-S ${{ github.workspace }}
58+
59+
- name: Build
60+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
61+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
62+
63+
- name: Upload example executables
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: cpptui-examples_${{ runner.os }}_${{ runner.arch }}_${{ matrix.cpp_compiler }}
67+
path: |
68+
${{ steps.strings.outputs.build-output-dir }}/*
69+
!${{ steps.strings.outputs.build-output-dir }}/*/*
70+
!${{ steps.strings.outputs.build-output-dir }}/*.*
71+
!${{ steps.strings.outputs.build-output-dir }}/*Makefile
72+
${{ steps.strings.outputs.build-output-dir }}/Release/*
73+
74+
- name: Download examples
75+
uses: actions/download-artifact@v4
76+
with:
77+
path: artifacts
78+
79+
80+
- name: Print files
81+
run: |
82+
ls -AR artifacts/
83+
84+
- name: Create GitHub Release
85+
id: create_release
86+
87+
uses: softprops/action-gh-release@v2
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
with:
91+
files: |
92+
artifacts/*
93+
artifacts/cpptui*/*
94+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test builds on pull request
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
12+
fail-fast: false
13+
14+
# Set up a matrix to run the following 3 configurations:
15+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
16+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
17+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
18+
#
19+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
20+
matrix:
21+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
22+
build_type: [Release]
23+
cpp_compiler: [g++, clang++, cl]
24+
exclude:
25+
# windows
26+
- os: windows-latest
27+
cpp_compiler: g++
28+
- os: windows-latest
29+
cpp_compiler: clang++
30+
# ubuntu
31+
- os: ubuntu-latest
32+
cpp_compiler: cl
33+
# ubuntu
34+
- os: ubuntu-24.04-arm
35+
cpp_compiler: cl
36+
# macos
37+
- os: macos-latest
38+
cpp_compiler: cl
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Set reusable strings
44+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
45+
id: strings
46+
shell: bash
47+
run: |
48+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
49+
50+
- name: Configure CMake
51+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
52+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
53+
run: >
54+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
55+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
56+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
57+
-S ${{ github.workspace }}
58+
59+
- name: Build
60+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
61+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

0 commit comments

Comments
 (0)