Fix date #200
Workflow file for this run
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: MSBuild | |
concurrency: | |
group: "${{ github.workflow }}:${{ github.event_name }}:${{ github.head_ref || github.ref_name }}" | |
cancel-in-progress: true | |
on: | |
pull_request_target: | |
branches: [ master ] | |
types: [ opened, synchronize, labeled ] | |
push: | |
tags: | |
- '*' | |
merge_group: | |
types: [ checks_requested ] | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: ./src/EasyEPlanner.sln | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
jobs: | |
check: | |
name: Check | |
runs-on: windows-latest | |
outputs: | |
result: ${{ steps.pass.outputs.result }} | |
steps: | |
- id: is_organization_member | |
run: > | |
$response = (curl -L | |
-w '%{http_code}' | |
-H "Accept: application/vnd.github+json" | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | |
-H "X-GitHub-Api-Version: 2022-11-28" | |
https://api.github.com/orgs/savushkin-r-d/members/${{ github.event.sender.login }}) | |
echo "response=$response" >> $env:GITHUB_OUTPUT | |
continue-on-error: true | |
# --On linux-- | |
# run: | | |
# response=`curl -L \ | |
# ... \ | |
# ...` | |
# echo "response=$response" >> $GITHUB_OUTPUT | |
- id: pass | |
if: >- | |
(github.event.action == 'labeled' && github.event.label.name == 'safe to test') || | |
((github.event.action == 'synchronize' || github.event.action == 'opened') && steps.is_organization_member.outputs.response == '204') || | |
github.event_name == 'merge_group' || | |
startsWith(github.ref, 'refs/tags/') | |
run: echo "result=success" >> $env:GITHUB_OUTPUT | |
# On linux: >> $GITHUB_OUTPUT | |
- name: exit with failure | |
if: steps.pass.outputs.result != 'success' | |
run: exit 1 | |
build: | |
name: Build, analyze and test | |
runs-on: windows-latest | |
needs: check | |
if: needs.check.outputs.result == 'success' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v3 | |
with: | |
path: .\.sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
New-Item -Path .\.sonar\scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | |
- name: Install dotnet-coverage | |
shell: powershell | |
run: | | |
dotnet tool install --global dotnet-coverage | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Download fetch.exe and EPLAN API binaries, copy it to the .net specific path | |
run: | | |
curl -L "https://github.com/gruntwork-io/fetch/releases/download/v0.4.2/fetch_windows_amd64.exe" -O | |
md src/bin/${{env.BUILD_CONFIGURATION}} | |
./fetch_windows_amd64.exe --github-oauth-token="${{ secrets.EPLAN_API_BIN }}" --repo="https://github.com/savushkin-r-d/EPLAN-API-bin" --tag="2.9" --release-asset=".*" "src/bin/${{env.BUILD_CONFIGURATION}}" | |
md submodule/EplanIdleTimeModule/EplanIdleTimeModule/bin/${{env.BUILD_CONFIGURATION}} | |
cp src/bin/${{env.BUILD_CONFIGURATION}}/* submodule/EplanIdleTimeModule/EplanIdleTimeModule/bin/${{env.BUILD_CONFIGURATION}} | |
- name: Sonar scanner begin | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
PULL_REQUEST_DATA: /d:sonar.pullrequest.key=${{ github.event.pull_request.number }} /d:sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} /d:sonar.scm.revision=${{ github.event.pull_request.head.sha }} | |
run: .\.sonar\scanner\dotnet-sonarscanner begin /k:"KirillGutyrchik_EasyEPLANner" /o:"kirillgutyrchik" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="EasyEplanner.Tests/coverage.xml" ${{ github.event_name == 'pull_request_target' && env.PULL_REQUEST_DATA || '' }} | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Test | |
working-directory: EasyEplanner.Tests | |
run: dotnet test --configuration ${{env.BUILD_CONFIGURATION}} --collect "Code Coverage" | |
- name: Test coverage merge | |
working-directory: EasyEplanner.Tests | |
run: dotnet-coverage merge -o coverage.xml -f xml -r *.coverage | |
- name: Sonar scanner end | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
- name: Download sys_base_objects_description | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
md /objects_description | |
./fetch_windows_amd64.exe --github-oauth-token="${{ secrets.EPLAN_API_BIN }}" --repo="https://github.com/savushkin-r-d/ptusa-Lua-dairy-system" --ref="master" "/objects_description" | |
md src/bin/${{env.BUILD_CONFIGURATION}}/Lua/BaseObjectsDescriptionFiles | |
copy /objects_description/EasyEplannerObjectsDescription/sys_base_objects_description.lua src/bin/${{env.BUILD_CONFIGURATION}}/Lua/BaseObjectsDescriptionFiles/sys_base_objects_description.lua | |
- name: Delete extra files | |
working-directory: src/bin/${{env.BUILD_CONFIGURATION}} | |
run: | | |
del *.pdb | |
del Eplan.EplApi.* | |
del EplanBaseNetu.dll | |
del Microsoft.mshtml.dll | |
- name: Pack | |
working-directory: src/bin | |
run: cmake -E tar cfv EasyEPLANner.zip --format=zip ${{env.BUILD_CONFIGURATION}} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: EasyEPLANner | |
path: src/bin/EasyEPLANner.zip | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Release | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: EasyEPLANner | |
path: ./ | |
- name: Get assembly version | |
id: assembly-version | |
shell: powershell | |
run: | | |
Expand-Archive -Force './EasyEPLANner.zip' | |
$version=[System.Reflection.Assembly]::LoadFrom("./EasyEPLANner/Release/EPLAN.EplAddin.EasyEPlanner.dll").GetName().Version.ToString() | |
echo "version=$version" >> $env:GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: ${{ github.ref_name }} | |
body: "Обновление от $(date -d +'%B.%m.$Y'). Версия надстройки - ${{ steps.assembly-version.outputs.version }}:" | |
files: | | |
EasyEPLANner.zip | |
draft: false | |
prerelease: false |