diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml index 6d2c9e1..38053d6 100644 --- a/.github/workflows/build-boost-packages.yml +++ b/.github/workflows/build-boost-packages.yml @@ -1,12 +1,11 @@ name: Generate Boost package on: - push: workflow_dispatch: inputs: VERSION: description: 'Boost version to build and upload' required: true - default: '1.15.0' + default: '1.73.0' PUBLISH_RELEASES: description: 'Whether to publish releases' required: true @@ -20,14 +19,31 @@ defaults: jobs: build_boost: - name: Build Boost ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}] - runs-on: ubuntu-latest + name: Build Boost ${{ github.event.inputs.VERSION }} [${{ matrix.os }}] + runs-on: ${{ matrix.os }} env: - ARTIFACT_NAME: Boost-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-x64 + ARTIFACT_NAME: boost-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-${{ matrix.toolset }}-${{ matrix.architecture }} strategy: fail-fast: false matrix: - platform: [linux, darwin, win32] + include: + - os: ubuntu-16.04 + architecture: x64 + toolset: gcc + platform: linux-16.04 + - os: ubuntu-18.04 + architecture: x64 + toolset: gcc + platform: linux-18.04 + - os: windows-2016 + architecture: x86_64 + toolset: msvc-14.1 + platform: win32 + - os: windows-2019 + architecture: x86_64 + toolset: msvc-14.2 + platform: win32 + steps: - uses: actions/checkout@v2 with: @@ -36,81 +52,94 @@ jobs: - name: Build Boost ${{ env.VERSION }} run: | ./builders/build-boost.ps1 -Version $env:VERSION ` - -Platform ${{ matrix.platform }} + -Platform ${{ matrix.platform }} ` + -Architecture ${{ matrix.architecture }} ` + -Toolset ${{ matrix.toolset }} - name: Publish artifact uses: actions/upload-artifact@v2 with: name: ${{ env.ARTIFACT_NAME }} path: ${{ runner.temp }}/artifact - # test_boost: - # name: Test Boost ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}] - # needs: build_boost - # runs-on: ${{ matrix.os }} - # env: - # ARTIFACT_NAME: boost-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-x64 - # strategy: - # fail-fast: false - # matrix: - # include: - # - os: ubuntu-latest - # platform: linux - # - os: macos-latest - # platform: darwin - # - os: windows-latest - # platform: win32 - # steps: - # - uses: actions/checkout@v2 - # with: - # submodules: true + test_boost: + name: Test Boost ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}] + needs: build_boost + runs-on: ${{ matrix.os }} + env: + PLATFORM: ${{ matrix.platform }} + ARTIFACT_NAME: boost-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-${{ matrix.toolset }}-${{ matrix.architecture }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-16.04 + platform: linux-16.04 + toolset: gcc + architecture: x64 + - os: ubuntu-18.04 + platform: linux-18.04 + toolset: gcc + architecture: x64 + - os: windows-2016 + platform: win32 + toolset: msvc-14.1 + architecture: x86_64 + - os: windows-2019 + platform: win32 + toolset: msvc-14.2 + architecture: x86_64 + steps: + - uses: actions/checkout@v2 + with: + submodules: true - # - name: Fully cleanup the toolcache directory before testing - # run: ./helpers/clean-toolcache.ps1 -ToolName "boost" + - name: Fully cleanup the toolcache directory before testing + run: ./helpers/clean-toolcache.ps1 -ToolName "boost" - # - name: Download artifact - # uses: actions/download-artifact@v2 - # with: - # path: ${{ runner.temp }} + - name: Download artifact + uses: actions/download-artifact@v2 + with: + path: ${{ runner.temp }} - # - name: Extract files - # run: | - # if ('${{ matrix.platform }}' -eq 'win32') { - # $artifactName = "${{ env.ARTIFACT_NAME }}.zip" - # 7z.exe x "$artifactName" -y | Out-Null - # } else { - # $artifactName = "${{ env.ARTIFACT_NAME }}.tar.gz" - # tar -xzf $artifactName - # } - # working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} + - name: Extract files + run: | + $artifactName = "${{ env.ARTIFACT_NAME }}.tar.gz" + tar -xzf $artifactName + working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} - # - name: Apply build artifact to the local machine - # run: | - # if ('${{ matrix.platform }}' -eq 'win32') { powershell ./setup.ps1 } else { sh ./setup.sh } - # working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} + - name: Apply build artifact to the local machine + run: | + if ('${{ matrix.platform }}' -eq 'win32') { powershell ./setup.ps1 } else { sh ./setup.sh } + working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} - # - name: Setup Boost ${{ env.VERSION }} - # uses: actions/setup-boost@v2.1.1 - # with: - # boost-version: ${{ env.VERSION }} + - name: Setup BOOST_ROOT ${{ github.event.inputs.VERSION }} + run: | + $targetPath = $env:AGENT_TOOLSDIRECTORY + if ([string]::IsNullOrEmpty($targetPath)) { + # GitHub Windows images don't have `AGENT_TOOLSDIRECTORY` variable + $targetPath = $env:RUNNER_TOOL_CACHE + } + $BoostToolcachePath = Join-Path -Path $targetPath -ChildPath "boost" + $BoostToolcacheVersionPath = Join-Path -Path $BoostToolcachePath -ChildPath "${{ github.event.inputs.VERSION }}" + $boostDirectory = Join-Path $BoostToolcacheVersionPath "${{ matrix.architecture }}" + $LD_LIBRARY = Join-Path -Path $boostDirectory -ChildPath "lib" + Write-Host "BOOST_ROOT = ${boostDirectory}" + echo "::set-env name=BOOST_ROOT::${boostDirectory}" + echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY}" - # - name: Wait for the logs - # run: | - # Write-Host "Fake step that do nothing" - # Write-Host "We need it because log of previous step 'Setup Boost' is not available here yet." - # Write-Host "In testing step (Boost.Tests.ps1) we analyze build log of 'Setup Boost' task" - # Write-Host "to determine if Boost.js version was consumed from cache and was downloaded" - # for ($i = 0; $i -lt 200; $i++) { Get-Random } - # - name: Run tests - # run: | - # Install-Module Pester -Force -Scope CurrentUser - # Import-Module Pester - # Invoke-Pester -Script ./Boost.Tests.ps1 -EnableExit - # working-directory: ./tests + - name: Run tests + run: | + Install-Module Pester -Force -Scope CurrentUser + Import-Module Pester + $Platform = If ("${{ matrix.platform }}" -eq "win32") { "Windows" } else { "Nix" } + Invoke-Pester -Script ./Common.Tests.ps1 -EnableExit + Invoke-Pester -Script "./${Platform}.Tests.ps1" -EnableExit + working-directory: ./tests publish_release: name: Publish release if: github.event.inputs.PUBLISH_RELEASES == 'true' - # needs: test_boost + needs: test_boost runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v2 diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml index a265ef1..74fe0b8 100644 --- a/.github/workflows/create-pr.yml +++ b/.github/workflows/create-pr.yml @@ -20,7 +20,7 @@ jobs: ./helpers/packages-generation/manifest-generator.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" ` -GitHubAccessToken "${{secrets.GITHUB_TOKEN}}" ` -OutputFile "./versions-manifest.json" ` - -ConfigurationFile "./config/go-manifest-config.json" + -ConfigurationFile "./config/boost-manifest-config.json" - name: Create GitHub PR run: | $formattedDate = Get-Date -Format "MM/dd/yyyy" diff --git a/builders/boost-builder.psm1 b/builders/boost-builder.psm1 index d9e94df..e6b5df5 100644 --- a/builders/boost-builder.psm1 +++ b/builders/boost-builder.psm1 @@ -16,13 +16,13 @@ class BoostBuilder { The architecture with which Boost should be built. .PARAMETER TempFolderLocation - The location of temporary files that will be used during Go package generation. + The location of temporary files that will be used during Boost package generation. .PARAMETER WorkFolderLocation The location of installation files. .PARAMETER ArtifactFolderLocation - The location of generated Go artifact. + The location of generated Boost artifact. .PARAMETER InstallationTemplatesLocation The location of installation script template. Using "installers" folder from current repository. diff --git a/tests/Nix.Tests.ps1 b/tests/Nix.Tests.ps1 index 0387a5e..1311098 100644 --- a/tests/Nix.Tests.ps1 +++ b/tests/Nix.Tests.ps1 @@ -1,18 +1,15 @@ -param ( - [Version] $Version, - [String] $Platform -) - Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1") -Set-Location "sources" -$env:Path="$env:Path;${env:BOOST_ROOT}\lib" +BeforeAll { + Set-Location "sources" + $env:Path="$env:Path;${env:BOOST_ROOT}\lib" + if (${env:PLATFORM} -eq "linux-16.04") { + Write-Host "Install dependencies" + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 ` + --slave /usr/bin/g++ g++ /usr/bin/g++-7 + sudo update-alternatives --config gcc +} -if ($Platform -eq "linux-16.04") { - Write-Host "Install dependencies" - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 ` - --slave /usr/bin/g++ g++ /usr/bin/g++-7 - sudo update-alternatives --config gcc } Describe "Nix Tests" { @@ -33,10 +30,10 @@ Describe "Nix Tests" { "-w", "-DBOOST_LOG_DYN_LINK", "-I", "${env:BOOST_ROOT}/include", "-L", "${env:BOOST_ROOT}/lib", "main_log.cpp", - "-l:libboost_log_setup-mt-d-x64.so.${Version}", - "-l:libboost_log-mt-d-x64.so.${Version}", - "-l:libboost_thread-mt-d-x64.so.${Version}", - "-l:libboost_filesystem-mt-d-x64.so.${Version}", + "-l:libboost_log_setup-mt-d-x64.so.${env:VERSION}", + "-l:libboost_log-mt-d-x64.so.${env:VERSION}", + "-l:libboost_thread-mt-d-x64.so.${env:VERSION}", + "-l:libboost_filesystem-mt-d-x64.so.${env:VERSION}", "-lpthread" ) @@ -49,10 +46,10 @@ Describe "Nix Tests" { "-w", "-DBOOST_LOG_DYN_LINK", "-I", "${env:BOOST_ROOT}/include", "-L", "${env:BOOST_ROOT}/lib", "main_log.cpp", - "-l:libboost_log_setup-mt-x64.so.${Version}", - "-l:libboost_log-mt-x64.so.${Version}", - "-l:libboost_thread-mt-x64.so.${Version}", - "-l:libboost_filesystem-mt-x64.so.${Version}", + "-l:libboost_log_setup-mt-x64.so.${env:VERSION}", + "-l:libboost_log-mt-x64.so.${env:VERSION}", + "-l:libboost_thread-mt-x64.so.${env:VERSION}", + "-l:libboost_filesystem-mt-x64.so.${env:VERSION}", "-lpthread" ) diff --git a/tests/Windows.Tests.ps1 b/tests/Windows.Tests.ps1 index a821868..72cdbce 100644 --- a/tests/Windows.Tests.ps1 +++ b/tests/Windows.Tests.ps1 @@ -1,17 +1,14 @@ -param ( - [Version] $Version, - [String] $Platform -) - Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1") Import-Module (Join-Path $PSScriptRoot "../helpers/win-vs-env.psm1") -Set-Location -Path "sources" +BeforeAll { + Set-Location -Path "sources" -$env:Path="$env:Path;${env:BOOST_ROOT}\lib" + $env:Path="$env:Path;${env:BOOST_ROOT}\lib" -Write-Host "Initialize VS dev environment" -Invoke-VSDevEnvironment + Write-Host "Initialize VS dev environment" + Invoke-VSDevEnvironment +} Describe "Windows Tests" { It "Run simple code" { @@ -24,7 +21,7 @@ Describe "Windows Tests" { "/EHsc", "/I", "${env:BOOST_ROOT}\include", "main-headers.cpp", - "/link", "/LIBPATH:${env:BOOST_ROOT}\lib", + "/link", "/LIBPATH:${env:BOOST_ROOT}\lib" "/OUT:main_static_lib_1.exe" ) "cl -nologo $buildArguments" | Should -ReturnZeroExitCode @@ -36,7 +33,7 @@ Describe "Windows Tests" { "/EHsc", "/MD", "/I", "${env:BOOST_ROOT}\include", "main-headers.cpp", - "/link", "/LIBPATH:${env:BOOST_ROOT}\lib", + "/link", "/LIBPATH:${env:BOOST_ROOT}\lib" "/OUT:main_dynamic_lib_1.exe" ) "cl -nologo $buildArguments" | Should -ReturnZeroExitCode @@ -48,7 +45,7 @@ Describe "Windows Tests" { "/EHsc", "/I", "${env:BOOST_ROOT}\include", "main_log.cpp", - "/link", "/LIBPATH:${env:BOOST_ROOT}\lib", + "/link", "/LIBPATH:${env:BOOST_ROOT}\lib" "/OUT:main_static_lib_2.exe" ) "cl -nologo $buildArguments" | Should -ReturnZeroExitCode @@ -60,7 +57,7 @@ Describe "Windows Tests" { "/EHsc", "/MD", "/I", "${env:BOOST_ROOT}\include", "main_log.cpp", - "/link", "/LIBPATH:${env:BOOST_ROOT}\lib", + "/link", "/LIBPATH:${env:BOOST_ROOT}\lib" "/OUT:main_dynamic_lib_2.exe" ) "cl -nologo $buildArguments" | Should -ReturnZeroExitCode