From 07975eb07660cd07fd53c24c935d2dce8ca56764 Mon Sep 17 00:00:00 2001 From: Sylvain Fortin Date: Thu, 8 Jun 2023 14:00:12 -0400 Subject: [PATCH] Run samples in parallel on GitHub Actions - Samples jobs are now dynamicaly generated when workflow run. The generate_samples_matrix job creates the matrix strategy directly from SamplesDef.json. Adding a new sample to this file will automatically add it to GitHub Actions workflow. - Removed debug configuration for samples. Make workflow complete faster (GitHub free limit to 20 concurent jobs). - Added necessary properties to SamplesDef.json to generate matrix strategy. The `Ci` property was also added to control whether the sample is run on GitHub and/or GitLab. - To simplify actions.yml: - Docker commands for HelloLinux samples were moved to SamplesDef.json. Using RunSample.ps1 on HelloLinux now assume user has a working Docker environment. - Qt installation has also been moved to SamplesDef.json. --- .github/Get-SamplesMatrixJson.ps1 | 52 ++++++++ .github/workflows/actions.yml | 189 +++++------------------------- .gitlab/.gitlab-ci.yml | 31 +++-- RunSample.ps1 | 4 + SamplesDef.json | 117 +++++++++++++++++- samples/HelloLinux/Dockerfile | 6 +- 6 files changed, 221 insertions(+), 178 deletions(-) create mode 100644 .github/Get-SamplesMatrixJson.ps1 diff --git a/.github/Get-SamplesMatrixJson.ps1 b/.github/Get-SamplesMatrixJson.ps1 new file mode 100644 index 000000000..fd342297d --- /dev/null +++ b/.github/Get-SamplesMatrixJson.ps1 @@ -0,0 +1,52 @@ +<# +.SYNOPSIS +Gets the matrix strategy used to generate samples jobs on GitHub Actions. + +.DESCRIPTION +Transform the content of SamplesDef.json into a GitHub Actions matrix strategy representation that can be used to generate samples job. + +.OUTPUTS +System.String + Get-SamplesMatrixJson returns the samples job matrix strategy formatted as JSON. +#> + +# Load samples definitions. +$samplesDef = Get-Content -Raw -Path "SamplesDef.json" | ConvertFrom-Json + +# Transform into a list of samples matrix configurations. +$matrixInclude = foreach ($sample in $samplesDef.Samples) +{ + if ($sample.CIs.Contains("github")) + { + foreach ($os in $sample.OSs) + { + foreach ($framework in $sample.Frameworks) + { + # Map os to GitLab runner label + $runsOn = switch ( $os ) + { + 'linux' { 'ubuntu-latest' } + 'macos' { 'macos-latest' } + default { $os } + } + + [pscustomobject]@{ + name = $sample.Name + os = $runsOn + framework = $framework + configurations = $sample.Configurations -join ',' + } + } + } + } +} + +# Explicit matrix configurations with include only matrix strategy. +# See https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#example-adding-configurations. +$samplesMatrix = [pscustomobject]@{ + include = $matrixInclude +} + +# Output matrix object as Json. +# Enable dynamically specifying samples jobs by passing the produced Json as the matrix strategy. +$samplesMatrix | ConvertTo-Json diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index f310335bc..f26cf22fe 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -51,15 +51,32 @@ jobs: if: runner.os == 'Windows' run: python functional_test.py --sharpmake_exe "Sharpmake.Application/bin/release/${{ matrix.framework }}/Sharpmake.Application.exe" - samples: + generate_samples_matrix: needs: [builds] + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Checkout the repo + uses: actions/checkout@v3.5.2 + + - name: Generate samples matrix + id: set-matrix + shell: pwsh + run: | + $sampleMatrix = .\.github\Get-SamplesMatrixJson.ps1 + echo $sampleMatrix + $eof = [Convert]::ToBase64String((Get-Random -InputObject (0..255) -Count 15 | ForEach-Object { [byte]$_ })) + echo "matrix<<$eof" >> $env:GITHUB_OUTPUT + echo $sampleMatrix >> $env:GITHUB_OUTPUT + echo "$eof" >> $env:GITHUB_OUTPUT + + samples: + needs: [generate_samples_matrix] runs-on: ${{ matrix.os }} strategy: fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-2019, windows-2022] - framework: [net6.0] - configuration: [debug, release] + matrix: ${{fromJSON(needs.generate_samples_matrix.outputs.matrix)}} steps: - name: Checkout the repo uses: actions/checkout@v3.5.2 @@ -81,167 +98,17 @@ jobs: name: 'Sharpmake-${{ matrix.framework }}-${{ runner.os }}-${{ github.sha }}' path: Sharpmake.Application/bin/Release/${{ matrix.framework }} - - name: CompileCommandDatabase ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.configuration == 'debug' # only has a debug config, so skip in release - shell: pwsh - run: | # TODO: ideally here we should try and compile the generated json file - .\RunSample.ps1 -sampleName "CompileCommandDatabase" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: ConfigureOrder ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.configuration == 'release' - shell: pwsh - run: - .\RunSample.ps1 -sampleName "ConfigureOrder" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CPPCLI ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2019' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CPPCLI" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CSharpHelloWorld old frameworks ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2019' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CSharpHelloWorld_old_frameworks" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CSharpHelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2022' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CSharpHelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CSharpImports ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CSharpImports" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CSharpVsix ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CSharpVsix" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - # that one can't be run unfortunately - - - name: CustomBuildStep ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CustomBuildStep" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: CSharpWCF ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "CSharpWCF" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - # that one can't be run unfortunately - - - name: FastBuildSimpleExecutable ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "FastBuildSimpleExecutable" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} -vsVersionSuffix ${env:VS_VERSION_SUFFIX} - - # Temp disable after Github VM update which updated the NDK and broke it - # - name: HelloAndroid ${{ matrix.configuration }} - # if: runner.os == 'Windows' - # shell: pwsh - # run: | - # $env:JAVA_HOME = $env:JAVA_HOME_11_X64 - # .\RunSample.ps1 -sampleName "HelloAndroid" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: HelloClangCl ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "HelloClangCl" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} -vsVersionSuffix ${env:VS_VERSION_SUFFIX} - - - name: HelloEvents ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "HelloEvents" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} -vsVersionSuffix ${env:VS_VERSION_SUFFIX} - - - name: HelloLinux ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Linux' - shell: pwsh - run: | - docker build -f samples/HelloLinux/Dockerfile -t sharpmake-hellolinux --build-arg CONFIGURATION=${{ matrix.configuration }} --build-arg FRAMEWORK=${{ matrix.framework }} . - docker run --rm sharpmake-hellolinux - - - name: HelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "HelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: HelloXCode ${{ matrix.configuration }} ${{ matrix.os }} - shell: pwsh - if: runner.os == 'macOS' - run: | - .\RunSample.ps1 -sampleName "HelloXCode" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: NetCore/DotNetCoreFrameworkHelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2022' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "NetCore-DotNetCoreFrameworkHelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: NetCore/DotNetFrameworkHelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "NetCore-DotNetFrameworkHelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: NetCore/DotNetFrameworkHelloWorld_OldFrameworks ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2019' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "NetCore-DotNetFrameworkHelloWorld_OldFrameworks" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: NetCore/DotNetMultiFrameworksHelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "NetCore-DotNetMultiFrameworksHelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: NetCore/DotNetOSMultiFrameworksHelloWorld ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.os == 'windows-2022' - run: | - .\RunSample.ps1 -sampleName "NetCore-DotNetOSMultiFrameworksHelloWorld" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: PackageReferences ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "PackageReferences" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: Install Qt - if: runner.os == 'Windows' - uses: jurplel/install-qt-action@v3.2.1 - - - name: QTFileCustomBuild ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' - shell: pwsh - run: | # TODO: there's a retail config, compile it as well or remove it - .\RunSample.ps1 -sampleName "QTFileCustomBuild" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: SimpleExeLibDependency ${{ matrix.configuration }} ${{ matrix.os }} - if: runner.os == 'Windows' && matrix.configuration == 'debug' - shell: pwsh - run: | - .\RunSample.ps1 -sampleName "SimpleExeLibDependency" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} - - - name: vcpkg ${{matrix.configuration}} ${{ matrix.os }} - if: runner.os == 'Windows' + - name: Run sample ${{ matrix.name }} ${{ matrix.os }} ${{ matrix.framework }} ${{ matrix.configuration }} shell: pwsh run: | - .\RunSample.ps1 -sampleName "vcpkg" -configuration ${{ matrix.configuration }} -framework ${{ matrix.framework }} -os ${{ matrix.os }} -vsVersionSuffix ${env:VS_VERSION_SUFFIX} + foreach ($configuration in '${{ matrix.configurations }}'.Split(',')) + { + .\RunSample.ps1 -sampleName "${{ matrix.name }}" -configuration $configuration -framework ${{ matrix.framework }} -os ${{ matrix.os }} -vsVersionSuffix ${env:VS_VERSION_SUFFIX} + } - name: Store MSBuild binary logs if: ${{ failure() && runner.os == 'Windows' }} uses: actions/upload-artifact@v3 with: - name: sharpmake-samples-msbuild-logs-${{ matrix.framework }}-${{ runner.os }}-${{ github.sha }}-${{ matrix.configuration }} + name: sharpmake-sample-msbuild-logs-${{ matrix.name }}-${{ matrix.framework }}-${{ runner.os }}-${{ github.sha }}-${{ matrix.configuration }} path: samples/**/*.binlog diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 0b9189fb2..c89da40a3 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -114,8 +114,29 @@ functional_test: HelloLinux: extends: .linux_sample_test script: - - docker build -f samples/HelloLinux/Dockerfile -t sharpmake-hellolinux --build-arg CONFIGURATION=$configuration --build-arg FRAMEWORK=$framework . - - docker run --rm sharpmake-hellolinux + # Install Powershell on Alpine (https://learn.microsoft.com/en-us/powershell/scripting/install/install-alpine?view=powershell-7.2) + - apk add --no-cache + ca-certificates + less + ncurses-terminfo-base + krb5-libs + libgcc + libintl + libssl1.1 + libstdc++ + tzdata + userspace-rcu + zlib + icu-libs + curl + - apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache lttng-ust + - curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/powershell-7.2.11-linux-alpine-x64.tar.gz -o /tmp/powershell.tar.gz + - mkdir -p /opt/microsoft/powershell/7 + - tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 + - chmod +x /opt/microsoft/powershell/7/pwsh + - ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh + # Run HelloLinux sample + - pwsh ./RunSample.ps1 -sampleName HelloLinux -configuration $configuration ############# # MacOs Sample tests @@ -308,14 +329,8 @@ PackageReferences: QTFileCustomBuild: extends: .windows_sample_test - variables: - Qt_BaseDir: "$CI_PROJECT_DIR\\Qt" - Qt5_Dir: "$Qt_BaseDir\\5.15.2\\msvc2019_64" # Needed by sample to build Qt paths. before_script: - choco install python3 --version 3.10.6 --side-by-side -y --no-progress - - py -m pip install aqtinstall - - py -m aqt install-qt windows desktop 5.15.2 win64_msvc2019_64 --archives qtbase qttools --outputdir ${env:Qt_BaseDir} - - $Env:PATH = "${env:Qt5_Dir}\bin;" + $Env:PATH # Needed by sample executable to locate Qt DLLs. script: - pwsh RunSample.ps1 -sampleName "QTFileCustomBuild" -configuration $configuration -framework $framework -os $os diff --git a/RunSample.ps1 b/RunSample.ps1 index 42f456f11..46f61a648 100644 --- a/RunSample.ps1 +++ b/RunSample.ps1 @@ -27,6 +27,10 @@ param ([string] $sampleName, [string] $configuration, [string] $framework, [stri class SampleDef { [string] $Name + [string[]] $CIs + [string[]] $OSs + [string[]] $Frameworks + [string[]] $Configurations [string] $TestFolder = "" [string[]] $Commands } diff --git a/SamplesDef.json b/SamplesDef.json index 2e10483ab..4ec571651 100644 --- a/SamplesDef.json +++ b/SamplesDef.json @@ -3,6 +3,10 @@ [ { "Name": "CompileCommandDatabase", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug" ], "TestFolder": "samples/CompileCommandDatabase", "Commands": [ @@ -13,6 +17,10 @@ }, { "Name": "ConfigureOrder", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "release" ], "TestFolder": "samples/ConfigureOrder", "Commands": [ @@ -25,6 +33,10 @@ }, { "Name": "CPPCLI", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CPPCLI", "Commands": [ @@ -36,7 +48,11 @@ ] }, { - "Name": "CSharpHelloWorld_old_frameworks", + "Name": "CSharpHelloWorld_old_Frameworks", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CSharpHelloWorld", "Commands": [ @@ -47,6 +63,10 @@ }, { "Name": "CSharpHelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CSharpHelloWorld", "Commands": [ @@ -57,6 +77,10 @@ }, { "Name": "CSharpImports", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CSharpImports", "Commands": [ @@ -67,6 +91,10 @@ }, { "Name": "CSharpVsix", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CSharpVsix", "Commands": [ @@ -76,6 +104,10 @@ }, { "Name": "CustomBuildStep", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CustomBuildStep", "Commands": [ @@ -86,6 +118,10 @@ }, { "Name": "CSharpWCF", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/CSharpWCF", "Commands": [ @@ -95,6 +131,10 @@ }, { "Name": "FastBuildSimpleExecutable", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/FastBuildSimpleExecutable", "Commands": [ @@ -105,6 +145,10 @@ }, { "Name": "HelloAndroid", + "CIs": [], + "OSs": [ "windows-2019" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloAndroid", "Commands": [ @@ -115,6 +159,10 @@ }, { "Name": "HelloClangCl", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloClangCl", "Commands": [ @@ -131,6 +179,10 @@ }, { "Name": "HelloEvents", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloEvents", "Commands": [ @@ -143,6 +195,10 @@ }, { "Name": "HelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloWorld", "Commands": [ @@ -155,6 +211,10 @@ }, { "Name": "NetCore-DotNetCoreFrameworkHelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/NetCore/DotNetCoreFrameworkHelloWorld", "Commands": [ @@ -170,6 +230,10 @@ }, { "Name": "NetCore-DotNetFrameworkHelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/NetCore/DotNetFrameworkHelloWorld", "Commands": [ @@ -183,6 +247,10 @@ }, { "Name": "NetCore-DotNetFrameworkHelloWorld_OldFrameworks", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/NetCore/DotNetFrameworkHelloWorld", "Commands": [ @@ -193,6 +261,10 @@ }, { "Name": "NetCore-DotNetMultiFrameworksHelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/NetCore/DotNetMultiFrameworksHelloWorld", "Commands": [ @@ -204,6 +276,10 @@ }, { "Name": "NetCore-DotNetOSMultiFrameworksHelloWorld", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/NetCore/DotNetOSMultiFrameworksHelloWorld", "Commands": [ @@ -215,6 +291,10 @@ }, { "Name": "PackageReferences", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/PackageReferences", "Commands": [ @@ -231,9 +311,18 @@ }, { "Name": "QTFileCustomBuild", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/QTFileCustomBuild", "Commands": [ + "$qtBaseDir = \"$pwd\\Qt\"", + "$env:Qt5_Dir = \"$qtBaseDir\\5.15.2\\msvc2019_64\"", + "$env:PATH += \";$env:Qt5_Dir\\bin\"", + "py -m pip install aqtinstall==2.1.*", + "py -m aqt install-qt windows desktop 5.15.2 win64_msvc2019_64 --archives qtbase qttools --outputdir $qtBaseDir", "./RunSharpmake.ps1 -workingDirectory {testFolder} -sharpmakeFile \"QTFileCustomBuild.sharpmake.cs\" -framework {framework}", "./Compile.ps1 -slnOrPrjFile \"qtfilecustombuild_vs2017_win64.sln\" -configuration {configuration} -platform \"x64\" -WorkingDirectory \"{testFolder}/projects\" -VsVersion {os} -compiler MsBuild", "&'./{testFolder}/projects/output/win64/{configuration}/qtfilecustombuild.exe'" @@ -241,6 +330,10 @@ }, { "Name": "SimpleExeLibDependency", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug" ], "TestFolder": "samples/SimpleExeLibDependency", "Commands": [ @@ -251,6 +344,10 @@ }, { "Name": "vcpkg", + "CIs": [ "github", "gitlab" ], + "OSs": [ "windows-2019", "windows-2022" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/vcpkg", "Commands": [ @@ -262,19 +359,25 @@ "&'./{testFolder}/bin/{configuration}-fastbuild/vcpkgsample.exe'" ] }, - - - { "Name": "HelloLinux", + "CIs": [ "github", "gitlab" ], + "OSs": [ "linux" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloLinux", "Commands": [ - "./{testFolder}/codebase/temp/bin/linux_{configuration}/exe" + "docker build -f {testFolder}/Dockerfile -t sharpmake-hellolinux --build-arg CONFIGURATION={configuration} .", + "docker run --rm sharpmake-hellolinux" ] }, { "Name": "HelloXCode", + "CIs": [ "github", "gitlab" ], + "OSs": [ "macos" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/HelloXCode", "Commands": [ @@ -289,6 +392,10 @@ }, { "Name": "XCodeProjects", + "CIs": [ "github", "gitlab" ], + "OSs": [ "macos" ], + "Frameworks": [ "net6.0" ], + "Configurations": [ "debug", "release" ], "TestFolder": "samples/XCodeProjects", "Commands": [ diff --git a/samples/HelloLinux/Dockerfile b/samples/HelloLinux/Dockerfile index 2d69de8db..15a055dce 100644 --- a/samples/HelloLinux/Dockerfile +++ b/samples/HelloLinux/Dockerfile @@ -30,14 +30,12 @@ RUN make -f HelloLinux_linux_make.make config=$CONFIGURATION # Last stage is the container app that will executed. # Its based on PowerShell image and contains binaries and scripts required to execute HelloLinux sample. -FROM mcr.microsoft.com/powershell:lts-7.2-debian-11 +FROM debian:bullseye -COPY RunSample.ps1 SamplesDef.json ./ COPY --from=compiler-env samples/HelloLinux samples/HelloLinux ARG CONFIGURATION=release -ARG FRAMEWORK=net6.0 # Running the resulting container app execute the sample. -ENV RUN_SAMPLE_CMD="pwsh ./RunSample.ps1 -sampleName HelloLinux -configuration $CONFIGURATION -framework $FRAMEWORK" +ENV RUN_SAMPLE_CMD="./samples/HelloLinux/codebase/temp/bin/linux_$CONFIGURATION/exe" CMD $RUN_SAMPLE_CMD