-
-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (73 loc) · 3.05 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
name: 'Linux'
env:
DEPLOY_FILE_NOEXT: nCine-external-OS-COMPILER-VERSION
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- nCine-libraries artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
DEPLOY_BRANCH: libraries-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: Debug
CC: clang
CXX: clang++
- BuildType: Release
CC: clang
CXX: clang++
runs-on: 'ubuntu-20.04'
steps:
- name: 'Checkout code'
uses: actions/checkout@v3
- name: 'Install Build Dependencies'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libasound2-dev libpulse-dev
- name: 'CMake Configuration'
run: |
export CC=${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
cmake -B ../nCine-libraries-build -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }}
- name: 'Make'
run: |
make -j2 -C ../nCine-libraries-build
- name: 'Push Artifacts'
if: matrix.BuildType == 'Release'
env:
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
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/BRANCH_NAME/'"$BRANCH_NAME"'/' <<< "$DEPLOY_MESSAGE"`
export OS=linux
export CC=${{ matrix.CC }}
git fetch --unshallow || true
export GIT_VERSION=$(set -o pipefail; git describe --tags --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)";)
cd ..
export DEPLOY_FILE=$DEPLOY_FILE_NOEXT.tar.gz
export DEPLOY_FILE=`echo $DEPLOY_FILE | sed 's/OS/'"$OS"'/'`
export DEPLOY_FILE=`echo $DEPLOY_FILE | sed 's/COMPILER/'"$CC"'/'`
export DEPLOY_FILE=`echo $DEPLOY_FILE | sed 's/VERSION/'"$GIT_VERSION"'/'`
tar cpzf $DEPLOY_FILE nCine-external
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/OS/'"$OS"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/COMPILER/'"$CC"'/'`
git clone https://$PUBLIC_REPO_TOKEN@github.com/nCine/nCine-libraries-artifacts.git >/dev/null 2>&1
cd nCine-libraries-artifacts
git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH
git reset
git clean -f
git rm * || true
mv -f ../$DEPLOY_FILE .
git add $DEPLOY_FILE
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
git push --force || git push --set-upstream origin $DEPLOY_BRANCH