Skip to content

Commit 04df88e

Browse files
authored
Update travis.yml
1 parent f494150 commit 04df88e

File tree

1 file changed

+57
-16
lines changed

1 file changed

+57
-16
lines changed

.github/workflows/travis.yml

+57-16
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ name: Build and Deploy
22

33
on:
44
push:
5+
tags:
6+
- 'v*' # Ensure only tags trigger this workflow
57
pull_request:
68
branches:
79
- main
810
workflow_dispatch:
11+
912
jobs:
1013
build:
1114
runs-on: ubuntu-latest
1215

1316
strategy:
1417
matrix:
15-
cc: [gcc-12, clang-14] # Use supported versions available in Ubuntu repositories.
18+
cc: [gcc-12, clang-14] # Supported compilers in Ubuntu repositories.
1619

1720
steps:
1821
- name: Checkout repository
@@ -32,8 +35,8 @@ jobs:
3235
export CC=clang-14
3336
export CXX=clang++-14
3437
fi
35-
# Install CMake
36-
sudo apt-get install -y cmake
38+
# Install additional dependencies
39+
sudo apt-get install -y cmake doxygen graphviz
3740
3841
- name: Configure with CMake
3942
run: |
@@ -46,16 +49,54 @@ jobs:
4649
cd build
4750
make
4851
49-
- name: Archive artifacts
50-
run: |
51-
mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time
52-
if [[ -d src/sydevs/core ]]; then
53-
cp src/sydevs/core/*.h artifacts/include/sydevs/core || true
54-
fi
55-
if [[ -d src/sydevs/systems ]]; then
56-
cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true
57-
fi
58-
if [[ -d src/sydevs/time ]]; then
59-
cp src/sydevs/time/*.h artifacts/include/sydevs/time || true
60-
fi
61-
zip -r artifacts.zip artifacts
52+
- name: Generate Documentation
53+
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
54+
run: |
55+
if [ -f doxygen.config ]; then
56+
(cat doxygen.config; echo "PROJECT_NUMBER=${{ github.ref_name }}") | doxygen -
57+
fi
58+
59+
- name: Archive Artifacts
60+
run: |
61+
# Create artifact directories
62+
mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time
63+
# Copy headers
64+
if [[ -d src/sydevs/core ]]; then
65+
cp src/sydevs/core/*.h artifacts/include/sydevs/core || true
66+
fi
67+
if [[ -d src/sydevs/systems ]]; then
68+
cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true
69+
fi
70+
if [[ -d src/sydevs/time ]]; then
71+
cp src/sydevs/time/*.h artifacts/include/sydevs/time || true
72+
fi
73+
# Copy compiled libraries
74+
if [[ -d build ]]; then
75+
cp build/libSyDEVS* artifacts/lib || true
76+
fi
77+
mkdir -p $(dirname "SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip")
78+
# Create final archive
79+
zip -r SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip artifacts
80+
81+
- name: Package Documentation
82+
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
83+
run: |
84+
if [ -d doc/html ]; then
85+
zip -r SyDEVS-${{ github.ref }}_api-reference.zip doc/html
86+
fi
87+
88+
# Step 3: Create GitHub Release for the Compiler
89+
- name: Create GitHub Release (Compiler-specific)
90+
uses: svenstaro/upload-release-action@v2
91+
with:
92+
repo_token: ${{ secrets.GITHUB_TOKEN }}
93+
file: SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip # Unique filename with version and compiler
94+
asset_name: SyDEVS_Release_${{ github.ref }}-${{ matrix.cc }}.zip # Unique filename with version and compiler
95+
tag: ${{ github.ref }} # Use tag name as version
96+
overwrite: false # Prevent overwriting if asset already exists
97+
body: "Release for SyDEVS version ${{ github.ref }} using compiler ${{ matrix.cc }}"
98+
99+
# Step 4: Deploy Documentation
100+
- name: Deploy Documentation
101+
if: github.event_name == 'push' || github.ref == 'refs/tags/*'
102+
run: bash scripts/deploy_docs.sh

0 commit comments

Comments
 (0)