-
Notifications
You must be signed in to change notification settings - Fork 12
93 lines (81 loc) · 2.88 KB
/
travis.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: Build and Deploy
on:
push:
tags:
- 'v*' # Ensure only tags trigger this workflow
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc-12, clang-14] # Supported compilers in Ubuntu repositories.
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
if [[ "${{ matrix.cc }}" == "gcc-12" ]]; then
sudo apt-get install -y g++-12
export CC=gcc-12
export CXX=g++-12
elif [[ "${{ matrix.cc }}" == "clang-14" ]]; then
sudo apt-get install -y clang-14 libc++-14-dev libc++abi-14-dev
export CC=clang-14
export CXX=clang++-14
fi
sudo apt-get install -y cmake doxygen graphviz
- name: Configure with CMake
run: |
mkdir build
cd build
cmake ..
- name: Build project
run: |
cd build
make
- name: Generate Documentation
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
run: |
if [ -f doxygen.config ]; then
(cat doxygen.config; echo "PROJECT_NUMBER=${{ github.ref_name }}") | doxygen -
fi
- name: Archive Artifacts
run: |
mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time
if [[ -d src/sydevs/core ]]; then
cp src/sydevs/core/*.h artifacts/include/sydevs/core || true
fi
if [[ -d src/sydevs/systems ]]; then
cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true
fi
if [[ -d src/sydevs/time ]]; then
cp src/sydevs/time/*.h artifacts/include/sydevs/time || true
fi
if [[ -d build ]]; then
cp build/libSyDEVS* artifacts/lib || true
fi
zip -r "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip" artifacts
- name: Package Documentation
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
run: |
if [ -d doc/html ]; then
zip -r "SyDEVS-${{ github.ref_name }}_api-reference.zip" doc/html
fi
- name: Create GitHub Release (Compiler-specific)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip"
asset_name: "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip"
tag: ${{ github.ref_name }} # Use cleaned tag name
overwrite: false
body: "Release for SyDEVS version ${{ github.ref_name }} using compiler ${{ matrix.cc }}"
- name: Deploy Documentation
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
run: bash scripts/deploy_docs.sh