| #
|
| # Copyright (c) 2022-present, IO Visor Project
|
| # All rights reserved.
|
| #
|
| # This source code is licensed in accordance with the terms specified in
|
| # the LICENSE file found in the root directory of this source tree.
|
| #
|
|
|
| name: Windows
|
|
|
| on:
|
| workflow_call:
|
| inputs:
|
| platform:
|
| required: true
|
| type: string
|
|
|
| build_type:
|
| required: true
|
| type: string
|
|
|
| upload_packages:
|
| required: true
|
| type: boolean
|
|
|
| build_codeql:
|
| required: false
|
| type: boolean
|
|
|
| disable_retpolines:
|
| required: false
|
| type: boolean
|
|
|
| permissions: |
| contents: read |
| |
| jobs:
|
| build:
|
| permissions: |
| actions: read # for github/codeql-action/init to get workflow details |
| contents: read # for actions/checkout to fetch code |
| security-events: write # for github/codeql-action/analyze to upload SARIF results |
| runs-on: ${{ inputs.platform }}
|
|
|
| steps:
|
| - name: Harden Runner |
| uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 |
| with: |
| egress-policy: audit |
| |
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
| with:
|
| submodules: 'recursive'
|
|
|
| - name: Initialize CodeQL
|
| if: inputs.build_codeql == true
|
| uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14
|
| with:
|
| languages: 'cpp'
|
|
|
| - name: Configure uBPF
|
| run: |
|
| cmake `
|
| -S . `
|
| -B build `
|
| -DUBPF_ENABLE_TESTS=true `
|
| -DUBPF_DISABLE_RETPOLINES=${{ inputs.disable_retpolines }} `
|
| -DUBPF_ENABLE_INSTALL=true
|
|
|
| - name: Build uBPF
|
| run: |
|
| cmake `
|
| --build build `
|
| --config ${{ inputs.build_type }}
|
|
|
| # Switch this to Docker when a Windows image is available.
|
| - name: Run the bpf_conformance tests (Windows)
|
| run: |
|
| cd .\build\bin\${{ inputs.build_type }}
|
| $BPF_CONFORMANCE_RUNNER = "..\..\external\bpf_conformance\bin\${{ inputs.build_type }}\bpf_conformance_runner.exe"
|
| & $BPF_CONFORMANCE_RUNNER --test_file_directory ..\tests --plugin_path ubpf_plugin.exe --plugin_options --jit
|
| if ($LastExitCode -ne 0) { throw "Test failed"; }
|
| & $BPF_CONFORMANCE_RUNNER --test_file_directory ..\tests --plugin_path ubpf_plugin.exe --plugin_options --interpret
|
| if ($LastExitCode -ne 0) { throw "Test failed"; }
|
| & $BPF_CONFORMANCE_RUNNER --exclude_regex lock_ --test_file_directory ..\..\external\bpf_conformance\tests --plugin_path ubpf_plugin.exe --plugin_options --jit
|
| if ($LastExitCode -ne 0) { throw "Test failed"; }
|
| & $BPF_CONFORMANCE_RUNNER --exclude_regex lock_ --test_file_directory ..\..\external\bpf_conformance\tests --plugin_path ubpf_plugin.exe --plugin_options --interpret
|
| if ($LastExitCode -ne 0) { throw "Test failed"; }
|
|
|
| - name: Generate the TGZ package
|
| run: |
|
| cmake `
|
| -S . `
|
| -B build `
|
| -DUBPF_ENABLE_PACKAGE=true `
|
| -DCPACK_GENERATOR=TGZ
|
|
|
| cmake `
|
| --build build `
|
| --target package
|
|
|
| - name: Locate the packages
|
| id: package_locations
|
| if: inputs.upload_packages == true
|
| shell: bash
|
| run: |
|
| echo "REL_TGZ_PACKAGE_PATH=$(ls build/*.tar.gz)" >> $GITHUB_OUTPUT
|
|
|
| - name: Upload the Windows TGZ package
|
| if: inputs.upload_packages == true
|
| uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
| with:
|
| name: windows_tgz_package
|
| path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }}
|
| retention-days: 5
|
|
|
| - name: Perform CodeQL Analysis
|
| if: inputs.build_codeql == true
|
| uses: github/codeql-action/analyze@d39d31e687223d841ef683f52467bd88e9b21c14
|