Skip to content

Commit

Permalink
Improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Aug 18, 2024
1 parent 18f8c42 commit f0797bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 41 deletions.
52 changes: 15 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,26 @@ on:
env:
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
jobs:
build-clang:
build-sanitizers:
strategy:
matrix:
target:
- ''
- '-DMOLD_USE_ASAN=On'
- '-DMOLD_USE_TSAN=On'
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: rui314/setup-mold@staging
- name: install-build-deps
run: sudo ./install-build-deps.sh
- name: ccache
uses: hendrikmuhs/ccache-action@v1
- run: sudo ./install-build-deps.sh
- name: build
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
sudo apt-get install -y clang++-12
sudo apt-get install -y clang-18 clang gcc-multilib gdb dwarfdump zstd
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++-12 ${{ matrix.target }} ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 ${{ matrix.target }} ..
cmake --build . -j$(nproc)
- name: test
run: |
cd build
ctest -j$(nproc)
- run: ctest --test-dir build -j$(nproc)
- name: archive test results
uses: actions/upload-artifact@v3
if: failure()
Expand All @@ -39,8 +34,8 @@ jobs:
build
!build/CMakeFiles
build-gcc:
runs-on: ubuntu-20.04
build-multi-archs:
runs-on: ubuntu-latest
container: gcc:11.1.0
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -83,19 +78,13 @@ jobs:
mkdir /sde
wget -O- -q https://downloadmirror.intel.com/813591/sde-external-9.33.0-2024-01-07-lin.tar.xz | tar -C /sde --strip-components=1 --xz -xf -
ln -s /sde/sde /usr/bin
- name: ccache
uses: hendrikmuhs/ccache-action@v1
- name: build
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
mkdir build
cd build
cmake ..
cmake --build . -j$(nproc)
- name: test
run: |
cd build
ctest -j$(nproc)
- run: ctest --test-dir build -j$(nproc)
- name: archive test results
uses: actions/upload-artifact@v3
if: failure()
Expand All @@ -114,6 +103,7 @@ jobs:
- fedora
- gentoo/stage3
- opensuse/tumbleweed
- ubuntu:22.04
runs-on: ubuntu-latest
container: ${{ matrix.distro }}
steps:
Expand All @@ -125,29 +115,17 @@ jobs:
cd build
cmake ..
cmake --build . -j$(nproc)
- name: test
run: |
cd build
ctest -j$(nproc)
- run: ctest --test-dir build -j$(nproc)

build-macos:
runs-on: macos-12
strategy:
matrix:
target:
# Disable PCH for the default configuration. This prevents relying on implicit includes.
- '-DCMAKE_DISABLE_PRECOMPILE_HEADERS=On'
- '-DMOLD_USE_ASAN=On'
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
- name: build
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
mkdir build
cd build
cmake ${{ matrix.target }} ..
cmake ..
cmake --build . -j$(sysctl -n hw.physicalcpu)
build-windows:
Expand Down Expand Up @@ -176,5 +154,5 @@ jobs:
run: |
mkdir build
cd build
cmake -GNinja -DMOLD_USE_MIMALLOC=OFF -DMOLD_USE_SYSTEM_TBB=ON -DMOLD_USE_MOLD=OFF ..
cmake -GNinja -DMOLD_USE_MIMALLOC=OFF -DMOLD_USE_SYSTEM_TBB=ON ..
cmake --build . -j $(nproc)
7 changes: 3 additions & 4 deletions lib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,9 @@ inline i64 write_string(void *buf, std::string_view str) {
}

template <typename T>
inline i64 write_vector(void *buf, const std::vector<T> &vec) {
i64 sz = vec.size() * sizeof(T);
memcpy(buf, vec.data(), sz);
return sz;
inline void write_vector(void *buf, const std::vector<T> &vec) {
if (!vec.empty())
memcpy(buf, vec.data(), vec.size() * sizeof(T));
}

inline void encode_uleb(std::vector<u8> &vec, u64 val) {
Expand Down
1 change: 1 addition & 0 deletions test/arch-x86_64-incompatible-libs-linker-script2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/common.inc

nm mold | grep -q '__tsan_init' && skip
echo 'int main() {}' | $CC -m32 -o $t/exe -xc - >& /dev/null || skip

mkdir -p $t/foo
Expand Down
1 change: 1 addition & 0 deletions test/separate-debug-file.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/common.inc

nm mold | grep -q '__tsan_init' && skip
on_qemu && skip
command -v gdb >& /dev/null || skip
command -v flock >& /dev/null || skip
Expand Down

0 comments on commit f0797bb

Please sign in to comment.