Skip to content

Commit 5d7af2b

Browse files
committed
run gcc15 in different github actions workflow
1 parent c3558a1 commit 5d7af2b

File tree

2 files changed

+51
-70
lines changed

2 files changed

+51
-70
lines changed

.github/workflows/test-gcc15.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests (GCC 15)
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: tests-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
ruby: ['3.2', '3.3', '3.4', 'head']
15+
16+
name: ubuntu-latest, ${{matrix.ruby}}
17+
18+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
19+
20+
runs-on: ubuntu-latest
21+
22+
container:
23+
image: ghcr.io/mattkretz/cplusplus-ci/gcc15
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install packages
29+
run: apt-get install -y libsqlite3-dev
30+
31+
- uses: ruby/setup-ruby@v1
32+
with:
33+
ruby-version: ${{matrix.ruby}}
34+
bundler-cache: true
35+
36+
- name: Compile C-extension
37+
run: bundle exec rake compile
38+
39+
- name: Run tests
40+
run: bundle exec rake test

.github/workflows/test.yml

Lines changed: 11 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Tests (extralite)
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
concurrency:
66
group: tests-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
@@ -11,87 +11,28 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
os: [ubuntu-latest, macos-latest]
15-
ruby: ['3.2', '3.3', '3.4', 'head']
16-
gcc: [13, 14, 15, null]
17-
exclude:
18-
# No GCC versions for macOS
19-
- os: macos-latest
20-
gcc: 13
21-
- os: macos-latest
22-
gcc: 14
23-
- os: macos-latest
24-
gcc: 15
25-
# No null GCC for Ubuntu
26-
- os: ubuntu-latest
27-
gcc: null
14+
os: [ ubuntu-latest, macos-latest ]
15+
ruby: [ '3.2', '3.3', '3.4', 'head' ]
2816

29-
name: ${{matrix.os}}, Ruby ${{matrix.ruby}}${{ matrix.gcc && format(' (GCC {0})', matrix.gcc) || '' }}
17+
name: ${{matrix.os}}, ${{matrix.ruby}}
3018

3119
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
3220

3321
runs-on: ${{matrix.os}}
22+
3423
steps:
3524
- uses: actions/checkout@v4
25+
26+
- name: Install packages
27+
if: matrix.os == 'ubuntu-latest'
28+
run: sudo apt-get install -y libsqlite3-dev
29+
3630
- uses: ruby/setup-ruby@v1
3731
with:
3832
ruby-version: ${{matrix.ruby}}
3933
bundler-cache: true
40-
apt-get: libsqlite3-dev
41-
42-
- name: Install GCC 13/14
43-
if: matrix.os == 'ubuntu-latest' && (matrix.gcc == '13' || matrix.gcc == '14')
44-
run: |
45-
sudo apt-get update
46-
sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
47-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100
48-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} 100
49-
gcc --version
50-
51-
- name: Compile with GCC 15 using cplusplus-ci
52-
if: matrix.os == 'ubuntu-latest' && matrix.gcc == '15'
53-
run: |
54-
# Pull the pre-built GCC 15 image
55-
docker pull gcc:15
56-
57-
# Find Ruby and gem paths
58-
RUBY_PATH=$(dirname $(which ruby))
59-
GEM_PATH=$(dirname $(which gem))
60-
BUNDLE_PATH=$(dirname $(which bundle))
61-
62-
# Get Ruby lib directories
63-
RUBY_LIB=$(ruby -e 'puts RbConfig::CONFIG["libdir"]')
64-
RUBY_INCLUDE=$(ruby -e 'puts RbConfig::CONFIG["rubyhdrdir"]')
65-
RUBY_ARCH_INCLUDE=$(ruby -e 'puts RbConfig::CONFIG["rubyarchhdrdir"]')
66-
67-
# Install required libraries in the container
68-
docker run --rm gcc:15 apt-get update
69-
docker run --rm gcc:15 apt-get install -y libsqlite3-dev
70-
71-
# Compile the extension inside the container with GCC 15
72-
# Mount Ruby binaries, libraries, and include files
73-
docker run --rm \
74-
-v $PWD:/app \
75-
-v $RUBY_PATH:$RUBY_PATH \
76-
-v $GEM_PATH:$GEM_PATH \
77-
-v $BUNDLE_PATH:$BUNDLE_PATH \
78-
-v $RUBY_LIB:$RUBY_LIB \
79-
-v $RUBY_INCLUDE:$RUBY_INCLUDE \
80-
-v $RUBY_ARCH_INCLUDE:$RUBY_ARCH_INCLUDE \
81-
-e PATH=$PATH:$RUBY_PATH:$GEM_PATH:$BUNDLE_PATH \
82-
-e CC=gcc \
83-
-e RUBY_LIB=$RUBY_LIB \
84-
-e RUBY_INCLUDE=$RUBY_INCLUDE \
85-
-e RUBY_ARCH_INCLUDE=$RUBY_ARCH_INCLUDE \
86-
-w /app \
87-
gcc:15 bash -c "bundle exec rake compile"
88-
89-
- name: Compile on Ubuntu (non-GCC 15)
90-
if: matrix.os == 'ubuntu-latest' && matrix.gcc != '15'
91-
run: CC=gcc-${{ matrix.gcc }} bundle exec rake compile
9234

93-
- name: Compile on macOS
94-
if: matrix.os == 'macos-latest'
35+
- name: Compile C-extension
9536
run: bundle exec rake compile
9637

9738
- name: Run tests

0 commit comments

Comments
 (0)