Skip to content

Commit

Permalink
Merge tag 'gh-action-2025-02-20' of https://github.com/ammarfaizi2/li…
Browse files Browse the repository at this point in the history
…buring

GitHub action update from Ammar Faizi:

  To maintain bisectability, build all pushed commits instead of only
  single HEAD commit.

  Link: #1352
  Link: #1227

* tag 'gh-action-2025-02-20' of https://github.com/ammarfaizi2/liburing:
  github: Rename build.yml to ci.yml
  github: Combine Codespell and Shellcheck jobs into a single YAML file
  github: Build all newly pushed commits
  • Loading branch information
axboe committed Feb 20, 2025
2 parents 66b071d + 9aeebcd commit 441d29d
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 79 deletions.
141 changes: 107 additions & 34 deletions .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
name: Build test
name: CI

on:
# Trigger the workflow on push or pull requests.
push:
pull_request:


jobs:
build:
get_commit_list:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get commit list
id: get_commit_list
run: |
git config core.abbrev 12;
( \
( \
git log --pretty="%h" --reverse ${{github.event.commits[0].id}}^...${{github.sha}} || \
(printf "%s" ${{github.sha}} | head -c 12) \
) | awk '{ print "id" NR "=" $1 }' \
) > $GITHUB_OUTPUT;
echo "List of tested commits:" > $GITHUB_STEP_SUMMARY;
cat $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY;
outputs:
commit_list: ${{ toJson(steps.*.outputs.*) }}


build:
needs: get_commit_list
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
commit: ${{ fromJson(needs.get_commit_list.outputs.commit_list) }}
build_args:
# x86-64 gcc
- arch: x86_64
cc_pkg: gcc-x86-64-linux-gnu
Expand Down Expand Up @@ -120,38 +146,85 @@ jobs:
sanitize: 0

env:
FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.extra_flags}}
SANITIZE: ${{matrix.sanitize}}
FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.build_args.extra_flags}}
SANITIZE: ${{matrix.build_args.sanitize}}

# Flags for building sources in src/ dir only.
LIBURING_CFLAGS: ${{matrix.liburing_extra_flags}}
LIBURING_CFLAGS: ${{matrix.build_args.liburing_extra_flags}}

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Install Compilers
run: |
sudo apt-get update -y;
sudo apt-get install -y ${{matrix.cc_pkg}} ${{matrix.cxx_pkg}};
- name: Display compiler versions
run: |
${{matrix.cc}} --version;
${{matrix.cxx}} --version;
- name: Build
if: ${{matrix.sanitize == '0'}}
run: |
./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}};
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
- name: Build
if: ${{matrix.sanitize == '1'}}
run: |
./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}} --enable-sanitizer;
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
- name: Test install command
run: |
sudo make install;
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Checkout commit
run: |
git checkout ${{ matrix.commit }};
- name: Install Compilers
run: |
sudo apt-get update -y;
sudo apt-get install -y ${{matrix.build_args.cc_pkg}} ${{matrix.build_args.cxx_pkg}};
- name: Display compiler versions
run: |
${{matrix.build_args.cc}} --version;
${{matrix.build_args.cxx}} --version;
- name: Build
if: ${{matrix.build_args.sanitize == '0'}}
run: |
./configure --cc=${{matrix.build_args.cc}} --cxx=${{matrix.build_args.cxx}};
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
- name: Build
if: ${{matrix.build_args.sanitize == '1'}}
run: |
./configure --cc=${{matrix.build_args.cc}} --cxx=${{matrix.build_args.cxx}} --enable-sanitizer;
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
- name: Test install command
run: |
sudo make install;
codespell:
needs: get_commit_list
runs-on: ubuntu-24.04
strategy:
matrix:
commit: ${{ fromJson(needs.get_commit_list.outputs.commit_list) }}

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Install codespell
run: |
sudo apt-get update -y
sudo apt-get install -y codespell
- name: Display codespell version
run: codespell --version

- name: Execute codespell
run: codespell --ignore-words=.github/actions/codespell/stopwords .


shellcheck:
needs: get_commit_list
runs-on: ubuntu-24.04
strategy:
matrix:
commit: ${{ fromJson(needs.get_commit_list.outputs.commit_list) }}

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Display shellcheck version
run: shellcheck --version

- name: Shellcheck execution
run: shellcheck test/runtest*.sh
25 changes: 0 additions & 25 deletions .github/workflows/codespell.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/shellcheck.yml

This file was deleted.

0 comments on commit 441d29d

Please sign in to comment.