Fix sounds #171
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
name: CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
build_type: [Release] | |
c_compiler: [gcc, cl] | |
include: | |
- os: windows-latest | |
c_compiler: cl | |
cpp_compiler: cl | |
- os: ubuntu-latest | |
c_compiler: gcc | |
cpp_compiler: g++ | |
exclude: | |
- os: windows-latest | |
c_compiler: gcc | |
- os: ubuntu-latest | |
c_compiler: cl | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # complete history | |
fetch-tags: true | |
- name: Get Git Tag Linux | |
id: tags | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Get Git Tag Windows | |
id: tags_win | |
run: | | |
$tag = $env:GITHUB_REF -replace 'refs/tags/', '' | |
echo "::set-output name=tag::$tag" | |
shell: pwsh | |
- name: Install Qt6 dependencies for Windows | |
if: runner.os == 'Windows' | |
uses: jurplel/install-qt-action@v4.0.0 | |
with: | |
aqtversion: '==3.1.*' | |
version: '6.6.1' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2019_64' | |
modules: 'qtcharts qtmultimedia' | |
- name: Install Qt6 dependencies for Linux | |
if: runner.os == 'Linux' | |
uses: jurplel/install-qt-action@v4.0.0 | |
with: | |
aqtversion: '==3.1.*' | |
version: '6.6.3' | |
host: 'linux' | |
target: 'desktop' | |
arch: 'gcc_64' | |
modules: 'qtcharts qtmultimedia' | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake for Windows | |
if: runner.os == 'Windows' | |
run: | | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} ` | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ` | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} ` | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
-DCMAKE_PREFIX_PATH=${{ env.Qt6_DIR }} ` | |
-DCMAKE_IS_GITHUB_WORKFLOW=ON ` | |
-S ${{ github.workspace }} | |
- name: Configure CMake for Linux | |
if: runner.os == 'Linux' | |
run: | | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_PREFIX_PATH=/usr/lib/qt6 \ | |
-S ${{ github.workspace }} | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: ${{ steps.strings.outputs.build-output-dir }}/tests | |
run: ctest --build-config ${{ matrix.build_type }} | |
- name: Install Build Output | |
run: cmake --install ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --strip | |
- name: Compress Build Output | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
if [ "${{ runner.os }}" == "Linux" ]; then | |
cd ${{ steps.strings.outputs.build-output-dir }}/install && tar -cvzf ../../dartomato-build-${{ matrix.os }}-${{ matrix.build_type }}-${{ steps.tags.outputs.tag }}.tar.gz * | |
else | |
pwsh -Command "Compress-Archive -Path '${{ steps.strings.outputs.build-output-dir }}/bin/*' -DestinationPath 'dartomato-build-${{ matrix.os }}-${{ matrix.build_type }}-${{ steps.tags_win.outputs.tag }}.zip'" | |
fi | |
shell: bash | |
- name: Upload Artifacts | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dartomato-build-${{ matrix.os }}-${{ matrix.build_type }}-${{ runner.os == 'Linux' && steps.tags.outputs.tag || steps.tags_win.outputs.tag }} | |
path: dartomato-build-${{ matrix.os }}-${{ matrix.build_type }}-${{ runner.os == 'Linux' && steps.tags.outputs.tag || steps.tags_win.outputs.tag }}.${{ runner.os == 'Linux' && 'tar.gz' || 'zip' }} | |
deploy: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Get Git Tag Linux | |
id: tags | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Get Git Tag Windows | |
id: tags_win | |
run: | | |
$tag = $env:GITHUB_REF -replace 'refs/tags/', '' | |
echo "::set-output name=tag::$tag" | |
shell: pwsh | |
- name: Download Linux Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dartomato-build-ubuntu-latest-Release-${{ steps.tags.outputs.tag }} | |
path: ./linux/ | |
- name: Download Windows Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dartomato-build-windows-latest-Release-${{ steps.tags_win.outputs.tag }} | |
path: ./windows/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: "Release ${{ github.ref }}" | |
draft: false | |
prerelease: false | |
- name: Upload Linux Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./linux/dartomato-build-ubuntu-latest-Release-${{ steps.tags.outputs.tag }}.tar.gz | |
asset_name: dartomato-build-ubuntu-latest-Release-${{ steps.tags.outputs.tag }}.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./windows/dartomato-build-windows-latest-Release-${{ steps.tags_win.outputs.tag }}.zip | |
asset_name: dartomato-build-windows-latest-Release-${{ steps.tags_win.outputs.tag }}.zip | |
asset_content_type: application/zip | |