9.21.0 RC2 #2070
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
- release9x | |
tags: | |
- v* | |
pull_request: | |
env: | |
#OPENTAP_COLOR: auto # github messes with the "auto" detection (i.e. it has no effect), and "always" breaks a lot of things | |
OPENTAP_ANSI_COLORS: true | |
OPENTAP_NO_UPDATE_CHECK: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_CONSOLE_ANSI_COLOR: true | |
jobs: | |
GetVersion: | |
runs-on: ubuntu-20.04 | |
outputs: | |
ShortVersion: ${{ steps.gitversion.outputs.ShortVersion }} | |
LongVersion: ${{ steps.gitversion.outputs.LongVersion }} | |
GitVersion: ${{ steps.gitversion.outputs.GitVersion }} | |
steps: | |
# The get-gitversion action installs OpenTAP and fetches with fetch-depth: 0 | |
- name: GitVersion | |
id: gitversion | |
uses: opentap/get-gitversion@v1.0 | |
CheckSecrets: | |
runs-on: ubuntu-latest | |
environment: sign | |
outputs: | |
gitlab_registry_token_is_set: ${{ steps.check_GITLAB_REGISTRY_TOKEN.outputs.is_set }} | |
sign_is_set: ${{ steps.check_sign.outputs.is_set }} | |
steps: | |
- id: check_GITLAB_REGISTRY_TOKEN | |
name: Check whether GITLAB_REGISTRY_TOKEN is set | |
run: | | |
if [ -z "${{ secrets.GITLAB_REGISTRY_TOKEN }}" ]; then | |
echo "Not set" | |
echo "::set-output name=is_set::false" | |
else | |
echo "Set" | |
echo "::set-output name=is_set::true" | |
fi | |
- id: check_sign | |
name: Check whether sign secrets are set | |
run: | | |
if [ -z "${{ secrets.SIGN_SERVER_CERT }}" -o \ | |
-z "${{ secrets.TAP_SIGN_ADDRESS }}" -o \ | |
-z "${{ secrets.TAP_SIGN_AUTH }}" -o \ | |
-z "${{ secrets.S3_KEY_ID }}" -o \ | |
-z "${{ secrets.S3_SECRET }}" ]; then | |
echo "Not set" | |
echo "::set-output name=is_set::false" | |
else | |
echo "Set" | |
echo "::set-output name=is_set::true" | |
fi | |
############## | |
### BUILDS ### | |
############## | |
Build-DevGuide: | |
needs: CheckSecrets | |
if: needs.CheckSecrets.outputs.gitlab_registry_token_is_set == 'true' | |
runs-on: ubuntu-latest | |
container: | |
image: registry.gitlab.com/opentap/buildrunners/documentationgeneration:latest | |
credentials: | |
username: github | |
password: ${{ secrets.GITLAB_REGISTRY_TOKEN}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- run: tap generate-pdf "doc/Developer Guide/Readme.md" --toc --skip-first-file --out "sdk/Examples/OpenTAP Developer Guide.pdf" --frontpage "doc/Developer Guide/Frontpage.html" --frontpage-file "doc/Developer Guide/Frontpage.png" | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: doc-devguide | |
retention-days: 5 | |
path: | | |
sdk/Examples/OpenTAP Developer Guide.pdf | |
Build-ApiDoc: | |
needs: CheckSecrets | |
if: needs.CheckSecrets.outputs.gitlab_registry_token_is_set == 'true' | |
runs-on: ubuntu-latest | |
container: | |
image: registry.gitlab.com/opentap/buildrunners/doxygen:alpine | |
credentials: | |
username: github | |
password: ${{ secrets.GITLAB_REGISTRY_TOKEN}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- run: | | |
mkdir Help API | |
ver=$(grep ^version .gitversion | sed 's/version[ ]*=[ ]*//' | cut -d. -f 1-2) | |
sed -i "s/\$(GitVersion)/$ver/" "doc/API Documentation/Doxyfile" | |
rootdir=`pwd` | |
cd "doc/API Documentation" | |
doxygen Doxyfile | |
cd apiref/html | |
chmcmd index.hhp | |
mv OpenTapApiReference.chm $rootdir/Help/ | |
cp -r . $rootdir/API/ | |
- name: Upload binaries (CHM) | |
uses: actions/upload-artifact@v2 | |
with: | |
name: doc-api-chm | |
retention-days: 5 | |
path: Help/OpenTapApiReference.chm | |
- name: Upload binaries (HTML) | |
uses: actions/upload-artifact@v2 | |
with: | |
name: doc-api-html | |
retention-days: 5 | |
path: API | |
Build-Pages: | |
runs-on: ubuntu-latest | |
needs: | |
- Build-ApiDoc | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare | |
run: rm 'doc/User Guide/Readme.md' 'doc/Developer Guide/Readme.md' | |
- name: Download API Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-api-html | |
path: API | |
- name: Pages Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- uses: actions/setup-node@v3 | |
name: Setup NPM | |
with: | |
node-version: 14 | |
- name: Install | |
run: npm install | |
working-directory: doc | |
- name: Build | |
run: npm run build | |
working-directory: doc | |
- name: Copy API | |
run: cp -r API public/api | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
publish_dir: public | |
deploy_key: ${{ secrets.PAGES_DEPLOY_TOKEN }} | |
publish_branch: main | |
external_repository: opentap/opentap.github.io | |
Build-Linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Build | |
run: dotnet publish -c Release OpenTAP.sln | |
- name: Copy Debug Package | |
run: cp ./bin/Release/OpenTap.Debug.TapPackage ./bin/Release/publish/dbg.zip | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: linux-x64-bin | |
retention-days: 5 | |
path: | | |
bin/Release/publish/* | |
Build-Win: | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
Architecture: [x86, x64] | |
needs: GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Nuget Cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Stamp Version | |
run: | | |
$AssemblyVersion = "`"${{needs.GetVersion.outputs.ShortVersion}}.0`"" | |
$AssemblyFileVersion = "`"${{needs.GetVersion.outputs.ShortVersion}}`"" | |
$GitVersion = "`"${{needs.GetVersion.outputs.GitVersion}}`"" | |
Push-Location ./tap/Properties | |
$AssemblyInfoFile = (Get-Content AssemblyInfo.cs.Template) | |
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyVersion"', $AssemblyVersion | |
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyFileVersion"', $AssemblyFileVersion | |
$AssemblyInfoFile = ($AssemblyInfoFile) -replace '"AssemblyInformationalVersion"', $GitVersion | |
$AssemblyInfoFile | Set-Content AssemblyInfo.cs | |
cat AssemblyInfo.cs | |
Pop-Location | |
- name: Restore | |
#if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
dotnet restore /p:Platform=${{ matrix.Architecture }} | |
- name: Build | |
run: | | |
dotnet build --no-restore -c Release /p:Platform=${{ matrix.Architecture }} | |
dotnet build --no-restore tap/tap.csproj -c Release /p:Platform=${{ matrix.Architecture }} | |
get-content ./bin/Release/tap.runtimeconfig.json | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: win-${{ matrix.Architecture }}-bin | |
retention-days: 5 | |
path: | | |
bin/Release/* | |
Build-MacOS: | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Build | |
run: dotnet publish -c Release OpenTAP.sln | |
- name: Copy Debug Package | |
run: cp ./bin/Release/OpenTap.Debug.TapPackage ./bin/Release/publish/dbg.zip | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macos-bin | |
retention-days: 5 | |
path: | | |
bin/Release/publish/* | |
############## | |
### TESTS ### | |
############## | |
TestEngine: | |
runs-on: windows-2022 | |
needs: Build-Win | |
strategy: | |
matrix: | |
retries: [ 0, 1 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/ | |
- name: Test | |
run: | | |
$ErrorActionPreference = "Stop" | |
dotnet vstest bin/OpenTap.UnitTests.dll --logger:"console;verbosity=detailed" -- RunConfiguration.TestSessionTimeout=1200000 RunConfiguration.TreatNoTestsAsError=true | |
TestPackage: | |
runs-on: windows-2022 | |
needs: Build-Win | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release | |
- name: Test | |
run: | | |
$ErrorActionPreference = "Stop" | |
#Copy-Item .\bin\Release\runtimes\win-x64\native\git2-b7bad55.dll .\bin\Release | |
cd bin/Release | |
dotnet vstest /framework:.NETFramework,Version=v4.62 /Platform:x64 OpenTap.Package.UnitTests.dll --logger:"console;verbosity=detailed" -- RunConfiguration.TreatNoTestsAsError=true | |
TestWindowsPlan: | |
runs-on: windows-2022 | |
needs: Build-Win | |
strategy: | |
matrix: | |
retries: [ 0, 1 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release/ | |
- name: Test | |
run: | | |
cd bin/Release | |
./tap.exe run ../../tests/regression.TapPlan --verbose --color | |
- uses: actions/upload-artifact@v2 | |
if: ${{ failure() }} | |
with: | |
name: regression-files | |
path: | | |
NewProj*/** | |
TestLinuxPlan: | |
runs-on: ubuntu-20.04 | |
needs: Build-Linux | |
strategy: | |
matrix: | |
retries: [ 0, 1 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-bin | |
path: bin/Release/ | |
- name: Test | |
run: | | |
chmod +x bin/Release/tap | |
# The .pdb files are in use for some reason during `tap package install` | |
rm ./bin/Release/*.pdb | |
./bin/Release/tap package install ./bin/Release/dbg.zip -f --no-isolation | |
./bin/Release/tap run tests/regression.TapPlan --verbose --color | |
TestMacPlan: | |
runs-on: macos-11 | |
needs: Build-MacOS | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: macos-bin | |
path: bin/Release/ | |
- name: Test | |
run: | | |
chmod +x bin/Release/tap | |
./bin/Release/tap package install ./bin/Release/dbg.zip -f | |
bin/Release/tap run tests/regression.TapPlan --verbose --color | |
############### | |
### Package ### | |
############### | |
Package-Win: | |
if: needs.CheckSecrets.outputs.sign_is_set == 'true' | |
runs-on: windows-2022 | |
environment: sign | |
strategy: | |
matrix: | |
Architecture: [x86, x64] | |
needs: | |
- CheckSecrets | |
- Build-Win | |
- Build-ApiDoc | |
- GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download x64 binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release-x64/ | |
- name: Download x86 binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x86-bin | |
path: bin/Release-x86/ | |
- name: Download API Reference | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-api-chm | |
path: Help/ | |
- name: Caching Signing tools | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ./sign.TapPackage | |
key: ${{ runner.os }}-signpackage-1.3.0 }} | |
- name: Copy Signing tools | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: aws s3 cp s3://ks-github-runner-tools/sign.1.3.0.TapPackage ./sign.TapPackage --region eu-central-1 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET }} | |
- name: Install Sign | |
working-directory: bin/Release-x64 | |
run: .\tap.exe package install -f -v --no-isolation ../../sign.TapPackage | |
- name: Write Sign Cert | |
env: | |
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer | |
run: echo "${{ secrets.SIGN_SERVER_CERT }}" > $env:TAP_SIGN_CERT | |
- name: Create Package | |
working-directory: bin/Release-${{ matrix.Architecture }} | |
env: | |
TAP_SIGN_ADDRESS: ${{ secrets.TAP_SIGN_ADDRESS }} | |
TAP_SIGN_AUTH: ${{ secrets.TAP_SIGN_AUTH }} | |
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer | |
Sign: ${{github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')}} | |
Platform: "Windows" | |
Architecture: "${{ matrix.Architecture }}" | |
run: ..\Release-x64\tap.exe package create -v -c ../../package.xml -o ../../OpenTAP.${{ needs.GetVersion.outputs.GitVersion }}.${{ matrix.Architecture }}.Windows.TapPackage | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: win-${{ matrix.Architecture }}-package | |
retention-days: 14 | |
path: | | |
OpenTAP.*.Windows.TapPackage | |
Package-Linux: | |
if: needs.CheckSecrets.outputs.sign_is_set == 'true' | |
runs-on: windows-2022 | |
environment: sign | |
needs: | |
- CheckSecrets | |
- Build-Win | |
- Build-Linux | |
- Build-ApiDoc | |
- GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download x64 binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release/ | |
- name: Download linux binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-bin | |
path: bin/linux-x64/ | |
- name: Download API Reference | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-api-chm | |
path: Help/ | |
- name: Caching Signing tools | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ./sign.TapPackage | |
key: ${{ runner.os }}-signpackage-1.3.0 }} | |
- name: Copy Signing tools | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: aws s3 cp s3://ks-github-runner-tools/sign.1.3.0.TapPackage ./sign.TapPackage --region eu-central-1 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET }} | |
- name: Install Sign Package | |
working-directory: bin\linux-x64\ | |
run: ../Release/tap package install -f "../../Sign.TapPackage" | |
- name: Package | |
working-directory: bin\linux-x64\ | |
run: | | |
../Release/tap package install -f "../../Sign.TapPackage" | |
echo "${{ secrets.SIGN_SERVER_CERT }}" > $env:TAP_SIGN_CERT | |
cp .\runtimes\win-x64\native\git2-b7bad55.dll . | |
# Manually copy the correct newtonsoft dll here since it was overwritten by a unittest | |
cp ../../Installer/Assets/Newtonsoft.Json.dll . | |
..\Release\tap package create -v -c ../../package.xml -o Packages/OpenTAP.Linux.TapPackage | |
cp Packages/OpenTAP.Linux.TapPackage ../../OpenTAP.${{ needs.GetVersion.outputs.GitVersion }}.Linux.TapPackage | |
env: | |
Platform: Linux,MacOS | |
Architecture: x64 | |
TAP_SIGN_ADDRESS: ${{ secrets.TAP_SIGN_ADDRESS }} | |
TAP_SIGN_AUTH: ${{ secrets.TAP_SIGN_AUTH }} | |
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer | |
Sign: ${{github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v')}} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: linux-x64-package | |
retention-days: 14 | |
path: | | |
OpenTAP.*.Linux.TapPackage | |
Package-Templates: | |
runs-on: windows-2022 | |
needs: | |
- GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Update Version | |
run: | | |
Set-Content .\templates\Templates.csproj (Get-Content .\templates\Templates.csproj).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}") | |
Set-Content .\templates\src\project\ProjectName.csproj (Get-Content .\templates\src\project\ProjectName.csproj).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}") | |
- name: Package | |
run: dotnet pack ./templates/ | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: package-templates | |
retention-days: 14 | |
path: ./bin/Release/OpenTAP.Templates.*.nupkg | |
Package-SDK: | |
runs-on: windows-2022 | |
needs: | |
- Build-Win | |
- Build-DevGuide | |
- Build-ApiDoc | |
- GetVersion | |
- Package-Templates | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release/ | |
- name: Download Developer Guide | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-devguide | |
path: sdk/Examples/ | |
- name: Download API Reference | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-api-chm | |
path: Help/ | |
- name: Download Template package | |
uses: actions/download-artifact@v2 | |
with: | |
name: package-templates | |
path: bin/Release/Packages2/SDK/ | |
- name: Package | |
run: | | |
$env:Sign = "false" | |
$env:Architecture = "x86" | |
$env:Platform = "Windows" | |
cd bin/Release | |
Remove-Item -Recurse -Force ./Packages | |
#cp .\runtimes\win-x64\native\git2-b7bad55.dll . | |
.\tap.exe package create ../../package.xml --install -v -c | |
Copy-Item "../../sdk/Examples" "Packages/SDK/Examples" -Recurse | |
Copy-Item "../../Package/PackageSchema.xsd" "Packages/SDK/PackageSchema.xsd" | |
cd Packages/SDK/Examples | |
$doc = New-Object System.Xml.XmlDataDocument | |
$doc.PreserveWhitespace=1 | |
$doc.Load("$pwd/Directory.Build.props") | |
$ele = $doc.GetElementsByTagName("PropertyGroup") | Where-Object { $_.GetElementsByTagName("GitVersion").Count -gt 0 } | |
$doc.FirstChild.RemoveChild($ele) # First Child is the Project element | |
$doc.Save("$pwd/Directory.Build.props") | |
cd ../../.. | |
Move-Item "Packages2/SDK/OpenTap.Templates.*.nupkg" "Packages/SDK/" | |
$content=(Get-Content Packages/SDK/Examples/Directory.Build.props).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}") | |
Set-Content Packages/SDK/Examples/Directory.Build.props $content | |
./tap package create -v -c ../../sdk/sdk.package.xml | |
Move-Item "*.TapPackage" "../.." | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: package-sdk | |
retention-days: 14 | |
path: | | |
SDK.*.TapPackage | |
Package-Diff: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
Package: [win-x64, linux-x64] | |
needs: | |
- Package-Win | |
- Package-Linux | |
steps: | |
- name: Download package | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ matrix.Package }}-package | |
path: . | |
- name: Install OpenTAP | |
run: | | |
cd $RUNNER_TEMP | |
wget -O opentap.tar https://www.opentap.io/docs/OpenTAP.9.16.2+f3c96b9f.tar | |
tar -xf opentap.tar | |
chmod u+x INSTALL.sh | |
echo 'y' | ./INSTALL.sh | |
ln -s -f "$HOME/.tap/tap" /usr/local/bin/tap | |
cd - | |
- name: Diff Package | |
run: | | |
mv OpenTAP.*.TapPackage OpenTAP.TapPackage | |
tap package install "Package Diff" --version 0.1.0-beta.19+2b1aa952 | |
tap package diff OpenTAP.TapPackage -o diff | |
Package-NuGet: | |
runs-on: windows-2022 | |
needs: | |
- Build-Win | |
- Package-Win | |
- Package-Linux | |
- GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-bin | |
path: bin/Release/ | |
- name: Download x86 package | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x86-package | |
path: . | |
- name: Download x64 package | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-package | |
path: . | |
- name: Download Linux package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: . | |
- name: Package | |
run: | | |
#cp bin\Release\runtimes\win-x64\native\git2-b7bad55.dll bin\Release | |
$content=(Get-Content ./nuget/OpenTAP.nuspec).Replace("`$(GitVersion)", "${{needs.GetVersion.outputs.LongVersion}}") | |
Set-Content ./nuget/OpenTAP.nuspec $content | |
New-Item -Force ./nuget/build/payload -ItemType Directory | Out-Null | |
# Expand-Archive will only extract .zip extensions | |
Move-Item OpenTAP.*.x86.Windows.TapPackage OpenTAP.x86.zip | |
Move-Item OpenTAP.*.x64.Windows.TapPackage OpenTAP.x64.zip | |
Move-Item OpenTAP.*.Linux.TapPackage OpenTAP.Linux.zip | |
Move-Item ./bin/Release/Keysight.OpenTap.Sdk.MSBuild.dll ./nuget/build | |
Move-Item ./bin/Release/DotNet.Glob.NetStandard1.1.dll ./nuget/build/DotNet.Glob.dll | |
echo "Install opentap" | |
./bin/Release/tap package install ./OpenTap.x64.zip -t ./nuget/build/payload -f -v --no-isolation | |
# package.xml, tap.dll, and tap.runtimeconfig.json of an installation should always come from | |
# one of the Runtime directories. Delete it from the payload directory. | |
Remove-Item ./nuget/build/payload/Packages/OpenTAP/package.xml | |
# these files only exists when building for net6.0. | |
#Remove-Item ./nuget/build/payload/tap.dll | |
#Remove-Item ./nuget/build/payload/tap.runtimeconfig.json | |
Move-Item ./bin/Release/OpenTap.Package.xml ./nuget/build/payload | |
Move-Item ./bin/Release/OpenTap.xml ./nuget/build/payload | |
Push-Location ./nuget/build/payload | |
Remove-Item tap.exe | |
Remove-Item ./Dependencies/LibGit2Sharp.0.27.0.0/git2*.dll | |
Pop-Location | |
echo "Expand archive" | |
Expand-Archive OpenTAP.x64.zip win-x64 -Verbose | |
Expand-Archive OpenTAP.x86.zip win-x86 -Verbose | |
Expand-Archive OpenTAP.Linux.zip linux-x64 -Verbose | |
./nuget/NugetPackager.ps1 | |
cd ./nuget | |
Invoke-WebRequest -Method Get -Uri "https://dist.nuget.org/win-x86-commandline/v5.7.1/nuget.exe" -OutFile nuget.exe | |
echo "Pack nuget" | |
.\nuget pack OpenTAP.nuspec -OutputDirectory ../ | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: nuget-package | |
retention-days: 14 | |
path: | | |
*.nupkg | |
Installer-Linux: | |
runs-on: windows-2022 | |
needs: | |
- Package-Linux | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Download Linux package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: . | |
- name: Package | |
run: | | |
$path=(get-item -path "./").Fullname | |
$str=[IO.File]::ReadAllText($path + "/LinuxInstall/INSTALL.sh") -replace "`r`n", "`n" | |
([IO.File]::WriteAllText($path + "/INSTALL.sh", $str)) | |
$str=[IO.File]::ReadAllText($path + "/LinuxInstall/README") -replace "`r`n", "`n" | |
([IO.File]::WriteAllText($path + "/README", $str)) | |
cmd /C '"C:\Windows\System32\tar.exe" -cf "OpenTAP.tar" OpenTAP.*.Linux.TapPackage INSTALL.sh README' | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: installer-linux | |
retention-days: 14 | |
path: OpenTAP.tar | |
Build-Installer-Windows: | |
runs-on: ubuntu-latest | |
environment: sign | |
needs: | |
- GetVersion | |
- Package-Win | |
container: | |
image: ghcr.io/opentap/smartinstaller:2.1.0-beta.5 | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download Windows package | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-package | |
path: . | |
- run: mv OpenTAP.*.Windows.TapPackage Installer/Assets/OpenTAP.TapPackage | |
- run: echo "${{ secrets.SIGN_SERVER_CERT }}" > $GITHUB_WORKSPACE/sign.cer | |
- run: tap installer create "opentap.installer.xml" -v --target-os win | |
working-directory: Installer/Assets | |
env: | |
TAP_SIGN_ADDRESS: ${{ secrets.TAP_SIGN_ADDRESS }} | |
TAP_SIGN_AUTH: ${{ secrets.TAP_SIGN_AUTH }} | |
TAP_SIGN_CERT: ${{ github.workspace }}/sign.cer | |
- run: mv Installer/Assets/setup.exe OpenTAP.${{needs.GetVersion.outputs.LongVersion}}.exe | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: installer-windows | |
retention-days: 14 | |
path: OpenTAP.*.exe | |
Publish-Installer-Windows: | |
if: contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
environment: packages.opentap.io | |
runs-on: ubuntu-latest | |
needs: | |
- Build-Installer-Windows | |
- GetVersion | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: installer-windows | |
- name: Rename Artifact | |
run: mv OpenTAP.*.exe OpenTAP.exe | |
- name: Upload Installer | |
env: | |
REPO_WWW_PASS: ${{ secrets.REPO_WWW_PASS }} | |
run: | | |
curl -i -X POST 'http://packages.opentap.io/4.0/Objects/www/' \ | |
-H 'Metadata-Version: "${{ needs.GetVersion.outputs.LongVersion }}"' \ | |
-H 'Metadata-OS: "Windows"' \ | |
-H "Auth-Key: $REPO_WWW_PASS" \ | |
--form 'file=@"'$(pwd)'/OpenTAP.exe"' | |
Build-Installer-Linux: | |
runs-on: ubuntu-latest | |
needs: | |
- GetVersion | |
- Package-Linux | |
container: | |
image: ghcr.io/opentap/smartinstaller:2.1.0-beta.5 | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download Linux package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: . | |
- run: mv OpenTAP.*.Linux.TapPackage Installer/Assets/OpenTAP.TapPackage | |
name: Rename package | |
- run: tap installer create "opentap.installer.linux.xml" -v --target-os linux | |
working-directory: Installer/Assets | |
name: Build installer | |
- run: mv Installer/Assets/Installer Installer/Assets/OpenTAP | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: installer-linux | |
retention-days: 14 | |
path: Installer/Assets/OpenTAP | |
Publish-Installer-Linux: | |
if: contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
environment: packages.opentap.io | |
runs-on: ubuntu-latest | |
needs: | |
- Build-Installer-Linux | |
- GetVersion | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: installer-linux | |
- name: Upload Installer | |
env: | |
REPO_WWW_PASS: ${{ secrets.REPO_WWW_PASS }} | |
run: | | |
curl -i -X POST 'http://packages.opentap.io/4.0/Objects/www/' \ | |
-H 'Metadata-Version: "${{ needs.GetVersion.outputs.LongVersion }}"' \ | |
-H 'Metadata-OS: "Linux"' \ | |
-H "Auth-Key: $REPO_WWW_PASS" \ | |
--form 'file=@"'$(pwd)'/OpenTAP"' | |
Test-Installer-Linux: | |
runs-on: ubuntu-20.04 | |
needs: | |
- Installer-Linux | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Download Linux Installer | |
uses: actions/download-artifact@v2 | |
with: | |
name: installer-linux | |
- name: Install OpenTAP | |
run: | | |
tar xf OpenTAP.tar | |
chmod +x ./INSTALL.sh | |
echo 'y' | ./INSTALL.sh | |
- name: Test OpenTAP | |
run: | | |
$HOME/bin/tap -h | |
$HOME/bin/tap package list -v -c | |
Docker-Linux: | |
runs-on: ubuntu-20.04 | |
environment: sign | |
strategy: | |
matrix: | |
include: | |
- target: production | |
tag-suffix: "-slim" | |
- target: development | |
tag-suffix: "" | |
- target: production-hardened | |
tag-suffix: "-slim-hardened" | |
needs: | |
- Package-Linux | |
- GetVersion | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download Linux package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: . | |
- name: Prepare | |
run: | | |
mv OpenTAP.*.Linux.TapPackage docker/Linux/OpenTAP.Linux.TapPackage | |
echo "TAG_NAME=alpha" >> $GITHUB_ENV | |
- name: Set tag (beta) | |
if: github.ref == 'refs/heads/main' | |
run: echo "TAG_NAME=beta" >> $GITHUB_ENV | |
- name: Set tag (rc) | |
if: contains(github.ref, 'refs/heads/release') | |
run: echo "TAG_NAME=rc" >> $GITHUB_ENV | |
- name: Set tag (release) | |
if: contains(github.ref, 'refs/tags/v') | |
run: echo "TAG_NAME=${{needs.GetVersion.outputs.ShortVersion}}" >> $GITHUB_ENV | |
- name: Docker Build | |
uses: aevea/action-kaniko@master | |
with: | |
image: opentapio/opentap | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
target: ${{ matrix.target }} | |
tag: ${{env.TAG_NAME}}${{ matrix.tag-suffix }} | |
path: docker/Linux | |
Package-Deb: | |
runs-on: ubuntu-20.04 | |
needs: | |
- Package-Linux | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fix tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} # Fixes an issue with actions/checkout@v2. See https://github.com/actions/checkout/issues/290 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Download Linux package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: . | |
- name: Create Debian Package | |
run: | | |
cd LinuxInstall/package | |
mv ../../OpenTAP*.TapPackage OpenTAP.TapPackage | |
cd Debian | |
bash create-deb | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: package-deb | |
retention-days: 14 | |
path: LinuxInstall/package/opentap.deb | |
############### | |
### Publish ### | |
############### | |
Publish-NuGet: | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') | |
environment: nuget.org | |
runs-on: windows-2022 | |
needs: | |
- Package-NuGet | |
steps: | |
- name: Download nuget package | |
uses: actions/download-artifact@v2 | |
with: | |
name: nuget-package | |
path: . | |
- name: Package | |
run: nuget push OpenTAP.*.nupkg ${{ secrets.NUGET_KEY }} -NonInteractive -Source https://api.nuget.org/v3/index.json | |
Publish-TapPackages: | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') | |
environment: packages.opentap.io | |
runs-on: ubuntu-latest | |
needs: | |
- Package-Win | |
- Package-Linux | |
- Package-SDK | |
steps: | |
- name: Download Windows-x86 package | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x86-package | |
path: ./publish/ | |
- name: Download Windows-x64 package | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64-package | |
path: ./publish/ | |
- name: Download Linux-x64 package | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64-package | |
path: ./publish/ | |
- name: Download SDK package | |
uses: actions/download-artifact@v2 | |
with: | |
name: package-sdk | |
path: ./publish/ | |
- name: Install OpenTAP | |
run: | | |
wget -O opentap.tar https://www.opentap.io/docs/OpenTAP.9.16.2+f3c96b9f.tar | |
tar -xf opentap.tar | |
chmod u+x INSTALL.sh | |
echo 'y' | ./INSTALL.sh | |
ln -s -f "$HOME/.tap/tap" /usr/local/bin/tap | |
- name: Debug | |
run: ls -la ./publish | |
- name: Install PackagePublish | |
run: tap package install -f PackagePublish --version beta | |
- name: Publish | |
run: tap package publish -r http://packages.opentap.io -k ${{ secrets.REPO_PASS }} ./publish/*.TapPackage |