Skip to content

Commit 1d04b2c

Browse files
committed
[CI] Add demo-maxr.yml to test other project and factorize CI code
1 parent c71a6ad commit 1d04b2c

4 files changed

Lines changed: 190 additions & 84 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: 'Build ccccc'
2+
description: 'Build ccccc'
3+
inputs:
4+
llvm-version:
5+
description: 'Version of llvm to use'
6+
required: false
7+
default: '19'
8+
9+
outputs:
10+
llvm-root:
11+
description: 'LLVM root'
12+
value: ${{ steps.LLVM.outputs.LLVM_ROOT }}
13+
14+
runs:
15+
using: "composite"
16+
17+
steps:
18+
19+
- uses: Jarod42/install-premake5@v7
20+
21+
# To Create compile_commands.json
22+
- name: checkout premake-export-compile-commands
23+
uses: actions/checkout@v6
24+
with:
25+
repository: Jarod42/premake-export-compile-commands
26+
path: premake-export-compile-commands
27+
ref: Improvements
28+
29+
- name: aptget llvm for Linux
30+
if: runner.os == 'Linux'
31+
id: LLVM
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install clang-${{ inputs.llvm-version }} libclang-${{ inputs.llvm-version }}-dev llvm-${{ inputs.llvm-version }}-dev llvm-${{ inputs.llvm-version }}-runtime llvm-${{ inputs.llvm-version }}
35+
echo "LLVM_ROOT=/usr/lib/llvm-${{ inputs.llvm-version }}" >> $GITHUB_OUTPUT
36+
shell: bash
37+
38+
- name: debug LLVM
39+
if: runner.os == 'Linux'
40+
run: |
41+
echo "LLVM_ROOT:" $LLVM_ROOT
42+
echo "================ ls $LLVM_ROOT/lib" && ls $LLVM_ROOT/lib
43+
echo "================ ls $LLVM_ROOT/bin" && ls $LLVM_ROOT/bin
44+
echo "================ llvm-config --cppflags" && $LLVM_ROOT/bin/llvm-config --cppflags
45+
echo "================ llvm-config --ldflags" && $LLVM_ROOT/bin/llvm-config --system-libs --ldflags --libs all support
46+
env:
47+
LLVM_ROOT: ${{steps.LLVM.outputs.LLVM_ROOT}}
48+
shell: bash
49+
50+
# - name: Build standalone mstch
51+
# run: |
52+
# mkdir 3rd/mstch/build
53+
# cd 3rd/mstch/build
54+
# cmake .. && make
55+
# sudo make install
56+
57+
- name: build ccccc
58+
run: |
59+
premake5 --llvm-root="${{steps.LLVM.outputs.LLVM_ROOT}}" gmake
60+
cd project/gmake && make config=release verbose=1
61+
cp ../../bin/gmake/Release/ccccc ../..
62+
shell: bash
63+
64+
- name: aptget llvm
65+
if: runner.os == 'macOS'
66+
run: |
67+
echo NOT SUPPORTED YET && exit -1
68+
shell: bash
69+
70+
- name: Build premake5
71+
if: runner.os == 'Windows'
72+
run: |
73+
echo NOT SUPPORTED YET && exit -1
74+
shell: powershell

.github/workflows/demo-codelite.yml

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,34 @@ jobs:
3030

3131
steps:
3232

33-
# ccccc build
34-
- uses: Jarod42/install-premake5@v7
35-
36-
- name: aptget llvm
37-
id: LLVM
38-
run: |
39-
sudo apt-get install clang-${{ inputs.llvm-version }} libclang-${{ inputs.llvm-version }}-dev llvm-${{ inputs.llvm-version }}-dev llvm-${{ inputs.llvm-version }}-runtime llvm-${{ inputs.llvm-version }}
40-
echo "LLVM_ROOT=/usr/lib/llvm-${{ inputs.llvm-version }}" >> $GITHUB_OUTPUT
41-
4233
- name: checkout ccccc
4334
uses: actions/checkout@v6
4435
with:
4536
submodules: recursive
46-
repository: Jarod42/ccccc
47-
path: ccccc
4837

49-
- name: premake gmake
50-
run: |
51-
cd ccccc
52-
premake5 --llvm-root="${{steps.LLVM.outputs.LLVM_ROOT}}" gmake
53-
54-
- name: make config=release
55-
run: |
56-
cd ccccc/project/gmake
57-
make config=release verbose=1
38+
- name: Install premake & build ccccc
39+
uses: ./.github/actions/build-ccccc
40+
with:
41+
llvm-version: ${{ inputs.llvm-version }}
5842

59-
# WxWidgets
60-
- name: install dependencies for wxWidgets
61-
run: sudo apt-get install build-essential cmake git libedit-dev libgtk-3-dev libhunspell-dev libsqlite3-dev libssh-dev pkg-config xterm
43+
# Codelite (with WxWidgets)
44+
- name: Checkout Codelite
45+
uses: actions/checkout@v6
46+
with:
47+
repository: eranif/codelite
48+
submodules: recursive
49+
path: codelite
6250

