From c01a048d888608f546144a7b4187029ec05a6f17 Mon Sep 17 00:00:00 2001 From: Nitin Kumar <59679977+lazysegtree@users.noreply.github.com> Date: Thu, 1 Jan 2026 10:38:51 +0530 Subject: [PATCH] Fix github CI (#478) * fix: Use non deprecated upload-artifact action version * fix: Use branch name in build workflow, use latest checkout action, use cd bulid as job steps doesn't preserve current directories between themselves. * fix: remove non-existent main branch, remove deprecated ubuntu-20, removed deprecated macos-11 and macos-12, setup g++-9 and g++-10 if not exists, use latest checkout action --- .github/workflows/build.yml | 14 +++++++------- .github/workflows/cifuzz.yml | 4 ++-- .github/workflows/cmake.yml | 20 +++++++++++++------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d35680..57236e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build cxxopts on: push: - branches: [ $default-branch ] + branches: [ master ] pull_request: - branches: [ $default-branch ] + branches: [ master ] workflow_dispatch: jobs: @@ -13,12 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: setup - run: mkdir build; cd build + run: mkdir build - name: cmake - run: cmake .. + run: cd build; cmake .. - name: Build - run: make -j$(nproc) + run: cd build; make -j$(nproc) - name: test - run: ctest + run: cd build; ctest diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index f3ab108..6f97e51 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -17,8 +17,8 @@ jobs: language: c++ fuzz-seconds: 300 - name: Upload Crash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts - path: ./out/artifacts \ No newline at end of file + path: ./out/artifacts diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2967916..7b1ace0 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,9 +2,9 @@ name: CMake on: push: - branches: [ master, main ] + branches: [ master ] pull_request: - branches: [ master, main ] + branches: [ master ] workflow_dispatch: env: @@ -20,13 +20,19 @@ jobs: build-ubuntu: strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] compiler: [ g++-9, g++-10, clang++ ] name: Build and Test on Ubuntu runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Setup g++-9 if not exists + if: matrix.compiler == 'g++-9' + run: which g++-9 || (sudo apt-get update && sudo apt-get -y install g++-9) + - name: Setup g++10 if not exists + if: matrix.compiler == 'g++-10' + run: which g++10 || (sudo apt-get update && sudo apt-get -y install g++-10) - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{matrix.compiler}} - name: Build @@ -39,10 +45,10 @@ jobs: name: Build and Test on MacOS strategy: matrix: - os: [ macos-11, macos-12 ] + os: [macos-latest] runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Show compile commands @@ -58,7 +64,7 @@ jobs: name: Build and Test on Windows runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -T "ClangCl"