From 2647e8c5b7bd2494176358525089fbb8c9d630be Mon Sep 17 00:00:00 2001 From: Nikita Bykov <49442273+nikita-bykov@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:04:22 +0300 Subject: [PATCH 1/8] Test branch (#1) * migrate ci * updated submodule * update * update Co-authored-by: Nikita Bykov --- .github/workflows/build-boost-packages.yml | 160 +++++++++++++++++++++ .github/workflows/create-pr.yml | 33 +++++ builders/boost-builder.psm1 | 17 ++- helpers | 2 +- 4 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build-boost-packages.yml create mode 100644 .github/workflows/create-pr.yml diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml new file mode 100644 index 0000000..6d2c9e1 --- /dev/null +++ b/.github/workflows/build-boost-packages.yml @@ -0,0 +1,160 @@ +name: Generate Boost package +on: + push: + workflow_dispatch: + inputs: + VERSION: + description: 'Boost version to build and upload' + required: true + default: '1.15.0' + PUBLISH_RELEASES: + description: 'Whether to publish releases' + required: true + default: 'false' + +env: + VERSION: ${{ github.event.inputs.VERSION }} +defaults: + run: + shell: pwsh + +jobs: + build_boost: + name: Build Boost ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}] + runs-on: ubuntu-latest + env: + ARTIFACT_NAME: Boost-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-x64 + strategy: + fail-fast: false + matrix: + platform: [linux, darwin, win32] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Build Boost ${{ env.VERSION }} + run: | + ./builders/build-boost.ps1 -Version $env:VERSION ` + -Platform ${{ matrix.platform }} + - 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 + + # - 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: 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: 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: 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 + + publish_release: + name: Publish release + if: github.event.inputs.PUBLISH_RELEASES == 'true' + # needs: test_boost + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + + - name: Publish Release ${{ env.VERSION }} + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.VERSION }}-${{ github.run_id }} + release_name: ${{ env.VERSION }} + body: | + Boost ${{ env.VERSION }} + - name: Upload release assets + uses: actions/github-script@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + for (let artifactDir of fs.readdirSync('.')) { + let artifactName = fs.readdirSync(`${artifactDir}`)[0]; + console.log(`Upload ${artifactName} asset`); + github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: ${{ steps.create_release.outputs.id }}, + name: artifactName, + data: fs.readFileSync(`./${artifactDir}/${artifactName}`) + }); + } + trigger_pr: + name: Trigger "Create Pull Request" workflow + needs: publish_release + runs-on: ubuntu-latest + steps: + - name: Trigger "Create Pull Request" workflow + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.PERSONAL_TOKEN }} + script: | + github.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'create-pr.yml', + ref: 'main' + }); diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml new file mode 100644 index 0000000..a265ef1 --- /dev/null +++ b/.github/workflows/create-pr.yml @@ -0,0 +1,33 @@ +name: Create Pull Request +on: + workflow_dispatch: + +defaults: + run: + shell: pwsh + +jobs: + create_pr: + name: Create Pull Request + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Create versions-manifest.json + run: | + ./helpers/packages-generation/manifest-generator.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" ` + -GitHubAccessToken "${{secrets.GITHUB_TOKEN}}" ` + -OutputFile "./versions-manifest.json" ` + -ConfigurationFile "./config/go-manifest-config.json" + - name: Create GitHub PR + run: | + $formattedDate = Get-Date -Format "MM/dd/yyyy" + ./helpers/github/create-pull-request.ps1 ` + -RepositoryFullName "$env:GITHUB_REPOSITORY" ` + -AccessToken "${{secrets.GITHUB_TOKEN}}" ` + -BranchName "update-versions-manifest-file" ` + -CommitMessage "Update versions-manifest" ` + -PullRequestTitle "[versions-manifest] Update for release from ${formattedDate}" ` + -PullRequestBody "Update versions-manifest.json for release from ${formattedDate}" diff --git a/builders/boost-builder.psm1 b/builders/boost-builder.psm1 index c5be369..d9e94df 100644 --- a/builders/boost-builder.psm1 +++ b/builders/boost-builder.psm1 @@ -16,10 +16,13 @@ class BoostBuilder { The architecture with which Boost should be built. .PARAMETER TempFolderLocation - The location of temporary files that will be used during Boost package generation. Using system BUILD_STAGINGDIRECTORY variable value. + The location of temporary files that will be used during Go package generation. - .PARAMETER ArtifactLocation - The location of generated Boost artifact. Using system environment BUILD_BINARIESDIRECTORY variable value. + .PARAMETER WorkFolderLocation + The location of installation files. + + .PARAMETER ArtifactFolderLocation + The location of generated Go artifact. .PARAMETER InstallationTemplatesLocation The location of installation script template. Using "installers" folder from current repository. @@ -42,8 +45,8 @@ class BoostBuilder { $this.Toolset = $toolset $this.TempFolderLocation = [IO.Path]::GetTempPath() - $this.WorkFolderLocation = $env:BUILD_BINARIESDIRECTORY - $this.ArtifactFolderLocation = $env:BUILD_STAGINGDIRECTORY + $this.WorkFolderLocation = Join-Path $env:RUNNER_TEMP "binaries" + $this.ArtifactFolderLocation = Join-Path $env:RUNNER_TEMP "artifact" $this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers" } @@ -75,6 +78,10 @@ class BoostBuilder { Generates Boost artifact from downloaded binaries. #> + Write-Host "Create WorkFolderLocation and ArtifactFolderLocation folders" + New-Item -Path $this.WorkFolderLocation -ItemType "directory" + New-Item -Path $this.ArtifactFolderLocation -ItemType "directory" + Write-Host "Download Boost $($this.Version) source code..." $this.Download() diff --git a/helpers b/helpers index 68072be..f8f76ca 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit 68072bedefb41436c6b70ddfa9adb8e631a3b6cf +Subproject commit f8f76caff1878d249468db3d55f045c0b707493b From 5d5ff87b2818d4b127b3fb91362eac373911adf8 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Tue, 8 Sep 2020 11:19:30 +0300 Subject: [PATCH 2/8] checkout to helpers --- .gitmodules | 2 +- helpers | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 891db83..20cc120 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "helpers"] path = helpers url = https://github.com/actions/versions-package-tools - branch = main + branch = v-nibyko/test-branch diff --git a/helpers b/helpers index f8f76ca..e76cf52 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit f8f76caff1878d249468db3d55f045c0b707493b +Subproject commit e76cf52ff11970c14589bdfc337487703c9199bf From dc8da2cb3a85e84000a9e2fd3f43dc5976842d1e Mon Sep 17 00:00:00 2001 From: Nikita Bykov <49442273+nikita-bykov@users.noreply.github.com> Date: Tue, 8 Sep 2020 11:22:39 +0300 Subject: [PATCH 3/8] Test branch (#2) --- .github/workflows/build-boost-packages.yml | 159 ++++++++++++--------- .github/workflows/create-pr.yml | 2 +- builders/boost-builder.psm1 | 4 +- tests/Nix.Tests.ps1 | 37 +++-- tests/Windows.Tests.ps1 | 23 ++- 5 files changed, 124 insertions(+), 101 deletions(-) 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 From d23e94cfe337d467f3a20d8810ac512292598fb8 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Tue, 8 Sep 2020 17:13:02 +0300 Subject: [PATCH 4/8] resolved comments --- .github/workflows/build-boost-packages.yml | 2 ++ builders/boost-builder.psm1 | 4 ++-- helpers | 2 +- tests/Windows.Tests.ps1 | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml index 38053d6..c82fb7c 100644 --- a/.github/workflows/build-boost-packages.yml +++ b/.github/workflows/build-boost-packages.yml @@ -55,6 +55,7 @@ jobs: -Platform ${{ matrix.platform }} ` -Architecture ${{ matrix.architecture }} ` -Toolset ${{ matrix.toolset }} + - name: Publish artifact uses: actions/upload-artifact@v2 with: @@ -154,6 +155,7 @@ jobs: release_name: ${{ env.VERSION }} body: | Boost ${{ env.VERSION }} + - name: Upload release assets uses: actions/github-script@v2 with: diff --git a/builders/boost-builder.psm1 b/builders/boost-builder.psm1 index e6b5df5..0fa1248 100644 --- a/builders/boost-builder.psm1 +++ b/builders/boost-builder.psm1 @@ -79,8 +79,8 @@ class BoostBuilder { #> Write-Host "Create WorkFolderLocation and ArtifactFolderLocation folders" - New-Item -Path $this.WorkFolderLocation -ItemType "directory" - New-Item -Path $this.ArtifactFolderLocation -ItemType "directory" + New-Item -Path $this.WorkFolderLocation -ItemType "Directory" + New-Item -Path $this.ArtifactFolderLocation -ItemType "Directory" Write-Host "Download Boost $($this.Version) source code..." $this.Download() diff --git a/helpers b/helpers index e76cf52..9fd8fba 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit e76cf52ff11970c14589bdfc337487703c9199bf +Subproject commit 9fd8fba93dc1cf5320d8bdea79afa7d4057c4a6f diff --git a/tests/Windows.Tests.ps1 b/tests/Windows.Tests.ps1 index 72cdbce..5a43dde 100644 --- a/tests/Windows.Tests.ps1 +++ b/tests/Windows.Tests.ps1 @@ -21,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 @@ -33,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 @@ -45,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 @@ -57,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 From da7976ff2bf47dd04c4eaff03532c0ab9879f527 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Wed, 9 Sep 2020 13:41:24 +0300 Subject: [PATCH 5/8] fixed tests --- .github/workflows/build-boost-packages.yml | 20 ++++++++++---------- .gitmodules | 2 +- helpers | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml index c82fb7c..a0ca340 100644 --- a/.github/workflows/build-boost-packages.yml +++ b/.github/workflows/build-boost-packages.yml @@ -105,7 +105,13 @@ jobs: - name: Extract files run: | $artifactName = "${{ env.ARTIFACT_NAME }}.tar.gz" - tar -xzf $artifactName + If ("${{ matrix.platform }}" -eq "win32") { + $assetTarPath = $artifactName.TrimEnd(".tar.gz") + 7z x $artifactName -o"$assetTarPath" -y | Out-Null + 7z x $assetTarPath -y | Out-Null + } else { + tar -xzf $artifactName + } working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }} - name: Apply build artifact to the local machine @@ -115,14 +121,8 @@ jobs: - 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 }}" + Import-Module (Join-Path $env:GITHUB_WORKSPACE "helpers" | Join-Path -ChildPath "common-helpers.psm1") -DisableNameChecking + $boostDirectory = GetToolDirectory -ToolName "boost" -Version "${{ github.event.inputs.VERSION }}" -Architecture "${{ matrix.architecture }}" $LD_LIBRARY = Join-Path -Path $boostDirectory -ChildPath "lib" Write-Host "BOOST_ROOT = ${boostDirectory}" echo "::set-env name=BOOST_ROOT::${boostDirectory}" @@ -188,4 +188,4 @@ jobs: repo: context.repo.repo, workflow_id: 'create-pr.yml', ref: 'main' - }); + }); \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 20cc120..098d979 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "helpers"] path = helpers url = https://github.com/actions/versions-package-tools - branch = v-nibyko/test-branch + branch = v-nibyko/boost diff --git a/helpers b/helpers index 9fd8fba..eb3ed37 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit 9fd8fba93dc1cf5320d8bdea79afa7d4057c4a6f +Subproject commit eb3ed375cc2d6229b8cf00683dd9493f21cc2296 From 5a9313cf352ee9b71efb42ef720e5b3b792416dd Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Wed, 9 Sep 2020 15:10:24 +0300 Subject: [PATCH 6/8] checkout to main branch of helpers --- .gitmodules | 2 +- helpers | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 098d979..891db83 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "helpers"] path = helpers url = https://github.com/actions/versions-package-tools - branch = v-nibyko/boost + branch = main diff --git a/helpers b/helpers index eb3ed37..4b0fa42 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit eb3ed375cc2d6229b8cf00683dd9493f21cc2296 +Subproject commit 4b0fa42d9972d1f51dd26ca96e03987d374a1d7a From 88348dec1a1e7010fb6f1d4d67b6132c94ee5594 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Wed, 9 Sep 2020 15:37:46 +0300 Subject: [PATCH 7/8] fixed toolset names for windows --- .github/workflows/build-boost-packages.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml index a0ca340..1f90645 100644 --- a/.github/workflows/build-boost-packages.yml +++ b/.github/workflows/build-boost-packages.yml @@ -37,11 +37,11 @@ jobs: platform: linux-18.04 - os: windows-2016 architecture: x86_64 - toolset: msvc-14.1 + toolset: msvc14.1 platform: win32 - os: windows-2019 architecture: x86_64 - toolset: msvc-14.2 + toolset: msvc14.2 platform: win32 steps: @@ -83,11 +83,11 @@ jobs: architecture: x64 - os: windows-2016 platform: win32 - toolset: msvc-14.1 + toolset: msvc14.1 architecture: x86_64 - os: windows-2019 platform: win32 - toolset: msvc-14.2 + toolset: msvc14.2 architecture: x86_64 steps: - uses: actions/checkout@v2 From d76bf4df3d14559fbe942f60270ab87d412ec918 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Wed, 9 Sep 2020 17:13:55 +0300 Subject: [PATCH 8/8] removed azure-pipelines folder, updated docs, fixed build-boost-packages.yml --- .github/workflows/build-boost-packages.yml | 13 +-- CONTRIBUTING.md | 10 +-- azure-pipelines/build-boost-packages.yml | 95 ---------------------- azure-pipelines/templates/build-job.yml | 20 ----- azure-pipelines/templates/test-job.yml | 80 ------------------ 5 files changed, 11 insertions(+), 207 deletions(-) delete mode 100644 azure-pipelines/build-boost-packages.yml delete mode 100644 azure-pipelines/templates/build-job.yml delete mode 100644 azure-pipelines/templates/test-job.yml diff --git a/.github/workflows/build-boost-packages.yml b/.github/workflows/build-boost-packages.yml index 1f90645..68944df 100644 --- a/.github/workflows/build-boost-packages.yml +++ b/.github/workflows/build-boost-packages.yml @@ -37,11 +37,11 @@ jobs: platform: linux-18.04 - os: windows-2016 architecture: x86_64 - toolset: msvc14.1 + toolset: msvc-14.1 platform: win32 - os: windows-2019 architecture: x86_64 - toolset: msvc14.2 + toolset: msvc-14.2 platform: win32 steps: @@ -63,7 +63,7 @@ jobs: path: ${{ runner.temp }}/artifact test_boost: - name: Test Boost ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}] + name: Test Boost ${{ github.event.inputs.VERSION }} [${{ matrix.os }}] needs: build_boost runs-on: ${{ matrix.os }} env: @@ -83,11 +83,11 @@ jobs: architecture: x64 - os: windows-2016 platform: win32 - toolset: msvc14.1 + toolset: msvc-14.1 architecture: x86_64 - os: windows-2019 platform: win32 - toolset: msvc14.2 + toolset: msvc-14.2 architecture: x86_64 steps: - uses: actions/checkout@v2 @@ -104,7 +104,7 @@ jobs: - name: Extract files run: | - $artifactName = "${{ env.ARTIFACT_NAME }}.tar.gz" + $artifactName = Get-ChildItem -Name If ("${{ matrix.platform }}" -eq "win32") { $assetTarPath = $artifactName.TrimEnd(".tar.gz") 7z x $artifactName -o"$assetTarPath" -y | Out-Null @@ -173,6 +173,7 @@ jobs: data: fs.readFileSync(`./${artifactDir}/${artifactName}`) }); } + trigger_pr: name: Trigger "Create Pull Request" workflow needs: publish_release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8765977..37fca47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,22 +29,20 @@ Here are a few things you can do that will increase the likelihood of your pull ### Directory structure ``` -├── azure-pipelines/ -| └──templates/ +├── .github/ +| └──workflows/ ├── builders/ ├── helpers/ ├── installers/ └── tests/ └──sources/ ``` -- `azure-pipelines*` - contains global YAML definitions for build pipelines. Reusable templates for specific jobs are located in `templates` subfolder. +- `.github/workflows` - contains repository workflow files. - `builders` - contains Boost builder classes and functions. -- `helpers` - contains global helper functions and functions. +- `helpers` - contains global helper classes and functions. - `installers` - contains installation script templates. - `tests` - contains test scripts. Required tests sources are located in `sources` subfolder. -\* _We use Azure Pipelines because there are a few features that Actions is still missing, we'll move to Actions as soon as possible_. - ## Resources - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) diff --git a/azure-pipelines/build-boost-packages.yml b/azure-pipelines/build-boost-packages.yml deleted file mode 100644 index fb06ee1..0000000 --- a/azure-pipelines/build-boost-packages.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: $(date:yyyyMMdd)$(rev:.r)-Boost-$(VERSION) -trigger: none -pr: - autoCancel: true - branches: - include: - - main - paths: - exclude: - - versions-manifest.json - -stages: -- stage: Build_Boost_Ubuntu_1604 - dependsOn: [] - variables: - VmImage: ubuntu-16.04 - Platform: linux-16.04 - Architecture: x64 - Toolset: gcc - jobs: - - template: /azure-pipelines/templates/build-job.yml - -- stage: Test_Boost_Ubuntu_1604 - condition: succeeded() - dependsOn: Build_Boost_Ubuntu_1604 - variables: - VmImage: ubuntu-16.04 - Platform: linux-16.04 - Architecture: x64 - Toolset: gcc - jobs: - - template: /azure-pipelines/templates/test-job.yml - -- stage: Build_Boost_Ubuntu_1804 - dependsOn: [] - variables: - VmImage: 'ubuntu-18.04' - Platform: linux-18.04 - Architecture: x64 - Toolset: gcc - jobs: - - template: /azure-pipelines/templates/build-job.yml - -- stage: Test_Boost_Ubuntu_1804 - condition: succeeded() - dependsOn: Build_Boost_Ubuntu_1804 - variables: - VmImage: 'ubuntu-18.04' - Platform: linux-18.04 - Architecture: x64 - Toolset: gcc - jobs: - - template: /azure-pipelines/templates/test-job.yml - -- stage: Build_Boost_msvc141 - dependsOn: [] - variables: - VmImage: 'vs2017-win2016' - Platform: win32 - Architecture: x86_64 - Toolset: msvc-14.1 - jobs: - - template: /azure-pipelines/templates/build-job.yml - -- stage: Test_Boost_msvc141 - condition: succeeded() - dependsOn: Build_Boost_msvc141 - variables: - VmImage: 'vs2017-win2016' - Platform: win32 - Architecture: x86_64 - Toolset: msvc-14.1 - jobs: - - template: /azure-pipelines/templates/test-job.yml - -- stage: Build_Boost_msvc142 - dependsOn: [] - variables: - VmImage: 'windows-2019' - Platform: win32 - Architecture: x86_64 - Toolset: msvc-14.2 - jobs: - - template: /azure-pipelines/templates/build-job.yml - -- stage: Test_Boost_msvc142 - condition: succeeded() - dependsOn: Build_Boost_msvc142 - variables: - VmImage: 'windows-2019' - Platform: win32 - Architecture: x86_64 - Toolset: msvc-14.2 - jobs: - - template: /azure-pipelines/templates/test-job.yml \ No newline at end of file diff --git a/azure-pipelines/templates/build-job.yml b/azure-pipelines/templates/build-job.yml deleted file mode 100644 index 4de7c9b..0000000 --- a/azure-pipelines/templates/build-job.yml +++ /dev/null @@ -1,20 +0,0 @@ -jobs: -- job: Build_Boost - timeoutInMinutes: 300 - pool: - name: Azure Pipelines - vmImage: $(VmImage) - steps: - - checkout: self - - task: PowerShell@2 - displayName: 'Build Boost $(Version)' - inputs: - targetType: filePath - filePath: './builders/build-boost.ps1' - arguments: '-Version $(Version) -Platform $(Platform) -Architecture $(Architecture) -Toolset $(Toolset)' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish Artifact: Boost $(Version)' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - artifactName: 'boost-$(Version)-$(Platform)-$(Toolset)-$(Architecture)' \ No newline at end of file diff --git a/azure-pipelines/templates/test-job.yml b/azure-pipelines/templates/test-job.yml deleted file mode 100644 index 80073f1..0000000 --- a/azure-pipelines/templates/test-job.yml +++ /dev/null @@ -1,80 +0,0 @@ -jobs: -- job: Test_Boost - pool: - name: Azure Pipelines - vmImage: $(VmImage) - steps: - - checkout: self - submodules: true - - task: PowerShell@2 - displayName: Fully cleanup the toolcache directory before testing - inputs: - targetType: filePath - filePath: helpers/clean-toolcache.ps1 - arguments: -ToolName "boost" - - - task: DownloadPipelineArtifact@2 - inputs: - source: 'current' - artifact: 'boost-$(Version)-$(Platform)-$(Toolset)-$(Architecture)' - path: $(Build.ArtifactStagingDirectory) - - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/boost-$(Version)-$(Platform)-*-$(Architecture).*' - destinationFolder: $(Build.BinariesDirectory) - cleanDestinationFolder: false - - - task: PowerShell@2 - displayName: 'Apply build artifact to the local machines' - inputs: - targetType: inline - script: | - if ("$(Platform)" -match 'win32') { powershell ./setup.ps1 } else { sh ./setup.sh } - workingDirectory: '$(Build.BinariesDirectory)' - - - task: PowerShell@2 - displayName: 'Set up BOOST_ROOT' - inputs: - TargetType: inline - script: | - $BoostToolcachePath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "boost" - $BoostToolcacheVersionPath = Join-Path -Path $BoostToolcachePath -ChildPath "$(Version)" - $boostDirectory = Join-Path $BoostToolcacheVersionPath "$(Architecture)" - $LD_LIBRARY = Join-Path -Path $boostDirectory -ChildPath "lib" - Write-Host "BOOST_ROOT = ${boostDirectory}" - Write-Host "##vso[task.setvariable variable=BOOST_ROOT]${boostDirectory}" - Write-Host "##vso[task.setvariable variable=LD_LIBRARY_PATH]${LD_LIBRARY}" - - - task: PowerShell@2 - displayName: 'Run tests' - inputs: - TargetType: inline - script: | - Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1 - Import-Module Pester - $Platform = If ("$(Platform)" -eq "win32") { "Windows" } else { "Nix" } - $pesterParams = @( - @{ - Path="./Common.Tests.ps1"; - }, - @{ - Path="./${Platform}.Tests.ps1"; - Parameters=@{ - Version="$(Version)"; - Platform="$(Platform)" - } - } - ) - Invoke-Pester -Script $pesterParams -OutputFile "$(Build.SourcesDirectory)/tests/test_results.xml" -OutputFormat NUnitXml - workingDirectory: '$(Build.SourcesDirectory)/tests' - - - task: PublishTestResults@2 - displayName: 'Publish test results' - inputs: - testResultsFiles: '*.xml' - testResultsFormat: NUnit - searchFolder: 'tests' - failTaskOnFailedTests: true - testRunTitle: "Boost $(Version)-$(Platform)-$(Toolset)" - condition: always()