Skip to content

Commit ddc23c2

Browse files
CodingAllanKuhn
andauthored
11 set up continuous integration pipeline (#12)
Set-up minimal continuous integration pipeline. --------- Co-authored-by: Kuhn <kuhn_aa@ubuntu-server.intra.dlr.de>
1 parent e019696 commit ddc23c2

4 files changed

Lines changed: 93 additions & 3 deletions

File tree

.github/actions/build/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Linux Build"
2+
runs:
3+
using: "composite"
4+
steps:
5+
- name: Install dependencies
6+
shell: bash
7+
run: |
8+
sudo apt-get -qq update
9+
sudo apt-get -qq install gcc-11
10+
sudo apt-get -qq -y install g++-11
11+
- name: Build
12+
shell:
13+
# ensure that the installed compiler version is used
14+
run: |
15+
export CC=/usr/bin/gcc-11
16+
export CXX=/usr/bin/g++-11
17+
mkdir build
18+
cmake -S . -B ./build/
19+
cd build
20+
make -j4
21+
- name: create build dir archive
22+
shell: bash
23+
run: |
24+
tar -czf build.tar.gz build
25+
- name: Upload build dir archive
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: build-cpp-linux-gmgpolar
29+
path: build.tar.gz
30+
retention-days: 1

.github/actions/test/action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Test on Linux"
2+
description: "Run the unit tests on Linux"
3+
inputs:
4+
build-artifact:
5+
description: "Name of the build artifact that contains the unit test"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Download build test directory
12+
uses: actions/download-artifact@v3
13+
with:
14+
name: ${{ inputs.build-artifact }}
15+
- name: extract build archive
16+
shell: bash
17+
run: |
18+
tar -xzf build.tar.gz
19+
- name: run unit test
20+
shell: bash
21+
run: |
22+
cd build/tests
23+
sudo chmod a+x gmgpolar_tests
24+
./gmgpolar_tests --gtest_output="xml:testreport.xml"
25+
- name: Upload test report
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: test-report
29+
path: build/tests/testreport.xml
30+
if-no-files-found: error
31+
retention-days: 3

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: GMGPolarCI
2+
3+
on :
4+
schedule:
5+
- cron: "40 2 * * *"
6+
push:
7+
branches:
8+
- "main"
9+
pull_request:
10+
types: [opened, reopened, synchronize, ready_for_review]
11+
12+
jobs:
13+
install-and-build:
14+
if: github.event.pull_request.draft == false
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: ./.github/actions/build
19+
20+
run-unit-test:
21+
needs: install-and-build
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: ./.github/actions/test
26+
with:
27+
build-artifact: build-cpp-linux-gmgpolar

tests/comparetest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ TEST_F(Test_Parameters, DOF_on_finest_grid)
5555
{
5656
gmgpolar gmgtest;
5757
gmgtest.create_grid_polar(); //only the finest grid is now created
58-
int finest_nodes = gmgtest.v_level[0]->nr * gmgtest.v_level[0]->ntheta;
58+
int nodes_r = gmgtest.v_level[0]->nr;
59+
int nodes_theta = gmgtest.v_level[0]->ntheta;
60+
int finest_nodes = nodes_r * nodes_theta;
5961
EXPECT_EQ(gmgtest.v_level.size(), 1);
6062
EXPECT_EQ(finest_nodes, input[initparam]);
61-
EXPECT_EQ(gmgtest.v_level[0]->nr, input[initparam + 1]);
62-
EXPECT_EQ(gmgtest.v_level[0]->ntheta, input[initparam + 2]);
63+
EXPECT_EQ(nodes_r, input[initparam + 1]);
64+
EXPECT_EQ(nodes_theta, input[initparam + 2]);
6365
}
6466

6567
TEST_F(Test_Parameters, Test_multigrid_Iterations)

0 commit comments

Comments
 (0)