Replace a loop with algorithms
[openal-soft.git] / .github / workflows / utils.yml
blob74ff8900d10054b976eaf3bf7914dc4e48bdc751
1 name: utils
3 on:
4   push:
5     paths:
6       - 'utils/**'
7       - '.github/workflows/utils.yml'
9   workflow_dispatch:
11 env:
12   BUILD_TYPE: Release
13   Branch: ${{github.ref_name}}
15 jobs:
16   Win64:
17     runs-on: windows-latest
19     steps:
20     - name: Clone repo and submodules
21       run: git clone https://github.com/${{github.repository}}.git . --branch ${{env.Branch}}
23     - name: Get current date, commit hash and count
24       run: |
25         echo "CommitDate=$(git show -s --date=format:'%Y-%m-%d' --format=%cd)" >> $env:GITHUB_ENV
26         echo "CommitHashShort=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV
27         echo "CommitCount=$(git rev-list --count ${{env.Branch}} --)" >> $env:GITHUB_ENV
29     - name: Clone libmysofa
30       run: |
31         git clone https://github.com/ThreeDeeJay/libmysofa.git
32         cd libmysofa
33         git checkout 8642646ee6caca9085456bfa9d731200d68c25ca
35     - name: Add MSBuild to PATH
36       uses: microsoft/setup-msbuild@v1.1.3
38     - name: Restore libmysofa NuGet packages
39       working-directory: ${{github.workspace}}/libmysofa
40       run: nuget restore ${{github.workspace}}/libmysofa/windows/libmysofa.sln
42     - name: Build libmysofa
43       working-directory: ${{github.workspace}}/libmysofa
44       run: msbuild /m /p:Configuration=${{env.BUILD_TYPE}} ${{github.workspace}}/libmysofa/windows/libmysofa.sln
46     - name: Configure CMake
47       run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -D "MYSOFA_LIBRARY=${{github.workspace}}/libmysofa/windows/bin/x64/Release/mysofa.lib" -D "MYSOFA_INCLUDE_DIR=${{github.workspace}}/libmysofa/src/hrtf" -D "ZLIB_LIBRARY=${{github.workspace}}/libmysofa/windows/third-party/zlib-1.2.11/lib/zlib.lib" -D "ZLIB_INCLUDE_DIR=${{github.workspace}}/libmysofa/windows/third-party/zlib-1.2.11/include"
49     - name: Build
50       run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
52     - name: Make Artifacts folder
53       run: |
54         mkdir "Artifacts"
55         mkdir "Release"
57     - name: Collect artifacts
58       run: |
59         copy "build/Release/makemhr.exe" "Artifacts/makemhr.exe"
60         copy "build/Release/sofa-info.exe" "Artifacts/sofa-info.exe"
61         copy "build/Release/alrecord.exe" "Artifacts/alrecord.exe"
62         copy "build/Release/altonegen.exe" "Artifacts/altonegen.exe"
63         copy "build/Release/openal-info.exe" "Artifacts/openal-info.exe"
64         copy "build/Release/allafplay.exe" "Artifacts/allafplay.exe"
65         copy "libmysofa/windows/third-party/zlib-1.2.11/bin/zlib.dll" "Artifacts/zlib.dll"
67     - name: Upload artifacts
68       uses: actions/upload-artifact@v4
69       with:
70         name: ${{env.CommitDate}}_utils-r${{env.CommitCount}}@${{env.CommitHashShort}}
71         path: "Artifacts/"
73     - name: Compress artifacts
74       uses: papeloto/action-zip@v1
75       with:
76         files: Artifacts/
77         dest: "Release/utils.zip"
79     - name: GitHub pre-release
80       uses: "marvinpinto/action-automatic-releases@latest"
81       with:
82         repo_token: "${{secrets.GITHUB_TOKEN}}"
83         automatic_release_tag: "utils"
84         prerelease: true
85         title: "[${{env.CommitDate}}] utils-r${{env.CommitCount}}@${{env.CommitHashShort}}"
86         files: "Release/utils.zip"