Skip to content

Commit b34c2de

Browse files
committed
ci: backport jobs from main
1 parent bf5adec commit b34c2de

33 files changed

Lines changed: 1448 additions & 306 deletions

‎.github/workflows/aarch64_toolchain.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ref: https://toolchains.bootlin.com/
22
name: aarch64 Toolchain
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on: [workflow_dispatch]
55

66
concurrency:
77
group: ${{github.workflow}}-${{github.ref}}

‎.github/workflows/amd64_cmake_glop_cpp.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# ref: https://github.com/actions/runner-images
22
name: amd64 CMake Glop C++
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

611
concurrency:
712
group: ${{github.workflow}}-${{github.ref}}

‎.github/workflows/amd64_docker_bazel.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# ref: https://github.com/docker-library/official-images
22
name: amd64 Docker Bazel
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

611
concurrency:
712
group: ${{github.workflow}}-${{github.ref}}

‎.github/workflows/amd64_docker_cmake.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# ref: https://github.com/docker-library/official-images
22
name: amd64 Docker CMake
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

611
concurrency:
712
group: ${{github.workflow}}-${{github.ref}}

‎.github/workflows/amd64_freebsd_cmake.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ref: https://github.com/actions/runner-images
22
name: amd64 FreeBSD CMake
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on: [workflow_dispatch]
55

66
concurrency:
77
group: ${{github.workflow}}-${{github.ref}}
Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
# ref: https://github.com/actions/runner-images
22
name: amd64 Linux Bazel
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

611
concurrency:
712
group: ${{github.workflow}}-${{github.ref}}
813
cancel-in-progress: true
914

15+
env:
16+
cache-root: /tmp/bazel
17+
1018
# Building using the github runner environement directly.
1119
jobs:
12-
native:
20+
amd64-Linux-Bazel-Python:
1321
strategy:
1422
matrix:
1523
python: [
@@ -19,19 +27,19 @@ jobs:
1927
#{version: '3.13'},
2028
]
2129
fail-fast: false
22-
name: amd64•Linux•Bazel•Python-${{matrix.python.version}}
23-
runs-on: ubuntu-latest
2430
env:
2531
CC: gcc-12
2632
CXX: g++-12
33+
cache-name: ${{github.job}}-${{matrix.python.version}}
34+
runs-on: ubuntu-latest
2735
steps:
2836
- uses: actions/checkout@v5
2937
- name: Check Java
3038
run: java -version
3139
- name: Check mvn
3240
run: mvn --version
3341
- name: Setup Python
34-
uses: actions/setup-python@v5
42+
uses: actions/setup-python@v6
3543
with:
3644
python-version: ${{matrix.python.version}}
3745
- name: Check Python
@@ -53,21 +61,26 @@ jobs:
5361
run: |
5462
sed -i -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]\+"/\1 "${{matrix.python.version}}"/g' MODULE.bazel
5563
cat MODULE.bazel
64+
- name: Restore bazel cache
65+
uses: actions/cache/restore@v4
66+
id: bazel-cache-restore
67+
with:
68+
key: ${{env.cache-name}}
69+
path: ${{env.cache-root}}
5670
- name: Build
57-
run: >
58-
bazel build
59-
-c opt
60-
--subcommands=pretty_print
61-
//ortools/... //examples/...
71+
run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/...
6272
- name: Test
63-
run: >
64-
bazel test
65-
-c opt
66-
--test_output=errors
67-
//ortools/... //examples/...
73+
run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/...
74+
- name: Save Bazel cache for branch main even when Build and Test fail.
75+
uses: actions/cache/save@v4
76+
# https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache
77+
if: always() && github.ref == 'refs/heads/main'
78+
with:
79+
key: ${{env.cache-name}}-${{github.sha}}
80+
path: ${{env.cache-root}}
6881

6982
amd64_linux_bazel:
7083
runs-on: ubuntu-latest
71-
needs: native
84+
needs: amd64-Linux-Bazel-Python
7285
steps:
7386
- uses: actions/checkout@v5
Lines changed: 122 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,135 @@
11
# ref: https://github.com/actions/runner-images
22
name: amd64 Linux CMake CoinOR OFF
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

611
concurrency:
712
group: ${{github.workflow}}-${{github.ref}}
813
cancel-in-progress: true
914

