Skip to content

Commit ad08c68

Browse files
Move gcc 4.8 tests to docker image (#292)
Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>
1 parent 4e3dd40 commit ad08c68

File tree

3 files changed

+57
-27
lines changed

3 files changed

+57
-27
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Install CMake
2+
description: Download, Build and Cache CMake
3+
inputs:
4+
version:
5+
description: The desired CMake version to install
6+
required: true
7+
url:
8+
description: "The corresponding URL to download the source code from"
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Cache CMake
14+
id: cache-cmake
15+
uses: actions/cache@v3
16+
with:
17+
path: cmake-${{ inputs.version }}
18+
key: ${{ runner.name }}-${{ runner.os }}-${{ runner.arch }}-cmake-${{ inputs.version }}
19+
- name: Build cmake
20+
if: steps.cache-cmake.outputs.cache-hit != 'true'
21+
run: |
22+
wget ${{ inputs.url }}
23+
tar -zxf cmake-${{ inputs.version }}.tar.gz
24+
cd cmake-${{ inputs.version }}
25+
./bootstrap
26+
make -j $(nproc)
27+
shell: bash
28+
- name: Install cmake
29+
run: |
30+
cd cmake-${{ inputs.version }}
31+
# Depending if we run in on a GitHub Actions or from within a Docker image we have different permissions
32+
if [[ $EUID > 0 ]]; then
33+
# If we are not root then we need to sudo
34+
sudo make install
35+
else
36+
# Default docker image does not have users setup so we are only root and can not sudo
37+
make install
38+
fi
39+
shell: bash

.github/workflows/cmake.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,31 +74,12 @@ jobs:
7474
7575
min-req:
7676
runs-on: ubuntu-20.04
77-
env:
78-
RUN_ON: ubuntu-20.04
79-
CMAKE_URL: https://cmake.org/files/v3.14/cmake-3.14.7.tar.gz
80-
CMAKE_VERSION: 3.14.7
8177
steps:
8278
- uses: actions/checkout@v3
83-
- name: Cache CMake
84-
id: cache-cmake
85-
uses: actions/cache@v3
79+
- uses: ./.github/actions/install/cmake
8680
with:
87-
path: cmake-${{ env.CMAKE_VERSION }}
88-
key: ubuntu-20.04-${{ github.job }}-cmake-${{ env.CMAKE_VERSION }}
89-
- name: Build cmake
90-
if: steps.cache-cmake.outputs.cache-hit != 'true'
91-
run: |
92-
wget ${{ env.CMAKE_URL }}
93-
tar -zxf cmake-${{ env.CMAKE_VERSION }}.tar.gz
94-
cd cmake-${{ env.CMAKE_VERSION }}
95-
./bootstrap
96-
make -j $(nproc)
97-
- name: Install cmake
98-
run: |
99-
cd cmake-${{ env.CMAKE_VERSION }}
100-
sudo make install
101-
81+
version: "3.14.7"
82+
url: "https://cmake.org/files/v3.14/cmake-3.14.7.tar.gz"
10283
- uses: ./.github/actions/install/gtest
10384

10485
- name: setup

.github/workflows/targets.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,28 @@ on:
1616
jobs:
1717
gcc-4-8:
1818
name: GCC 4.8
19-
runs-on: ubuntu-18.04
19+
runs-on: ubuntu-latest
20+
container:
21+
image: ubuntu:18.04
22+
env:
23+
CC: /usr/bin/gcc-4.8
24+
CXX: /usr/bin/g++-4.8
2025
steps:
21-
- run: sudo apt-get install g++-4.8
22-
- uses: lukka/get-cmake@latest
26+
- run: |
27+
apt-get update
28+
apt-get install -y g++-4.8 wget make libssl-dev
2329
- uses: actions/checkout@v3
30+
- uses: ./.github/actions/install/cmake
31+
with:
32+
version: "3.26.3"
33+
url: "https://cmake.org/files/v3.26/cmake-3.26.3.tar.gz"
2434

2535
- name: setup
2636
run: |
2737
mkdir build
2838
cd build
29-
CC=gcc-4.8 CXX=g++-4.8 cmake ..
30-
sudo cmake --install .
39+
cmake ..
40+
cmake --install .
3141
- name: test
3242
working-directory: tests/cmake
3343
run: |

0 commit comments

Comments
 (0)