Skip to content

Code cleanup and fix tests #5116

Code cleanup and fix tests

Code cleanup and fix tests #5116

Workflow file for this run

name: CI/CD Pipeline
on: [push, pull_request, workflow_dispatch]
permissions:
contents: write
jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
outputs:
latest_version: ${{ steps.tag_generator.outputs.new_version }}
is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }}
env:
ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts
GITHUB_RUN_NUMBER: ${{ github.run_number }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Data gatherer
id: data_gatherer
shell: pwsh
run: |
# Get default branch
$repo = 'microsoft/OpenAPI.NET'
$defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch
Write-Output "::set-output name=default_branch::$(echo $defaultBranch)"
- name: Conditionals handler
id: conditionals_handler
shell: pwsh
run: |
$defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}"
$githubRef = "${{ github.ref }}"
$isDefaultBranch = 'false'
if ( $githubRef -like "*$defaultBranch*" ) {
$isDefaultBranch = 'true'
}
Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)"
- name: Checkout repository
id: checkout_repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- if: steps.conditionals_handler.outputs.is_default_branch == 'true'
name: Bump GH tag
id: tag_generator
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
release_branches: ${{ steps.data_gatherer.outputs.default_branch }}
- name: Build projects
id: build_projects
shell: pwsh
run: |
dotnet build Microsoft.OpenApi.sln -c Release
- name: Run unit tests
id: run_unit_tests
shell: pwsh
run: |
dotnet test Microsoft.OpenApi.sln -c Release -v n