1
+ # This is the name of the workflow, visible on GitHub UI.
2
+ name : ' Build tests'
3
+
4
+ env :
5
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
6
+ BUILD_TYPE : Release
7
+ TARGET_TEST : example
8
+
9
+ # Controls when the action will run.
10
+ # Here we tell GitHub to run the workflow when a commit.
11
+ on :
12
+ push :
13
+ pull_request :
14
+
15
+ # Scheduled the first day of every month at 00:00h UTC
16
+ schedule :
17
+ - cron : ' 0 0 1 * *'
18
+
19
+ # Allows you to run this workflow manually from the Actions tab
20
+ workflow_dispatch :
21
+
22
+ jobs :
23
+ build :
24
+
25
+ # This is the name of the job
26
+ name : ' Build for ${{ matrix.config.name }}'
27
+
28
+ # The CMake configure and build commands are platform agnostic and should work equally
29
+ # well on Windows, Linux or Mac.
30
+ runs-on : ${{ matrix.config.os }}
31
+
32
+ # Job env var for cmake build directory
33
+ env :
34
+ BUILD_DIR : ${{ github.workspace }}/build
35
+
36
+ # Here we tell GitHub that the jobs must be determined
37
+ # dynamically depending on a matrix configuration.
38
+ strategy :
39
+
40
+ # Set to false so that GitHub does not cancel all jobs
41
+ # in progress if any array job fails.
42
+ fail-fast : false
43
+
44
+ # The matrix will produce one job for each configuration:
45
+ matrix :
46
+ config :
47
+ - name : ' Linux x86_64'
48
+ os : ' ubuntu-latest'
49
+ bindir : ' echo "BIN_DIR=$BUILD_DIR" >> $GITHUB_ENV'
50
+ static : ' *.a'
51
+ dynamic : ' *.so'
52
+
53
+ - name : ' macOS Universal'
54
+ os : ' macos-latest'
55
+ bindir : ' echo "BIN_DIR=$BUILD_DIR" >> $GITHUB_ENV'
56
+ static : ' *.a'
57
+ dynamic : ' *.dylib'
58
+
59
+ - name : ' Windows x86_64'
60
+ os : ' windows-latest'
61
+ bindir : ' echo "BIN_DIR=$env:BUILD_DIR/$Env:BUILD_TYPE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append'
62
+ static : ' *.lib'
63
+ dynamic : ' *.dll'
64
+
65
+ # This is the list of steps this job will run.
66
+ steps :
67
+ # Clone repo using the checkout action.
68
+ - name : Checkout
69
+ uses : actions/checkout@v4
70
+
71
+ - name : Create Build Environment
72
+ # Some projects don't allow in-source building, so create a separate build directory
73
+ # We'll use this as our working directory for all subsequent commands
74
+ run : cmake -E make_directory ${{ env.BUILD_DIR }}
75
+
76
+ - name : Running CMake
77
+ working-directory : ${{ env.BUILD_DIR }}
78
+ run : cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
79
+
80
+ - name : Build RCSwitch Common Library
81
+ working-directory : ${{ env.BUILD_DIR }}
82
+ run : cmake --build . --config ${{ env.BUILD_TYPE }}
83
+
84
+ # Set BIN_DIR from matrix bindir command
85
+ - name : Setting the binaries directory
86
+ run : ${{ matrix.config.bindir }}
87
+
88
+ # Running the example
89
+ - name : Running the example ${{env.TARGET_TEST}}
90
+ run : ${{ env.BIN_DIR }}/${{ env.TARGET_TEST }}
91
+
92
+ # Upload binary files to artifacts
93
+ - name : Upload compiled binaries to Artifacts
94
+ uses : actions/upload-artifact@v4
95
+ with :
96
+ name : " Binaries for ${{ matrix.config.name }}"
97
+ path : |
98
+ ${{ env.BIN_DIR }}/${{ env.TARGET_TEST }}*
99
+ ${{ env.BIN_DIR }}/${{ matrix.config.static }}
100
+ ${{ env.BIN_DIR }}/${{ matrix.config.dynamic }}
0 commit comments