-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (134 loc) · 4.95 KB
/
github-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Github CI
on: [push, workflow_dispatch]
env:
conan_config: "https://gitlab.sintef.no/co-simulation/conan-configs.git"
jobs:
windows:
name: Windows build
runs-on: windows-2022
strategy:
matrix:
TYPE: [Release, Debug]
PROFILE: ["msvc_192"]
steps:
- uses: actions/checkout@v4
- id: cache-conan-packages
uses: actions/cache@v4
with:
path: |
~/.conan2
key: ${{ runner.os }}-${{ matrix.TYPE }}-dds-fmu
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 2.3.0
- name: Setting variables
run: |
if ("${{ matrix.TYPE }}" -like "Debug") { echo "SKIP_TEST=True" >> "$GITHUB_ENV" }
- name: Conan build
run: |
conan config install "${{ env.conan_config }}" --type git -sf profiles -tf profiles
conan config install "${{ env.conan_config }}" --type git -sf remotes_public
conan build -o "dds-fmu/*:with_doc=False" -b missing --update `
-pr:b ${{ matrix.PROFILE }} -pr:h ${{ matrix.PROFILE }} -s build_type=${{ matrix.TYPE }} `
-c tools.build:jobs=2 -c tools.build:skip_test=$SKIP_TEST .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ github.job }}-${{ matrix.TYPE }}"
path: |
build/fmus/*
public/*
testoutput/*.xml
retention-days: 1
linux:
name: Linux build
runs-on: ubuntu-22.04
strategy:
matrix:
TYPE: [Release, Debug]
PROFILE: ["gcc12"]
steps:
- uses: actions/checkout@v4
- id: cache-conan-packages
uses: actions/cache@v4
with:
path: |
~/.conan2
key: ${{ runner.os }}-${{ matrix.TYPE }}-dds-fmu
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 2.3.0
- name: Installing pre-requisites
run: |
sudo apt update && sudo apt install -y openssh-client texlive-binaries perl
if ([[ ${{ matrix.TYPE }} == "Debug" ]]); \
then echo "SKIP_TEST=True" >> "$GITHUB_ENV"; \
else export "SKIP_TEST=False" >> "$GITHUB_ENV"; fi
- name: Conan build
run: |
conan config install $conan_config --type git -sf profiles -tf profiles
conan config install $conan_config --type git -sf remotes_public
conan build -o "dds-fmu/*:with_doc=True" -b missing --update \
-pr:b ${{ matrix.PROFILE }} -pr:h ${{ matrix.PROFILE }} -s build_type=${{ matrix.TYPE }} \
-c tools.build:jobs=2 -c tools.build:skip_test=$SKIP_TEST .
if ([[ ${{ matrix.TYPE }} == "Release" ]]); then cp -r build/Release/docs/html public/; fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ github.job }}-${{ matrix.TYPE }}"
path: |
build/${{ matrix.TYPE }}/fmus/*
public/*
testoutput/*.xml
retention-days: 1
fmu:
needs: [linux, windows]
runs-on: ubuntu-22.04
strategy:
matrix:
TYPE: [ Release, Debug ]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: fmus/
pattern: "*-${{ matrix.TYPE }}"
- name: Build an FMU
run: |
FMU_VERSION=$(cat version.txt)
FMU_NAME=${{ github.event.repository.name }}
shopt -s globstar
mkdir tmp_${{ matrix.TYPE }} && cd tmp_${{ matrix.TYPE }}
the_fmus=(../fmus/**/*${{ matrix.TYPE }}.fmu)
fmu_count=${#the_fmus[@]}
for (( i=0; i<$fmu_count; i++ )); do
an_fmu="${the_fmus[$i]}"
cmake -E tar xf $an_fmu
done
mkdir ../combined_fmus
cmake -E tar cf ../combined_fmus/$FMU_NAME-${{ matrix.TYPE }}.fmu --format=zip .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ github.event.repository.name }}-${{ matrix.TYPE }}"
path: |
combined_fmus/${{ github.event.repository.name }}-${{ matrix.TYPE }}.fmu
release:
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: [fmu]
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "${{ github.event.repository.name }}-Release"
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: test
files: "combined_fmus/${{ github.event.repository.name }}-Release.fmu"