-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (120 loc) · 4.56 KB
/
HW4.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
name: 'HW4 action'
on:
workflow_dispatch:
push:
paths:
- 'HW4/**'
- '.github/workflows/HW4.yml'
permissions:
actions: write
contents: write
jobs:
build-and-run-job:
env:
target_name: print_ip
homework_label: HW4
cmake_preset: linux-release
cmake_build_preset: linux-build-release
hw_path: ./HW4
build_folder: build
release_folder: linux-release
version_base: '1.0'
build_tests: ${{ false }}
# Variables to populate in "Initialize variables" step
build_path:
bin_path:
deb_path:
version:
runs-on: ubuntu-latest
steps:
- name: Initialize variables
run: |
echo "build_path=${{ env.hw_path }}/${{ env.build_folder }}/${{ env.release_folder }}" >> $GITHUB_ENV
echo "bin_path=${{ env.hw_path }}/${{ env.build_folder }}/${{ env.release_folder }}/bin" >> $GITHUB_ENV
echo "deb_path=${{ env.hw_path }}/${{ env.build_folder }}/${{ env.release_folder }}/deb" >> $GITHUB_ENV
echo "version=${{ env.version_base }}.${{ github.run_number }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
#- name: Update apt-get
# run: sudo apt-get update
- name: Build package ${{ env.target_name }}
working-directory: ${{env.hw_path}}
run: |
cmake -DBuildTests=${{ env.build_tests }} -DPROJECT_VERSION=${{ env.version }} --preset ${{ env.cmake_preset }}
cmake --build --preset ${{ env.cmake_build_preset }}
- name: Run tests
if: ${{ env.build_tests }}
working-directory: ${{ env.build_path }}
run: ctest --test-dir .
- name: Check tests results
if: ${{ env.build_tests && !success()}}
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run packet ${{ env.target_name }}
run: '${{ env.bin_path }}/${{ env.target_name }}'
- name: Build package
working-directory: ${{env.build_path}}
run: cpack -G DEB
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.homework_label }}_${{ github.run_number }}
release_name: ${{ env.homework_label }} release ${{ github.run_number }}
draft: false
prerelease: false
- name: Upload packet
id: upload-app-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.bin_path }}/${{ env.target_name }}
asset_name: ${{ env.target_name }}
asset_content_type: application/octet-stream
- name: Upload package
id: upload-package-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.deb_path }}/${{ env.target_name }}-${{ env.version }}-Linux.deb
asset_name: ${{ env.target_name }}-${{ env.version }}-Linux.deb
asset_content_type: application/vnd.debian.binary-package
- name: Create Doxygen
uses: mattnotmitt/[email protected]
with:
doxyfile-path: ./Doxyfile
working-directory: ${{ env.hw_path }}
- name: GitHub Pages Deployment
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html/
enable_jekyll: false
allow_empty_commit: false
force_orphan: true
publish_branch: gh-pages
# Build the HTML documentation
- name: Doxygen Action
uses: mattnotmitt/[email protected]
with:
doxyfile-path: ${{ env.hw_path }}/Doxyfile
working-directory: .
# Deploy the HTML documentation to GitHub Pages
- name: GH Pages Deployment
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.hw_path }}/doc/html/
enable_jekyll: false
allow_empty_commit: false
force_orphan: true
publish_branch: gh-pages