1015
# Building using the github runner environement directly.
16+
env:
17+
CCACHE_BASEDIR: ${{github.workspace}}
18+
CCACHE_DIR: ${{github.workspace}}/.ccache
19+
1120
jobs:
1221
native:
13-
strategy:
14-
matrix:
15-
cmake: [
16-
{language: 'C++', args: '-DBUILD_CXX=ON'},
17-
{language: '.Net', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON'},
18-
{language: 'Java', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON'},
19-
{language: 'Python', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON'},
20-
]
21-
fail-fast: false
22-
name: amd64•Linux•CMake•${{matrix.cmake.language}}•CoinOR=OFF
22+
name: amd64•Linux•CMake•CoinOR=OFF
23+
runs-on: ubuntu-latest
24+
env:
25+
deps_src_key: amd64_linux_coinor_deps_src
26+
deps_build_key: amd64_linux_coinor_deps_build
27+
ccache_key: amd64_linux_coinor_ccache
28+
steps:
29+
- uses: actions/checkout@v5
30+
- name: Install Dependencies
31+
run: |
32+
sudo apt update
33+
sudo apt install -y ninja-build ccache swig
34+
swig -version
35+
# Install .NET SDKs
36+
- name: Setup .NET 8.0
37+
uses: actions/setup-dotnet@v5
38+
with:
39+
dotnet-version: 8.0.x
40+
- name: Check dotnet
41+
run: dotnet --info
42+
# Install Java
43+
- name: Check java
44+
run: java -version
45+
# Install Python
46+
- name: Install python3 venv
47+
run: sudo apt-get install python3-venv
48+
- name: Update Path
49+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
50+
51+
# RESTORING CACHES
52+
- name: Restore CMake dependency source code
53+
uses: actions/cache/restore@v4
54+
id: deps_src_restore
55+
with:
56+
key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
57+
path: ${{github.workspace}}/build/_deps/*-src
58+
- name: Restore CMake dependency build
59+
uses: actions/cache/restore@v4
60+
id: deps_build_restore
61+
with:
62+
key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
63+
path: |
64+
${{github.workspace}}/build/_deps/*-build
65+
${{github.workspace}}/build/_deps/*-subbuild
66+
- name: Restore CCache
67+
uses: actions/cache/restore@v4
68+
id: ccache_restore
69+
with:
70+
key: ${{env.ccache_key}}-${{github.sha}}
71+
restore-keys: ${{env.ccache_key}}-
72+
path: ${{env.CCACHE_DIR}}
73+
74+
- name: Check CMake
75+
run: cmake --version
76+
- name: Configure
77+
run: >
78+
cmake -S. -Bbuild
79+
-G "Ninja"
80+
-DCMAKE_BUILD_TYPE=Release
81+
-DBUILD_DOTNET=ON -DBUILD_JAVA=ON -DBUILD_PYTHON=ON
82+
-DUSE_GLPK=OFF -DUSE_SCIP=OFF
83+
-DUSE_COINOR=OFF
84+
-DCMAKE_INSTALL_PREFIX=install
85+
- name: Build
86+
run: >
87+
cmake --build build
88+
--config Release
89+
--target all
90+
-v -j2
91+
- name: Test
92+
run: >
93+
CTEST_OUTPUT_ON_FAILURE=1
94+
cmake --build build
95+
--config Release
96+
--target test
97+
-v
98+
- name: Install
99+
run: >
100+
cmake --build build
101+
--config Release
102+
--target install
103+
-v
104+
- name: CCache stats
105+
run: |
106+
ccache --show-stats
107+
ccache --zero-stats
108+
109+
# SAVING CACHES
110+
- name: Save CCache
111+
if: github.ref == 'refs/heads/main'
112+
uses: actions/cache/save@v4
113+
with:
114+
key: ${{steps.ccache_restore.outputs.cache-primary-key}}
115+
path: ${{env.CCACHE_DIR}}
116+
- name: Save CMake dependency build
117+
if: github.ref == 'refs/heads/main'
118+
uses: actions/cache/save@v4
119+
with:
120+
key: ${{steps.deps_build_restore.outputs.cache-primary-key}}
121+
path: |
122+
${{github.workspace}}/build/_deps/*-build
123+
${{github.workspace}}/build/_deps/*-subbuild
124+
- name: Save CMake dependency source code
125+
if: github.ref == 'refs/heads/main'
126+
uses: actions/cache/save@v4
127+
with:
128+
key: ${{steps.deps_src_restore.outputs.cache-primary-key}}
129+
path: ${{github.workspace}}/build/_deps/*-src
130+
131+
amd64_linux_cmake_coinor:
23132
runs-on: ubuntu-latest
133+
needs: native
24134
steps:
25-
- uses: actions/checkout@v5
26-
# Install SWIG
27-
- name: Swig install
28-
run: sudo apt install -y swig
29-
- name: Check swig
30-
run: swig -version
31-
# Install .NET SDKs
32-
- name: Setup .NET 8.0
33-
uses: actions/setup-dotnet@v4
34-
with:
35-
dotnet-version: 8.0.x
36-
- name: Check dotnet
37-
run: dotnet --info
38-
# Install Java
39-
- name: Check java
40-
run: java -version
41-
# Install Python
42-
- name: Install python3 venv
43-
run: sudo apt-get install python3-venv
44-
- name: Update Path
45-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
46-
# CMake
47-
- name: Check cmake
48-
run: cmake --version
49-
- name: Configure
50-
run: >
51-
cmake -S. -Bbuild
52-
-DCMAKE_BUILD_TYPE=Release
53-
-DBUILD_DEPS=ON
54-
-DUSE_COINOR=OFF
55-
${{matrix.cmake.args}}
56-
- name: Build
57-
run: >
58-
cmake --build build
59-
--config Release
60-
--target all
61-
-v -j2
62-
- name: Test
63-
run: >
64-
CTEST_OUTPUT_ON_FAILURE=1
65-
cmake --build build
66-
--config Release
67-
--target test
68-
-v
69-
- name: Install
70-
run: >
71-
cmake --build build
72-
--config Release
73-
--target install
74-
-v
75-
-- DESTDIR=install
135+
- uses: actions/checkout@v5

0 commit comments

Comments
 (0)