Skip to content

Commit 0e02765

Browse files
authored
Add Weekly CI (#352)
* CI: add weekly workflow * CI: testing in feature branch * Test/FastPathAlloc: fix compilation error
1 parent df25bd5 commit 0e02765

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

.github/workflows/weekly.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Libobjc2 Weekly CI
2+
3+
on:
4+
# Automatically run the workflow once a week
5+
schedule:
6+
- cron: '20 4 * * 1'
7+
# Allow running the workflow manually
8+
workflow_dispatch:
9+
# Testing in Local Branch
10+
push:
11+
branches:
12+
- weekly-ci
13+
14+
jobs:
15+
ubuntu:
16+
strategy:
17+
matrix:
18+
# Build each combination of OS and release/debug variants
19+
build-type: [ Release, Debug ]
20+
blocks-runtime: [ "EMBEDDED", "main" ]
21+
cxxlib: [ "libc++", "libstdc++" ]
22+
fail-fast: false
23+
runs-on: ubuntu-latest
24+
name: ${{ matrix.os }} ${{ matrix.build-type }} ${{ matrix.cxxlib }} BlocksRuntime-${{ matrix.blocks-runtime }}
25+
steps:
26+
- name: Install LLVM Snapshot
27+
run: |
28+
sudo apt install -y lsb-release wget software-properties-common gnupg
29+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
30+
31+
codename=`lsb_release -cs`
32+
echo "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename} main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain.list
33+
sudo apt update
34+
35+
# Get the current version in the snapshot archive
36+
llvm_version=`grep -Phoe '^Package: clang-\K[0-9]*$' /var/lib/apt/lists/apt.llvm.org*`
37+
echo "LLVM_VERSION=${llvm_version}" >> $GITHUB_ENV
38+
39+
sudo apt install clang-${llvm_version} lld-${llvm_version}
40+
if [ "${{ matrix.cxxlib }}" = "libc++" ]; then
41+
sudo apt remove -y 'libc++*'
42+
sudo apt install libc++-${llvm_version}-dev libc++abi-${llvm_version}-dev
43+
sudo apt install libunwind-${llvm_version}-dev || true
44+
fi
45+
- uses: actions/checkout@v3
46+
- name: Install dependencies
47+
run: |
48+
sudo apt install ninja-build
49+
if [ "${{ matrix.blocks-runtime }}" != "EMBEDDED" ]; then
50+
git clone --depth 1 --branch "${{ matrix.blocks-runtime }}" \
51+
https://github.com/apple/swift-corelibs-libdispatch.git ${{github.workspace}}/swift-corelibs-libdispatch
52+
cmake -B ${{github.workspace}}/swift-corelibs-libdispatch/build -G Ninja \
53+
-DINSTALL_PRIVATE_HEADERS=ON \
54+
-DCMAKE_C_COMPILER=clang-${LLVM_VERSION} -DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} -S ${{github.workspace}}/swift-corelibs-libdispatch
55+
pushd ${{github.workspace}}/swift-corelibs-libdispatch/build
56+
ninja
57+
sudo ninja install
58+
popd
59+
fi
60+
- name: Configure CMake
61+
run: |
62+
export LDFLAGS=-L/usr/lib/llvm-${LLVM_VERSION}/lib/
63+
if [ "${{ matrix.blocks-runtime }}" != "EMBEDDED" ]; then
64+
export EMBEDDED_BLOCKS_RUNTIME=OFF
65+
else
66+
export EMBEDDED_BLOCKS_RUNTIME=ON
67+
fi
68+
ls -lahR /usr/lib/llvm-${LLVM_VERSION}/lib/
69+
cmake -B ${{github.workspace}}/build \
70+
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja \
71+
-DTESTS=ON \
72+
-DEMBEDDED_BLOCKS_RUNTIME=$EMBEDDED_BLOCKS_RUNTIME \
73+
-DCMAKE_C_COMPILER=clang-${LLVM_VERSION} \
74+
-DCMAKE_OBJC_COMPILER=clang-${LLVM_VERSION} \
75+
-DCMAKE_ASM_COMPILER=clang-${LLVM_VERSION} \
76+
-DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} \
77+
-DCMAKE_OBJCXX_COMPILER=clang++-${LLVM_VERSION} \
78+
-DCMAKE_CXX_FLAGS="-stdlib=${{matrix.cxxlib}}"
79+
# Build with a nice ninja status line
80+
- name: Build
81+
working-directory: ${{github.workspace}}/build
82+
run: |
83+
NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja
84+
- name: Test
85+
working-directory: ${{github.workspace}}/build
86+
run: |
87+
ctest --output-on-failure -j 4
88+

Test/FastPathAlloc.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ + (instancetype)alloc
9696
@implementation ShouldInitSubclassed
9797
+ (instancetype) alloc
9898
{
99-
return [ShouldInit alloc];
99+
return (ShouldInitSubclassed *)[ShouldInit alloc];
100100
}
101101
@end
102102

0 commit comments

Comments
 (0)