Skip to content

Commit

Permalink
Merge pull request #163 from siemens/defect/Pool_changes
Browse files Browse the repository at this point in the history
changes pool from self-hosted to github based runners
  • Loading branch information
prasenjeetnath authored May 31, 2024
2 parents ec8fafc + 6d8170f commit 0ee950b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 44 deletions.
104 changes: 61 additions & 43 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ on:
push:
pull_request:


jobs:

build:
runs-on: self-hosted
runs-on: windows-latest

defaults:
run:
Expand All @@ -17,7 +16,6 @@ jobs:
semver: ${{ steps.gitversion.outputs.semver }}
LicenseClearingTool: ${{ steps.packageBuildResults.outputs.LicenseClearingTool }}
nupkg-LicenseClearingTool: ${{ steps.createNupkg.outputs.nupkg-LicenseClearingTool }}
docker-LicenseClearingTool: ${{ steps.builddocker.outputs.docker-LicenseClearingTool }}

steps:
- name: Checkout
Expand All @@ -40,7 +38,7 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: TRUE

- name: get SemVer
if: ${{ false }} # disable for now
#if: ${{ false }} # disable for now
id: gitversion
run: |
echo "SemVer: v$($env:GitVersion_SemVer)"
Expand All @@ -51,19 +49,6 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/[email protected]


- name: update appSettingsSW360IntegrationTest.json
run: ./Scripts/json_update.ps1 -JsonFile 'src\TestUtilities\appSettingsSW360IntegrationTest.json'
env:
SW360HOST: ${{ secrets.SW360HOST }}
SW360APPPORT: ${{ secrets.SW360APPPORT }}
FOSSYHOST: ${{ secrets.FOSSYHOST }}
FOSSYAPPPORT: ${{ secrets.FOSSYAPPPORT }}
USEREMAIL: ${{ secrets.USEREMAIL }}
ARTIFACTORYAPIKEY: ${{ secrets.ARTIFACTORYAPIKEY }}
JFROGURL: ${{ secrets.JFROGURL }}
SW360AUTHKEY: ${{ secrets.SW360AUTHTOKEN }}

- name: update appsettingsUnitTest.json
run: ./Scripts/json_update_ut.ps1 -JsonFile 'src\UnitTestUtilities\appsettingsUnitTest.json'
Expand All @@ -78,16 +63,32 @@ jobs:
run: dotnet restore src\LicenseClearingTool.sln

- name: Build
run: msbuild -m -t:Rebuild -p:Configuration=Release -bl:continous-clearing.binlog -noconlog src\LicenseClearingTool.sln
run: |
dotnet build src\LicenseClearingTool.sln
Write-Host "Files in directory:"
dir $env:GITHUB_WORKSPACE\out\net6.0
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: buildoutput
path: ${{ github.workspace }}/out/net6.0

- name: Archive Build Log
uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
with:
name: Compile_Solution_log
path: |
src/*.binlog
*.binlog
$env:GITHUB_WORKSPACE/src/*.binlog
$env:GITHUB_WORKSPACE/*.binlog
- name: Archive Build Output
uses: actions/upload-artifact@v2
with:
name: continuous-clearing
path: |
out/continuous-clearing
- name: Create zip
id: packageBuildResults
Expand All @@ -102,23 +103,11 @@ jobs:
Write-Host "::set-output name=LicenseClearingTool::$($fileName)"
$outPath = Join-Path $outFolder $fileName
Compress-Archive -DestinationPath $outPath -Path $sourceFolder -CompressionLevel Optimal
- name: SW360 Instance refresh
#if: ${{ false }} # disable for now
run: |
docker exec -dt sw360confctnr1 service postgresql stop
docker stop sw360confctnr1
docker rm sw360confctnr1
docker run --name sw360confctnr1 --memory=7g -t -d -p ${env:SW360APPPORT}:8080 -p 5990:5984 -p 5440:5432 ${env:DOCKERDEVARTIFACTORY}/energy-dev/software-clearing/sw360/sw360conf:latest
Start-Sleep -s 200
env:
SW360APPPORT: ${{ secrets.SW360APPPORT }}
DOCKERDEVARTIFACTORY: ${{ secrets.DOCKERDEVARTIFACTORY }}
- name: Test
#if: ${{ false }} # disable for now
run: |
$TestProjects = Get-ChildItem -Path *test*.csproj -Recurse -exclude TestUtilities.csproj,UnitTestUtilities.csproj
$TestProjects = Get-ChildItem -Path *test*.csproj -Recurse -exclude TestUtilities.csproj,UnitTestUtilities.csproj,SW360IntegrationTest.csproj
Write-Host "**************************The test projects considered for execution: $TestProjects ******************************"
Write-Host "********************************************************************************************************************"
foreach ($Project in $TestProjects)
Expand All @@ -129,6 +118,7 @@ jobs:
dotnet test --no-build --configuration Release
}
- name: Archive Build Output
uses: actions/upload-artifact@v2
with:
Expand All @@ -149,28 +139,56 @@ jobs:
path: |
*.nupkg
build-docker:
runs-on: ubuntu-latest
needs: build

outputs:
docker-LicenseClearingTool: ${{ steps.builddocker.outputs.docker-LicenseClearingTool }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Build Output
uses: actions/download-artifact@v2
with:
name: buildoutput
path: ${{ github.workspace }}/buildoutput


- name: Build the Docker image
id: builddocker
#if: ${{ false }} # disable for now
run: |
echo "Files in directory:"
docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v6.2.0
docker save ${{ github.repository }}:continuous-clearing-v6.2.0 -o continuous-clearing-v6.2.0.tar
Write-Host "::set-output name=docker-LicenseClearingTool::continuous-clearing-v6.2.0.tar"
echo "::set-output name=docker-LicenseClearingTool::continuous-clearing-v6.2.0.tar"
- name: Archive docker image
#if: ${{ false }} # disable for now
uses: actions/upload-artifact@v2
with:
name: docker-continuous-clearing
path: |
*.tar

release:
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
needs: build
#if: github.ref == 'refs/heads/main'
runs-on: windows-latest
needs: [build, build-docker]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Build Output
uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -223,14 +241,14 @@ jobs:
asset_name: ${{ needs.build.outputs.nupkg-LicenseClearingTool }}
asset_content_type: application/zip

- name: Upload Nupkg
- name: Upload Docker
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.docker-LicenseClearingTool }}
asset_name: ${{ needs.build.outputs.docker-LicenseClearingTool }}
asset_path: ./${{ needs.build-docker.outputs.docker-LicenseClearingTool }}
asset_name: ${{ needs.build-docker.outputs.docker-LicenseClearingTool }}
asset_content_type: application/zip

- name: Upload ReadmeOSS_nupkg file
Expand All @@ -239,7 +257,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ReadmeOSS_continuous-clearing_nupkg.html
asset_path: ${{ github.workspace }}\ReadmeOSS_continuous-clearing_nupkg.html
asset_name: ReadmeOSS_continuous-clearing_nupkg.html
asset_content_type: text/html

Expand All @@ -249,6 +267,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ReadmeOSS_continuous-clearing_DockerImage.html
asset_path: ${{ github.workspace }}\ReadmeOSS_continuous-clearing_DockerImage.html
asset_name: ReadmeOSS_continuous-clearing_DockerImage.html
asset_content_type: text/html
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ RUN apt-get update && \
ENV PATH="/root/.local/bin:$PATH"

# Copying files from host to current working directory
COPY /out/net6.0 /app/out
COPY /buildoutput/ /app/out

0 comments on commit 0ee950b

Please sign in to comment.