-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d3fb20
commit 7cb6ca9
Showing
1 changed file
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: 'HW3 action' | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'HW3/**' | ||
- '.github/workflows/HW3.yml' | ||
|
||
permissions: | ||
actions: write | ||
contents: write | ||
|
||
jobs: | ||
build-and-run-job: | ||
env: | ||
target_name: allocator | ||
homework_label: HW3 | ||
cmake_preset: linux-release | ||
cmake_build_preset: linux-build-release | ||
hw_path: ./HW3 | ||
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 |