-
Notifications
You must be signed in to change notification settings - Fork 24
132 lines (114 loc) · 4.06 KB
/
centos7.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
name: Centos7 CI (push and/or release)
on:
release:
types: [ created ]
push:
branches:
- develop
- dependabot/*
- feature/reserve_model_lot3_scalian
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}}
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
#sparse checkout -- only needed files
- uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: |
docker
src/vcpkg.json
ref: ${{ env.REF }}
- name: set env variables -- DockerFiles
run: |
echo "DOCKERFILE=$(pwd)/docker/Dockerfile" >> $GITHUB_ENV
echo "DOCKERDIR=$(pwd)/docker" >> $GITHUB_ENV
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
docker/AntaresDeps
- name: Docker file push
id: docker_push
if: steps.changed-files.outputs.any_changed == 'true'
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: antaresrte/antaressystemdeps
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: ${{ env.DOCKERDIR }}
dockerfile: ${{ env.DOCKERDIR }}/AntaresDeps
cache: false
tags: latest
- name: create vcpkg cache dir
run: |
echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV
mkdir -p ${{ github.workspace }}/vcpkg_cache
- name: Restore vcpkg binary dir from cache
id: cache-vcpkg-binary
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-centos7-${{ 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-centos7-
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: centos7-on-${{ runner.os }}
- name: Build the image and Antares
run: |
ls -latr .ccache/ && \
docker build \
-t antares:centos7 \
--build-arg="BRANCH=${{ env.REF }}" \
--build-arg="NPROC=$(nproc)" \
--build-arg="VCPKG_CACHE_DIR=./vcpkg_cache" \
--build-arg CCACHE_DIR=./.ccache \
--build-arg CCACHE_KEY=centos7-on-${{ runner.os }} \
-f ${{ env.DOCKERFILE }} .
- name: create a container without starting it && retrieve the .tgz
run: |
container_id=$(docker create antares:centos7)
docker cp $container_id:/workspace/Antares_Simulator/_build/archive archive
docker cp $container_id:/workspace/vcpkg_cache ${{ env.VCPKG_CACHE_DIR }}
docker cp $container_id:/workspace/.ccache/. .ccache
ls -la .ccache
docker rm $container_id
- name: Publish assets
if: ${{ env.IS_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.event.inputs.release_tag }}
run: |
gh release upload "$tag" archive/*.tar.gz archive/*.rpm
- name: Upload .tar.gz
uses: actions/upload-artifact@v4
with:
path: archive/*.tar.gz
name: antares-9.2.0-rc4-CentOS-7.9.2009.tar.gz
- name: Cache vcpkg binary dir
if: always()
id: save-cache-vcpkg-binary
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }}