-
Notifications
You must be signed in to change notification settings - Fork 24
169 lines (142 loc) · 5.09 KB
/
oracle8.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Oracle 8 CI (push and/or release)
on:
release:
types: [created]
push:
branches:
- develop
- dependabot/*
schedule:
- cron: '21 2 * * *'
workflow_call:
inputs:
run-tests:
required: true
type: string
target_branch:
required: true
type: string
env:
GITHUB_TOKEN: ${{ github.token }}
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }}
IS_PUSH: ${{ github.event_name == 'push' }}
REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}}
jobs:
build:
name: Build
env:
ORTOOLS_DIR: ${{ github.workspace }}/or-tools
runs-on: ubuntu-latest
container: 'oraclelinux:8'
steps:
- name: Set up Python
run: |
dnf update -y
dnf install -y python3 python3-pip
- name: Install libraries
run: |
dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core
dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-11 zlib-devel
- name: Checkout
run: |
git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} .
git config --global safe.directory '*'
- name: Install VCPKG
# Note: we need to use environment variables instead of workflow variables
# because github messes up path variables when running in container,
# see https://github.com/actions/runner/issues/2058
run: |
git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics
echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV
echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV
echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV
- name: Restore vcpkg binary dir from cache
id: cache-vcpkg-binary
uses: actions/cache/restore@v4
with:
path: ${{ env.VCPKG_CACHE_DIR }}
key: vcpkg-cache-oracle8-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }}
# Allows to restore a cache when deps have only partially changed (like adding a dependency)
restore-keys: vcpkg-cache-oracle8-
- name: Config OR-Tools URL
run: |
echo "ORTOOLS_URL=https://github.com/rte-france/or-tools-rte/releases/download/$(cat ortools_tag)/ortools_cxx_oraclelinux-8_static_sirius.zip" >> $GITHUB_ENV
- name: Download & extract OR-Tools
run: |
mkdir -p ${{env.ORTOOLS_DIR}}
cd ${{env.ORTOOLS_DIR}}
wget ${{env.ORTOOLS_URL}} -O ortools.zip
unzip ortools.zip
rm ortools.zip
- name: Init submodule
run: git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests
- name: Install dependencies
run: |
pip3 install -r src/tests/examples/requirements.txt
- name: Install gh if needed
if: ${{ env.IS_RELEASE == 'true' }}
run: |
dnf -y install 'dnf-command(config-manager)'
dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
dnf -y install gh
- name: Configure
run: |
source /opt/rh/gcc-toolset-11/enable
cmake -B _build -S src \
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DBUILD_TOOLS=ON \
-DBUILD_UI=OFF \
-DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install
- name: Build
run: |
source /opt/rh/gcc-toolset-11/enable
cmake --build _build --config Release -j$(nproc)
- name: Run unit and end-to-end tests
if: ${{ env.IS_PUSH == 'true' }}
run: |
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end"
- name: Installer .rpm creation
run: |
cd _build
cpack -G RPM
- name: Solver archive creation
run: |
cd _build
cmake --install . --prefix install
pushd .
cd install/bin
tar czf ../../antares-solver_oracle8.tar.gz antares-solver libsirius_solver.so
popd
rm -rf install
- name: .tar.gz creation
run: |
cd _build
cpack -G TGZ
- name: Installer TGZ push
uses: actions/upload-artifact@v4
with:
name: oracle-targz
path: _build/*.tar.gz
- name: Installer RPM push
uses: actions/upload-artifact@v4
with:
name: oracle-rpm
path: _build/*.rpm
- name: Publish assets
if: ${{ env.IS_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.event.inputs.release_tag }}
run: |
gh release upload "$tag" _build/*.tar.gz _build/*.rpm
- name: Cache vcpkg binary dir
if: always()
id: save-cache-vcpkg-binary
uses: actions/cache/save@v4
with:
path: ${{ env.VCPKG_CACHE_DIR }}
key: vcpkg-cache-oracle8-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }}