ci: add ios ci #67
This file contains hidden or 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
| # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. | ||
|
Check failure on line 1 in .github/workflows/build-client.yml
|
||
| # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | ||
| name: Build UniScan Client | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| create_release: | ||
| description: "Create release" | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| jobs: | ||
| build-client-desktop: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| id: [ | ||
| "win-x64", "win-x86", "win-arm64", | ||
| "linux-x64", "linux-arm", "linux-arm64", "linux-musl-x64", "linux-musl-arm64", "linux-bionic-arm64", | ||
| "osx-x64", "osx-arm64" | ||
| ] | ||
| type: ["Release", "Debug"] | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| submodules: 'recursive' | ||
| - uses: actions/setup-dotnet@v6 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
| - name: Set reusable strings | ||
| # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | ||
| id: strings | ||
| shell: bash | ||
| run: | | ||
| echo "build-output-dir=${{ github.workspace }}/publish/${{matrix.id}}" >> "$GITHUB_OUTPUT" | ||
| - name: Build | ||
| # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| run: > | ||
| dotnet publish ${{github.workspace}}/src/Client/UniScan.Client.App.Platform.Desktop | ||
| -c ${{matrix.type}} | ||
| -r ${{matrix.id}} | ||
| -o ${{steps.strings.outputs.build-output-dir}} | ||
| - name: Upload Artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: UniScan.Client_${{matrix.type}}_${{matrix.id}} | ||
| path: | | ||
| ${{steps.strings.outputs.build-output-dir}} | ||
| build-client-android: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| id: ["android-x64", "android-arm64", "android-arm", "android-x86"] | ||
| type: ["Release", "Debug"] | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| submodules: 'recursive' | ||
| - name: Install Java | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'zulu' | ||
| java-version: '17' | ||
| - uses: actions/setup-dotnet@v6 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
| - name: Install android workload | ||
| run: dotnet workload install android --temp-dir "${{ runner.temp }}" | ||
| - name: Set reusable strings | ||
| # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | ||
| id: strings | ||
| shell: bash | ||
| run: | | ||
| echo "build-output-dir=${{ github.workspace }}/publish/${{matrix.id}}" >> "$GITHUB_OUTPUT" | ||
| - name: Build | ||
| # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| run: > | ||
| dotnet publish ${{github.workspace}}/src/Client/UniScan.Client.App.Platform.Android | ||
| -c ${{matrix.type}} | ||
| -r ${{matrix.id}} | ||
| -o ${{steps.strings.outputs.build-output-dir}} | ||
| - name: Upload Artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: UniScan.Client_${{matrix.type}}_${{matrix.id}} | ||
| path: | | ||
| ${{steps.strings.outputs.build-output-dir}}/*.apk | ||
| build-client-ios: | ||
| runs-on: macos-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| id: ["ios-arm64", "iossimulator-arm64", "iossimulator-x64"] | ||
| type: ["Release", "Debug"] | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| submodules: 'recursive' | ||
| - uses: actions/setup-dotnet@v6 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
| - name: Install iOS workload | ||
| run: dotnet workload install ios --temp-dir "${{ runner.temp }}" | ||
| - name: Set reusable strings | ||
| # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | ||
| id: strings | ||
| shell: bash | ||
| run: | | ||
| echo "build-output-dir=${{ github.workspace }}/publish/${{matrix.id}}" >> "$GITHUB_OUTPUT" | ||
| - name: Build (Normal) | ||
| if: matrix.id == 'ios-arm64' | ||
| # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| #too broke for the stupid apple tax | ||
| #im not paying your fee. Honest. | ||
| run: > | ||
| dotnet publish ${{github.workspace}}/src/Client/UniScan.Client.App.Platform.iOS | ||
| -c ${{matrix.type}} | ||
| -r ${{matrix.id}} | ||
| -o ${{steps.strings.outputs.build-output-dir}} | ||
| -p:CodesignKey="-" | ||
| -p:CodesignProvision="" | ||
| - name: Build (Simulator) | ||
| if: matrix.id != 'ios-arm64' | ||
| # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| run: > | ||
| dotnet build ${{github.workspace}}/src/Client/UniScan.Client.App.Platform.iOS | ||
| -c ${{matrix.type}} | ||
| -r ${{matrix.id}} | ||
| -o ${{steps.strings.outputs.build-output-dir}} | ||
| - name: Upload Artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: UniScan.Client_${{matrix.type}}_${{matrix.id}}_unsigned | ||
| path: | | ||
| ${{steps.strings.outputs.build-output-dir}} | ||
| release-client: | ||
| needs: [build-client-desktop, build-client-android, build-client-ios] | ||
| if: ${{ inputs.create_release == true }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| submodules: 'recursive' | ||
| - uses: actions/setup-dotnet@v6 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| path: ./artifacts | ||
| pattern: UniScan.Client_* | ||
| skip-decompress: true | ||
| - name: Move zips | ||
| run: | | ||
| mkdir -p ./zip | ||
| find ./artifacts/ -mindepth 2 -maxdepth 2 -name "*.zip" -exec mv -t ./zip {} + | ||
| - name: Create release | ||
| if: ${{ inputs.create_release == true }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| VERSION=$(dotnet msbuild ${{github.workspace}}/src/Client/UniScan.Client.App/UniScan.Client.App.csproj -nologo -getProperty:AssemblyVersion | xargs) | ||
| TAG=$(echo UniScan.Client.App/$VERSION) | ||
| gh release create "$TAG" \ | ||
| ./zip/* \ | ||
| --title "UniScan Client v$VERSION" \ | ||
| --generate-notes | ||