6351
- name: Checkout WxWidgets
6452
uses: actions/checkout@v6
6553
with:
6654
repository: wxWidgets/wxWidgets
6755
ref: ${{ inputs.wx-version }}
6856
submodules: recursive
69-
path: codelite/wxWidgets
57+
path: codelite/wxWidgets
58+
59+
- name: install dependencies for
60+
run: sudo apt-get install build-essential cmake git libedit-dev libgtk-3-dev libhunspell-dev libsqlite3-dev libssh-dev pkg-config xterm libpcre2-dev libsqlite3-dev libssh-dev bison flex
7061

7162
- name: build and install wxWidgets
7263
run: |
@@ -75,33 +66,25 @@ jobs:
7566
../configure --disable-debug_flag --with-gtk=3 --enable-stl
7667
make -j$(nproc) && sudo make install
7768
78-
# Codelite
79-
- name: install Codelite's dependencies
80-
run: sudo apt-get install build-essential cmake git libpcre2-dev libsqlite3-dev libssh-dev bison flex
81-
82-
- name: Checkout Codelite
83-
uses: actions/checkout@v6
84-
with:
85-
repository: eranif/codelite
86-
submodules: recursive
87-
path: codelite
88-
89-
- name: build, test and install Codelite
69+
- name: build Codelite
9070
run: |
9171
mkdir codelite/build-release
9272
cd codelite/build-release
93-
cmake -DCMAKE_BUILD_TYPE=Release .. -DCOPY_WX_LIBS=1 -DBUILD_TESTING=1 ${{ inputs.codelite-options }}
73+
cmake -DCMAKE_BUILD_TYPE=Release .. -DCOPY_WX_LIBS=1 ${{ inputs.codelite-options }}
9474
make -j$(nproc)
95-
sudo make install
96-
ctest --output-on-failure
9775
98-
- name: codelite --version
99-
run: xvfb-run -a codelite --version || exit 0 # codelite --version returns -1
76+
- name: get codelite sha1
77+
id: codelite_sha1
78+
run: |
79+
cd maxr
80+
echo "sha1=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
10081
10182
# ccccc runs
10283
- name: run ccccc on Codelite
84+
env:
85+
CODELITE_SHA1: ${{steps.codelite_sha1.outputs.sha1}}
10386
run: |
104-
ccccc/bin/gmake/Release/ccccc --exclude-directory=codelite/build-release --exclude-directory=codelite/submodules --exclude-directory=codelite/sdk --template-file=ccccc/template/ccccc_html/template.tpl --source-root-url=https://github.com/eranif/codelite/blob/master codelite/build-release/compile_commands.json > codelite-index.html
87+
./ccccc --exclude-directory=codelite/build-release --exclude-directory=codelite/submodules --exclude-directory=codelite/sdk --template-file=template/ccccc_html/template.tpl --source-root=codelite --source-root-url=https://github.com/eranif/codelite/blob/$CODELITE_SHA1 codelite/build-release/compile_commands.json > codelite-index.html
10588
10689
- name: Upload index.html
10790
uses: actions/upload-artifact@v6

.github/workflows/demo-maxr.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: demo-maxr
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
llvm-version:
7+
default: '19'
8+
type: string
9+
workflow_dispatch:
10+
inputs:
11+
llvm-version:
12+
default: '19'
13+
type: string
14+
15+
jobs:
16+
linux:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
21+
- name: apt-get update
22+
run: sudo apt-get update
23+
24+
- name: checkout ccccc
25+
uses: actions/checkout@v6
26+
with:
27+
submodules: recursive
28+
29+
- name: Install premake & build ccccc
30+
uses: ./.github/actions/build-ccccc
31+
with:
32+
llvm-version: ${{ inputs.llvm-version }}
33+
34+
# MaxR
35+
- name: Checkout Maxr
36+
uses: actions/checkout@v6
37+
with:
38+
repository: maxr-dot-org/maxr
39+
submodules: recursive
40+
fetch-depth: 0
41+
fetch-tags: true
42+
path: maxr
43+
44+
- name: install dependencies
45+
run: |
46+
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libogg-dev libvorbis-dev libvorbisenc2 libvorbisidec-dev
47+
48+
- name: generate compile_commands.json
49+
run: |
50+
echo "require 'premake-export-compile-commands/export-compile-commands'" >> premake-system.lua
51+
premake5 export-compile-commands --file=maxr/premake5.lua --to=project/export-compile-commands
52+
53+
- name: get maxr sha1
54+
id: maxr_sha1
55+
run: |
56+
cd maxr
57+
echo "sha1=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
58+
59+
# ccccc runs
60+
- name: run ccccc on Maxr
61+
env:
62+
MAXR_SHA1: ${{steps.maxr_sha1.outputs.sha1}}
63+
run: |
64+
./ccccc --exclude-directory=maxr/submodules --template-file=template/ccccc_html/template.tpl --source-root=maxr --source-root-url=https://github.com/maxr-dot-org/maxr/blob/$MAXR_SHA1 maxr/project/export-compile-commands/release/compile_commands.json > maxr-index.html
65+
66+
- name: Upload index.html
67+
uses: actions/upload-artifact@v6
68+
with:
69+
name: maxr_ccccc
70+
path: |
71+
maxr-index.html

