Skip to content

πŸ› fix(storage): handle projected lease failures idempotently in batch… #206

πŸ› fix(storage): handle projected lease failures idempotently in batch…

πŸ› fix(storage): handle projected lease failures idempotently in batch… #206

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
- master
- 'feature/**'
- 'release/**'
tags:
- 'v*.*.*'
pull_request:
branches:
- main
- master
workflow_dispatch:
env:
DOTNET_VERSION: '10.0.x'
CONFIGURATION: Release
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
should_publish: ${{ steps.version.outputs.should_publish }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Cache .NET SDK
uses: actions/cache@v4
with:
path: ~/.dotnet
key: ${{ runner.os }}-dotnet-${{ env.DOTNET_VERSION }}
restore-keys: |
${{ runner.os }}-dotnet-
- name: Restore dependencies
run: dotnet restore --verbosity minimal
- name: Build solution
run: dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore --verbosity minimal
- name: Run tests with coverage
run: dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity minimal
--collect:"XPlat Code Coverage"
--results-directory ./coverage
--logger "trx;LogFileName=test-results.trx"
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: '**/test-results.trx'
retention-days: 7
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./coverage/**/coverage.cobertura.xml
retention-days: 7
- name: Extract version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "should_publish=true" >> $GITHUB_OUTPUT
else
VERSION="0.0.0-dev.$(date +%Y%m%d%H%M%S)"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "should_publish=false" >> $GITHUB_OUTPUT
fi
echo "Version: ${VERSION}"
pack-nuget:
name: Pack NuGet (Linux)
runs-on: ubuntu-latest
needs: build-and-test
if: needs.build-and-test.outputs.should_publish == 'true'
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore --verbosity minimal
- name: Build solution
run: dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore --verbosity minimal
- name: Pack NuGet packages
run: |
mkdir -p ./packages
dotnet pack src/Locus/Locus.csproj \
--configuration ${{ env.CONFIGURATION }} \
--no-restore \
--output ./packages \
/p:PackageVersion=${{ needs.build-and-test.outputs.version }} \
/p:ContinuousIntegrationBuild=true \
--verbosity minimal
shell: bash
- name: List packages
run: ls -la ./packages/
- name: Upload NuGet packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./packages/*.nupkg
retention-days: 30
- name: Publish to NuGet.org
run: |
dotnet nuget push ./packages/*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate \
--no-symbols
continue-on-error: true
- name: Generate changelog
id: changelog
run: |
PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --reverse)
else
CHANGELOG=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --reverse)
fi
echo "$CHANGELOG" > changelog.txt
{
echo 'CHANGELOG<<EOF'
echo "$CHANGELOG"
echo EOF
} >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release v${{ needs.build-and-test.outputs.version }}
tag_name: v${{ needs.build-and-test.outputs.version }}
body: |
## πŸš€ Release v${{ needs.build-and-test.outputs.version }}
### πŸ“¦ NuGet Package
- **Locus** v${{ needs.build-and-test.outputs.version }}
Built on: **Linux (ubuntu-latest)**
### πŸ“ Changes
${{ steps.changelog.outputs.CHANGELOG }}
### πŸ”— Links
- [NuGet Gallery](https://www.nuget.org/packages/Locus)
- [Documentation](https://github.com/${{ github.repository }})
files: ./packages/*.nupkg
draft: false
prerelease: ${{ contains(needs.build-and-test.outputs.version, '-') }}
token: ${{ secrets.GITHUB_TOKEN }}
pack-debug-symbols:
name: Pack Debug Symbols
runs-on: ubuntu-latest
needs: [build-and-test, pack-nuget]
if: needs.build-and-test.outputs.should_publish == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore and Build
run: |
dotnet restore --verbosity minimal
dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore --verbosity minimal
- name: Pack Symbol Packages
run: |
mkdir -p ./symbols
dotnet pack src/Locus/Locus.csproj \
--configuration ${{ env.CONFIGURATION }} \
--no-restore \
--output ./symbols \
/p:PackageVersion=${{ needs.build-and-test.outputs.version }} \
/p:ContinuousIntegrationBuild=true \
--verbosity minimal
- name: Upload Symbol Packages
uses: actions/upload-artifact@v4
with:
name: symbol-packages
path: ./symbols/*.snupkg
retention-days: 30