Build sdsio-server #66
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
| name: Build sdsio-server | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| trigger_extension_build: | |
| description: 'Trigger CMSIS SDS extension build as part of this workflow.' | |
| required: false | |
| default: false | |
| type: boolean | |
| release: | |
| types: | |
| - published | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2025, ubuntu-24.04, macos-15, ubuntu-24.04-arm] | |
| include: | |
| - os: windows-2025 | |
| artifact_name: sdsio-server-windows | |
| - os: ubuntu-24.04 | |
| artifact_name: sdsio-server-linux | |
| - os: macos-15 | |
| artifact_name: sdsio-server-macos | |
| - os: ubuntu-24.04-arm | |
| artifact_name: sdsio-server-linux-arm64 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Setup Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Install PyInstaller | |
| run: pip install pyinstaller | |
| - name: Install dependencies | |
| run: pip install -r ./utilities/requirements.txt | |
| - name: Extract SDSIO-Server version | |
| shell: bash | |
| run: | | |
| SDSIO_SERVER_VERSION=$(sed -nE "s/^SDSIO_SERVER_VERSION[[:space:]]*=[[:space:]]*['\"]([^'\"]+)['\"].*/\1/p" utilities/sdsio-server.py | head -n 1) | |
| test -n "$SDSIO_SERVER_VERSION" || { echo "Failed to extract SDSIO_SERVER_VERSION from utilities/sdsio-server.py"; exit 1; } | |
| echo "SDSIO_SERVER_VERSION=$SDSIO_SERVER_VERSION" >> "$GITHUB_ENV" | |
| - name: Build executable | |
| run: | | |
| pyinstaller --clean --noconfirm --onefile --name sdsio-server utilities/sdsio-server.py | |
| - name: Check executable version | |
| shell: bash | |
| run: | | |
| EXECUTABLE_OUTPUT=$(dist/sdsio-server --version 2>&1 | tr -d '\r') | |
| echo "$EXECUTABLE_OUTPUT" | |
| EXECUTABLE_VERSION=$(echo "$EXECUTABLE_OUTPUT" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)?' | head -n 1) | |
| [[ "$EXECUTABLE_VERSION" == "$SDSIO_SERVER_VERSION" ]] || { | |
| echo "Version mismatch: expected $SDSIO_SERVER_VERSION, got $EXECUTABLE_VERSION" | |
| exit 1 | |
| } | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.artifact_name }}-${{ env.SDSIO_SERVER_VERSION }} | |
| path: dist/sdsio-server* | |
| retention-days: 7 | |
| # Triggers the CMSIS SDS extension nightly workflow | |
| trigger-sds-extn: | |
| needs: [ build ] | |
| if: >- | |
| success() && github.repository == 'ARM-software/SDS-Framework' && | |
| ((github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_extension_build) || github.event_name == 'schedule') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - name: Trigger vscode-cmsis-sds workflow | |
| run: | | |
| curl --fail-with-body --show-error --silent -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.CROSS_REPO_SDS_EXTN_TOKEN }}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Content-Type: application/json" \ | |
| https://api.github.com/repos/Open-CMSIS-Pack/vscode-cmsis-sds/actions/workflows/nightly.yml/dispatches \ | |
| -d '{"ref":"main"}' |