-
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (134 loc) · 5.97 KB
/
linux.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
name: 'Linux'
env:
LIBRARIES_BRANCH: libraries-OS-COMPILER
NCINE_SOURCE_BRANCH: BRANCH_NAME
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- PROJECT_NAME artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
DEPLOY_BRANCH: PROJECT_NAME-BRANCH_NAME-OS-COMPILER
on: [push, workflow_dispatch]
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- BuildType: Debug
CC: gcc
CXX: g++
- BuildType: Release
CC: gcc
CXX: g++
- BuildType: BinDist
CC: gcc
CXX: g++
- BuildType: Debug
CC: clang
CXX: clang++
- BuildType: Release
CC: clang
CXX: clang++
- BuildType: BinDist
CC: clang
CXX: clang++
runs-on: 'ubuntu-22.04'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
- name: 'Install nCine Build Dependencies'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev
- name: 'Unshallow Git Repository for Versioning'
if: matrix.BuildType == 'BinDist'
run: |
git fetch --unshallow || true
- name: 'Download nCine-libraries, pmTracer, and project data'
run: |
export OS=linux
export CC=${{ matrix.CC }}
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/OS/'"$OS"'/'`
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/COMPILER/'"$CC"'/'`
cd ..
git clone https://github.com/nCine/nCine-libraries-artifacts.git
cd nCine-libraries-artifacts
git checkout $LIBRARIES_BRANCH
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
mv nCine-external ..
cd ..
rm -rf nCine-libraries-artifacts
git clone https://github.com/encelo/pmTracer.git
git clone https://github.com/$GITHUB_REPOSITORY-data.git
- name: 'Download nCine source and data'
run: |
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export NCINE_SOURCE_BRANCH=`echo $NCINE_SOURCE_BRANCH | sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/'`
cd ..
git clone https://github.com/nCine/nCine-data.git
git clone https://github.com/nCine/nCine.git --branch $NCINE_SOURCE_BRANCH
- name: 'CMake Configuration and Make of nCine as a static library'
run: |
cd ../nCine
if [[ "${{ matrix.BuildType }}" == "BinDist" ]]; then
export NCINE_BUILD_TYPE=Release
else
export NCINE_BUILD_TYPE=${{ matrix.BuildType }}
fi
export CMAKE_ARGS="-B ../nCine-build-$NCINE_BUILD_TYPE -D CMAKE_BUILD_TYPE=$NCINE_BUILD_TYPE -D NCINE_DYNAMIC_LIBRARY=OFF -D NCINE_PREFERRED_BACKEND=SDL2 -D NCINE_WITH_WEBP=OFF -D NCINE_WITH_AUDIO=OFF -D NCINE_WITH_SCRIPTING_API=OFF -D NCINE_BUILD_TESTS=OFF"
export CC= ${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
export CMAKE_ARGS="$CMAKE_ARGS -D CMAKE_PREFIX_PATH=$(pwd)/../nCine-external"
cmake $CMAKE_ARGS
cd ..
make -j2 -C nCine-build-$NCINE_BUILD_TYPE
- name: 'CMake Configuration'
run: |
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
export CMAKE_ARGS="-B ../$PROJECT_NAME-build-${{ matrix.BuildType }} -D PMTRACER_ROOT=$(pwd)/../pmTracer"
export CC= ${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
export CMAKE_ARGS="$CMAKE_ARGS -D CMAKE_PREFIX_PATH=$(pwd)/../nCine-external"
if [[ "${{ matrix.BuildType }}" == "BinDist" ]]; then
cmake $CMAKE_ARGS -D NCPROJECT_OPTIONS_PRESETS=${{ matrix.BuildType }} -D CMAKE_INSTALL_PREFIX="" -D nCine_DIR=$(pwd)/../nCine-build-Release
else
cmake $CMAKE_ARGS -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D nCine_DIR=$(pwd)/../nCine-build-${{ matrix.BuildType }}
fi
- name: 'Make'
run: |
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/../nCine-external/lib
make -j2 -C ../$PROJECT_NAME-build-${{ matrix.BuildType }}
- name: 'Package'
if: matrix.BuildType == 'BinDist'
run: |
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
make package -C ../$PROJECT_NAME-build-${{ matrix.BuildType }}
- name: 'Push Artifacts'
if: matrix.BuildType == 'BinDist'
env:
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export DEPLOY_MESSAGE=`sed 's/PROJECT_NAME/'"$PROJECT_NAME"'/' <<< "$DEPLOY_MESSAGE"`
export DEPLOY_MESSAGE=`sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/' <<< "$DEPLOY_MESSAGE"`
export OS=linux
export CC=${{ matrix.CC }}
export PROJECT_EXT=tar.gz
cd ..
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/PROJECT_NAME/'"$PROJECT_NAME"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/OS/'"$OS"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/COMPILER/'"$CC"'/'`
git clone https://[email protected]/$GITHUB_REPOSITORY-artifacts.git >/dev/null 2>&1
cd $PROJECT_NAME-artifacts
git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH
git reset
git clean -f
git rm * || true
mv -f ../$PROJECT_NAME-build-${{ matrix.BuildType }}/*.$PROJECT_EXT .
git add *.$PROJECT_EXT
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
git push --force || git push --set-upstream origin $DEPLOY_BRANCH