Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 38 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
branches:
- master
tags: '*'

# avoid wasted runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-unix:
runs-on: ${{ matrix.os }}
Expand All @@ -17,11 +23,28 @@ jobs:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v6
- run: make
- run: make test
- &git-checkout
name: Checkout Openlibm
uses: actions/checkout@v6
- &count-cpu
name: Count CPU cores
uses: ./.github/workflows/composite-nproc
- &make-build
name: Build with GNU Make
run: make -j${CMAKE_BUILD_PARALLEL_LEVEL}
- &make-test
name: Test with GNU Make
run: make test -j${CTEST_PARALLEL_LEVEL}
- &cmake-build
name: Build with CMake
run: cmake -Bbuild && cmake --build build
- &ctest
name: Test with CTest
run: ctest --test-dir build --output-on-failure
windows:
runs-on: windows-latest
env:
CMAKE_GENERATOR: "MinGW Makefiles"
strategy:
fail-fast: false
matrix:
Expand All @@ -34,18 +57,21 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v6
- *git-checkout
- *count-cpu
- name: Set up the desired MSYS2 environment
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: base-devel mingw-w64-${{matrix.env}}-toolchain
- run: make
- run: make test
install: base-devel mingw-w64-${{ matrix.env }}-cmake mingw-w64-${{ matrix.env }}-make mingw-w64-${{matrix.env}}-toolchain
- *make-build
- *make-test
- *cmake-build
- *ctest
code-coverage-old:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- *git-checkout
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Build and Run tests
Expand All @@ -62,20 +88,20 @@ jobs:
code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout Openlibm
uses: actions/checkout@v6
- *git-checkout
- name: Checkout Openlibm-test
uses: actions/checkout@v6
with:
repository: 'JuliaMath/openlibm-test'
path: 'openlibm-test'
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- *count-cpu
- name: Build Openlibm
run: make -j`nproc` CODE_COVERAGE=1
run: make -j${CMAKE_BUILD_PARALLEL_LEVEL} CODE_COVERAGE=1
- name: Run Test
run: |
make -j`nproc` -C openlibm-test \
make -j${CTEST_PARALLEL_LEVEL} -C openlibm-test \
USE_OPENLIBM=1 OPENLIBM_HOME="$(pwd)" \
SKIP_FP_EXCEPT_TEST=1 \
- name: Show Test Result
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/composite-nproc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Detect CPU core count
description: Set CPU core count as environment variables for parallel builds and tests

runs:

using: composite

steps:
- name: Detect CPU cores
shell: bash
id: cores
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
CORES=$(nproc)
elif [[ "$RUNNER_OS" == "macOS" ]]; then
CORES=$(sysctl -n hw.ncpu)
elif [[ "$RUNNER_OS" == "Windows" ]]; then
CORES=$NUMBER_OF_PROCESSORS
else
CORES=2
fi
echo "CMAKE_BUILD_PARALLEL_LEVEL=$CORES" >> $GITHUB_ENV
echo "CTEST_PARALLEL_LEVEL=$CORES" >> $GITHUB_ENV
echo "Detected $CORES cores"
13 changes: 10 additions & 3 deletions .github/workflows/cross-loongarch64.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# merge this file into cross.yml
# when we can `sudo apt install gcc-loongarch64-linux-gnu` on ubuntu
name: Cross
name: Cross-LoongArch64

on:
pull_request:
Expand All @@ -11,6 +11,11 @@ on:
- master
tags: '*'

# avoid wasted runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-cross-qemu:
# TODO: We need Ubuntu 24.04 to use newer version of qemu,
Expand All @@ -27,6 +32,8 @@ jobs:
TRIPLE: ${{ matrix.config.triple }}
steps:
- uses: actions/checkout@v6
- name: Count CPU cores
uses: ./.github/workflows/composite-nproc
- name: Install qemu
run: |
sudo apt update
Expand All @@ -37,12 +44,12 @@ jobs:
run: sudo apt install -y gcc-14-loongarch64-linux-gnu
- name: Build with ${{ matrix.config.triple }}-gcc
run: |
make ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
make -j${CMAKE_BUILD_PARALLEL_LEVEL} ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
CC='loongarch64-linux-gnu-gcc-14' \
AR='loongarch64-linux-gnu-gcc-ar-14' \
- name: Build tests
run: |
make -C test ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
make -C test -j${CTEST_PARALLEL_LEVEL} ARCH=$ARCH TOOLPREFIX=$TRIPLE- \
CC='loongarch64-linux-gnu-gcc-14' \
AR='loongarch64-linux-gnu-gcc-ar-14' \
- name: Run Tests
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
- master
tags: '*'

# avoid wasted runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-cross-qemu:
# TODO: We need Ubuntu 24.04 to use newer version of qemu,
Expand Down Expand Up @@ -36,14 +41,16 @@ jobs:
TRIPLE: ${{ matrix.config.triple }}
steps:
- uses: actions/checkout@v6
- name: Count CPU cores
uses: ./.github/workflows/composite-nproc
- name: Install qemu and toolchain gcc-${{ matrix.config.triple }}
run: |
sudo apt update
sudo apt install qemu-user qemu-user-binfmt gcc-$TRIPLE -y
- name: Build with ${{ matrix.config.triple }}-gcc
run: make ARCH=$ARCH TOOLPREFIX=$TRIPLE-
run: make -j${CMAKE_BUILD_PARALLEL_LEVEL} ARCH=$ARCH TOOLPREFIX=$TRIPLE-
- name: Build tests
run: make -C test ARCH=$ARCH TOOLPREFIX=$TRIPLE-
run: make -C test -j${CTEST_PARALLEL_LEVEL} ARCH=$ARCH TOOLPREFIX=$TRIPLE-
- name: Run Tests
env:
QEMU_EXEC: qemu-${{ matrix.config.arch }}
Expand Down
Loading