• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
2# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
3name: CMake on a single platform
4permissions:
5  contents: read
6
7on:
8  push:
9    branches: [ "main" ]
10  pull_request:
11    branches: [ "main" ]
12
13env:
14  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
15  BUILD_TYPE: Release
16
17jobs:
18  build:
19    # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
20    # You can convert this to a matrix build if you need cross-platform coverage.
21    # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
22    runs-on: ubuntu-latest
23
24    steps:
25    - uses: actions/checkout@v4
26      with: 
27        submodules: recursive
28        fetch-depth: 1
29
30    - name: Configure CMake
31      # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
32      # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
33      run: cd testcode/script && bash build_hitls.sh no_sctp asan gcov x86_64
34
35    - name: Build
36      # Build your program with the given configuration
37      working-directory: ${{github.workspace}}/build
38      run: make -j
39
40    - name: Test
41      working-directory: ${{github.workspace}}/testcode/script
42      # Execute tests defined by the CMake configuration.
43      run: bash build_sdv.sh no-sctp asan gcov && bash execute_sdv.sh
44
45    - name: Upload artifacts
46      uses: actions/upload-artifact@v4
47      with:
48        name: openhitls-build
49        path: ${{ github.workspace }}/build
50        retention-days: 5
51    - name: Upload coverage
52      uses: codecov/codecov-action@v5
53      env:
54        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55
56  pure-c:
57    # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
58    # You can convert this to a matrix build if you need cross-platform coverage.
59    # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
60    runs-on: ubuntu-latest
61
62    steps:
63    - uses: actions/checkout@v4
64      with: 
65        submodules: recursive
66        fetch-depth: 1
67
68    - name: Configure CMake
69      # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
70      # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
71      run: cd testcode/script && bash build_hitls.sh no_sctp asan gcov pure_c add-options="-DHITLS_ATOMIC_THREAD_LOCK"
72
73    - name: Build
74      # Build your program with the given configuration
75      working-directory: ${{github.workspace}}/build
76      run: make -j
77
78    - name: Test
79      working-directory: ${{github.workspace}}/testcode/script
80      # Execute tests defined by the CMake configuration.
81      run: bash build_sdv.sh no-sctp asan gcov add-options="-DHITLS_ATOMIC_THREAD_LOCK" && bash execute_sdv.sh
82
83    - name: Upload artifacts
84      uses: actions/upload-artifact@v4
85      with:
86        name: openhitls-pure-c
87        path: ${{ github.workspace }}/build
88        retention-days: 5
89    - name: Upload coverage
90      uses: codecov/codecov-action@v5
91      env:
92        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
93
94  mini-test:
95    uses: ./.github/workflows/minitest-reusable-job.yml
96    with:
97      param1: 'all'
98      param2: 'mini-test-pure-c'
99      param3: 'ubuntu-latest'
100
101  mini-test-x86:
102    uses: ./.github/workflows/minitest-reusable-job.yml
103    with:
104      param1: 'all x8664'
105      param2: 'mini-test-x86'
106      param3: 'ubuntu-latest'
107
108  # TODO: fix the 'Illegal instruction' when run on ubuntu-22.04-
109  #
110  # mini-test-armv8:
111  #   uses: ./.github/workflows/reusable-job.yml
112  #   with:
113  #     param1: 'all armv8'
114  #     param2: 'mini-test-armv8'
115  #     param3: 'ubuntu-22.04-arm'