|
1 | | -# this workflow will run ci |
2 | | -name: ci |
| 1 | +name: CI |
| 2 | + |
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - alpha |
7 | 7 | - beta |
8 | 8 | - master |
| 9 | + pull_request: |
9 | 10 | workflow_dispatch: |
10 | | -env: |
11 | | - zzzz1234: 1 |
| 11 | + |
12 | 12 | jobs: |
13 | | - job1: |
| 13 | + build-and-test: |
14 | 14 | strategy: |
| 15 | + fail-fast: false |
15 | 16 | matrix: |
16 | | - architecture: |
17 | | - # - arm64 |
18 | | - - x64 |
19 | | - # - x86 |
20 | | - os: |
21 | | - - macos-latest |
22 | | - - ubuntu-latest |
23 | | - # - windows-latest |
24 | | -# base - .github/workflows/ci.yml - beg |
25 | | - env: |
26 | | - CI_MATRIX_NAME: > |
27 | | - ${{ matrix.architecture }} |
28 | | - ${{ matrix.os }} |
29 | | - CI_WORKFLOW_NAME: > |
30 | | - ${{ github.workflow }} |
31 | | - - ${{ github.event_name }} |
32 | | - - ${{ github.event.inputs.workflow_dispatch_name }} |
33 | | - - ${{ github.ref_name }} |
34 | | - name: > |
35 | | - ${{ matrix.architecture }} |
36 | | - ${{ matrix.os }} |
| 17 | + os: [ubuntu-24.04, macos-latest] |
| 18 | + compiler: [gcc, clang] |
| 19 | + exclude: |
| 20 | + # macOS doesn't have gcc in GitHub Actions (it's aliased to clang) |
| 21 | + - os: macos-latest |
| 22 | + compiler: gcc |
| 23 | + |
| 24 | + name: ${{ matrix.os }} - ${{ matrix.compiler }} |
37 | 25 | runs-on: ${{ matrix.os }} |
| 26 | + |
38 | 27 | steps: |
39 | | - - run: echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # " |
40 | | - # disable autocrlf in windows |
41 | | - - run: git config --global core.autocrlf false |
42 | | - # https://github.com/actions/checkout |
43 | | - - uses: actions/checkout@v3 |
44 | | - # run nodejs coverages and tests |
45 | | - - run: sh ./ci.sh |
46 | | -# base - .github/workflows/ci.yml - end |
| 28 | + - name: Checkout code |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: recursive # if googletest is a submodule |
| 32 | + |
| 33 | + - name: Install dependencies (Ubuntu) |
| 34 | + if: runner.os == 'Linux' |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install -y cmake build-essential |
| 38 | + |
| 39 | + - name: Set compiler (GCC) |
| 40 | + if: matrix.compiler == 'gcc' |
| 41 | + run: | |
| 42 | + echo "CC=gcc" >> $GITHUB_ENV |
| 43 | + echo "CXX=g++" >> $GITHUB_ENV |
| 44 | + |
| 45 | + - name: Set compiler (Clang) |
| 46 | + if: matrix.compiler == 'clang' |
| 47 | + run: | |
| 48 | + echo "CC=clang" >> $GITHUB_ENV |
| 49 | + echo "CXX=clang++" >> $GITHUB_ENV |
| 50 | + |
| 51 | + - name: Configure CMake |
| 52 | + run: | |
| 53 | + cmake -B build \ |
| 54 | + -DCMAKE_BUILD_TYPE=Release \ |
| 55 | + -DFANN_BUILD_TESTS=ON |
| 56 | + |
| 57 | + - name: Build |
| 58 | + run: cmake --build build --config Release -j$(nproc 2>/dev/null || sysctl -n hw.ncpu) |
| 59 | + |
| 60 | + - name: Run tests |
| 61 | + working-directory: build |
| 62 | + run: ./tests/fann_tests |
0 commit comments