.github/workflows/ubuntu.yml

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,72 +12,50 @@ jobs:
1212
build:
1313
strategy:
1414
matrix:
15-
version: [14, 19]
15+
llvm-version: [14, 19]
1616
runs-on: ubuntu-latest
1717

1818
steps:
1919

20-
- uses: Jarod42/install-premake5@v7
20+
- uses: actions/checkout@v6
21+
with:
22+
submodules: recursive
2123

2224
- name: gcc version
2325
run: |
2426
g++ --version
2527
26-
- name: aptget llvm
28+
- name: Install premake & build ccccc
29+
uses: ./.github/actions/build-ccccc
2730
id: LLVM
28-
run: |
29-
sudo apt-get install clang-${{matrix.version}} libclang-${{matrix.version}}-dev llvm-${{matrix.version}}-dev llvm-${{matrix.version}}-runtime llvm-${{matrix.version}}
30-
echo "LLVM_ROOT=/usr/lib/llvm-${{matrix.version}}" >> $GITHUB_OUTPUT
31-
32-
- name: DEBUG llvm
33-
run: |
34-
echo "LLVM_ROOT:" $LLVM_ROOT
35-
echo "================ ls $LLVM_ROOT/lib" && ls $LLVM_ROOT/lib
36-
echo "================ ls $LLVM_ROOT/bin" && ls $LLVM_ROOT/bin
37-
echo "================ llvm-config --cppflags" && $LLVM_ROOT/bin/llvm-config --cppflags
38-
echo "================ llvm-config --ldflags" && $LLVM_ROOT/bin/llvm-config --system-libs --ldflags --libs all support
39-
env:
40-
LLVM_ROOT: ${{steps.LLVM.outputs.LLVM_ROOT}}
41-
42-
- uses: actions/checkout@v6
4331
with:
44-
submodules: recursive
45-
46-
# - name: Build standalone mstch
47-
# run: |
48-
# mkdir 3rd/mstch/build
49-
# cd 3rd/mstch/build
50-
# cmake .. && make
51-
# sudo make install
52-
53-
- name: premake gmake
54-
run: premake5 --llvm-root="${{steps.LLVM.outputs.LLVM_ROOT}}" gmake
32+
llvm-version: ${{ matrix.llvm-version }}
5533

56-
- name: make config=release
34+
- name: test ccccc
5735
run: |
58-
cd project/gmake && make config=release verbose=1
59-
cd ../../bin/gmake/Release
36+
cd bin/gmake/Release
6037
./ccccc_test
6138
./ccccc --version
6239
./ccccc --help
6340
64-
# Create compile_commands.json
65-
- name: checkout premake-export-compile-commands
66-
uses: actions/checkout@v6
67-
with:
68-
repository: Jarod42/premake-export-compile-commands
69-
path: premake-export-compile-commands
70-
ref: Improvements
41+
- name: get sha1
42+
id: ccccc_sha1
43+
run: |
44+
echo "sha1=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
7145
7246
- name: run ccccc on itself
47+
env:
48+
LLVM_ROOT: ${{ steps.LLVM.outputs.llvm-root }}
49+
CCCCC_SHA1: ${{steps.ccccc_sha1.outputs.sha1}}
7350
run: |
7451
echo "require 'premake-export-compile-commands/export-compile-commands'" >> premake-system.lua
75-
premake5 --llvm-root="${{steps.LLVM.outputs.LLVM_ROOT}}" --expand-llvm-config export-compile-commands
76-
./bin/gmake/Release/ccccc --template-file=template/ccccc_html/template.tpl --source-root-url=https://github.com/Jarod42/ccccc/blob/master --exclude-directory=3rd project/export-compile-commands/release/compile_commands.json > index.html
52+
premake5 --llvm-root="$LLVM_ROOT" --expand-llvm-config export-compile-commands
53+
./ccccc --template-file=template/ccccc_html/template.tpl --source-root-url=https://github.com/Jarod42/ccccc/blob/$CCCCC_SHA1 --exclude-directory=3rd project/export-compile-commands/release/compile_commands.json > index.html
54+
7755
7856
- name: Upload index.html
7957
uses: actions/upload-artifact@v6
8058
with:
81-
name: ccccc-llvm-${{matrix.version}}.html
59+
name: ccccc-llvm-${{matrix.llvm-version}}.html
8260
path: |
8361
index.html

0 commit comments

Comments
 (0)