Skip to content

Commit

Permalink
chore: Fix tsan build by moving it to GitHub CI.
Browse files Browse the repository at this point in the history
In exchange, moved some github actions to circleci.
  • Loading branch information
iphydf committed Dec 11, 2024
1 parent 6460c25 commit 4f09f4e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 87 deletions.
80 changes: 23 additions & 57 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@ version: 2

workflows:
version: 2
program-analysis:
# TODO(iphydf): Re-enable tsan when it's fixed.
circleci:
jobs:
# Dynamic analysis in the Bazel build
- bazel-asan
- bazel-msan
# - bazel-tsan
# Dynamic analysis with CMake
- asan
# - tsan
- ubsan
# Static analysis
- clang-analyze
- cpplint
- static-analysis
- cimplefmt
- generate-events

jobs:
bazel-asan:
Expand All @@ -30,20 +24,6 @@ jobs:
- run: .circleci/bazel-test
//c-toxcore/...

bazel-tsan:
working_directory: /tmp/cirrus-ci-build
docker:
- image: toxchat/toktok-stack:latest-tsan

steps:
- checkout
- run: .circleci/bazel-test
//c-toxcore/...
-//c-toxcore/auto_tests:conference_av_test
-//c-toxcore/auto_tests:conference_test
-//c-toxcore/auto_tests:onion_test
-//c-toxcore/auto_tests:tox_many_test

bazel-msan:
working_directory: /tmp/cirrus-ci-build
docker:
Expand All @@ -54,7 +34,7 @@ jobs:
- run: .circleci/bazel-test
//c-toxcore/auto_tests:lossless_packet_test

asan:
static-analysis:
working_directory: ~/work
docker:
- image: ubuntu
Expand All @@ -78,39 +58,6 @@ jobs:
llvm-dev
ninja-build
pkg-config
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-asan

tsan:
working_directory: ~/work
docker:
- image: ubuntu

steps:
- run: *apt_install
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-tsan

ubsan:
working_directory: ~/work
docker:
- image: ubuntu

steps:
- run: *apt_install
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-ubsan

static-analysis:
working_directory: ~/work
docker:
- image: ubuntu

steps:
- run: *apt_install
- run:
apt-get install -y --no-install-recommends
ca-certificates
Expand Down Expand Up @@ -147,3 +94,22 @@ jobs:
- checkout
- run: git submodule update --init --recursive
- run: other/analysis/run-cpplint

cimplefmt:
working_directory: ~/work
machine: { image: ubuntu-2204:current }

steps:
- checkout
- run: git submodule update --init --recursive
- run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]")

generate-events:
working_directory: ~/work
machine: { image: ubuntu-2204:current }

steps:
- checkout
- run: git submodule update --init --recursive
- run: other/event_tooling/run
- run: git diff --exit-code
43 changes: 20 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
tool: [autotools, clang-tidy, compcert, cppcheck, doxygen, goblint, infer, freebsd, misra, modules, pkgsrc, rpm, slimcc, sparse, tcc, tokstyle]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -34,37 +34,34 @@ jobs:
with:
file: other/docker/${{ matrix.tool }}/${{ matrix.tool }}.Dockerfile

coverage-linux:
runs-on: ubuntu-latest
sanitizer:
strategy:
fail-fast: false
matrix:
sanitizer: [asan, tsan, ubsan]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
submodules: recursive
- name: Build, test, and upload coverage
run: other/docker/coverage/run

generate-events:
runs-on: ubuntu-latest
steps:
driver: docker
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run generate_event_c
run: |
other/event_tooling/run
git diff --exit-code
- name: Run sanitizer
run: other/docker/circleci/run "${{ matrix.sanitizer }}"

cimplefmt:
runs-on: ubuntu-latest
coverage-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run cimplefmt
run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]")
- name: Build, test, and upload coverage
run: other/docker/coverage/run

build-android:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -111,7 +108,7 @@ jobs:
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 --build-config Debug
build-netbsd:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -146,7 +143,7 @@ jobs:
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
build-freebsd:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -183,7 +180,7 @@ jobs:
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
mypy:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions other/docker/circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
################################################
# cmake-asan
FROM ubuntu:20.04
FROM ubuntu:24.04

RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
clang \
cmake \
libclang-rt-dev \
libconfig-dev \
libgmock-dev \
libgtest-dev \
libopus-dev \
libsodium-dev \
libvpx-dev \
llvm-dev \
ninja-build \
pkg-config \
&& apt-get clean \
Expand All @@ -22,8 +22,8 @@ COPY entrypoint.sh /
RUN ["chmod", "755", "/entrypoint.sh"]

WORKDIR /home/builder
RUN groupadd -r -g 1000 builder \
&& useradd --no-log-init -r -g builder -u 1000 builder \
RUN groupadd -r -g 987 builder \
&& useradd --no-log-init -r -g builder -u 987 builder \
&& chown builder:builder /home/builder
USER builder

Expand Down
4 changes: 2 additions & 2 deletions other/docker/circleci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

set -eu
set -eux

SANITIZER="${1:-asan}"

cp -a /c-toxcore .
cd c-toxcore
.circleci/cmake-"$SANITIZER"
.circleci/cmake-"$SANITIZER" || (cat /home/builder/c-toxcore/_build/CMakeFiles/CMakeError.log && false)
10 changes: 9 additions & 1 deletion other/docker/circleci/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/sh

set -eux

SANITIZER="${1:-asan}"

if [ -t 0 ]; then
TTY=true
else
TTY=false
fi

docker build -t toxchat/c-toxcore:circleci other/docker/circleci
docker run --name toxcore-circleci --rm -it -v "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"
docker run --name toxcore-circleci --rm --interactive="$TTY" --tty="$TTY" --volume "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"

0 comments on commit 4f09f4e

Please sign in to comment.