Merge pull request #5 from vitalybibikov/vitalybibikov-patch-2 #34
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 | |
permissions: | |
contents: read | |
pull-requests: write # required if create-pr-comment: true | |
checks: write # required if create-status-check: true | |
on: | |
push: | |
branches: [ "master", "development" ] | |
pull_request: | |
branches: [ "master", "development" ] | |
release: | |
types: | |
- published # Run the workflow when a new GitHub release is published | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
NuGetDirectory: ${{github.workspace}}/nupkgs | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.override.yml config | |
docker-compose pull | |
docker-compose build | |
- name: Run tests | |
run: docker-compose up --exit-code-from tests tests localstack | |
- name: Run tests | |
run: docker-compose up --exit-code-from unittests unittests | |
- name: Upload TRX test results | |
uses: actions/upload-artifact@v2 | |
if: always() # This ensures it runs even if the previous steps fail | |
with: | |
name: trx-test-results | |
path: ./test-results/*.trx | |
- name: Clean up | |
run: docker-compose down | |
- name: Parse Trx files | |
uses: NasAmin/trx-parser@v0.5.0 | |
id: trx-parser | |
with: | |
TRX_PATH: ${{ github.workspace }}/test-results #This should be the path to your TRX files | |
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Process trx reports | |
id: process-trx | |
# You may also reference just the major or major.minor version | |
uses: im-open/process-dotnet-test-results@v3.0.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
base-directory: './test-results' | |
create-status-check: true | |
create-pr-comment: true | |
update-comment-if-one-exists: true | |
ignore-test-failures: true | |
timezone: 'america/denver' | |
comment-identifier: 'bff-tests' | |
# Optional | |
- name: Annotate Test Outcome | |
if: steps.process-trx.outputs.test-results-truncated == 'true' | |
run: cat ${{ steps.process-trx.outputs.test-results-file-path }} > $GITHUB_STEP_SUMMARY | |
# Optional | |
- name: Upload Outcome as artifact if character limit reached | |
if: steps.process-trx.outputs.test-results-truncated == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Cypress-Results | |
path: | | |
${{ steps.process-trx.outputs.test-results-file-path }} | |
retention-days: 90 | |
build-and-publish: | |
needs: integration-tests | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && success() | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Build and Pack | |
run: | | |
dotnet build src/DynamoDBv2.Transactions.csproj --configuration Release | |
dotnet pack src/DynamoDBv2.Transactions.csproj --configuration Release --output ${{ env.NuGetDirectory }} /p:Version=3.7.$GITHUB_RUN_NUMBER | |
- name: Create NuGet Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nuget | |
if-no-files-found: error | |
retention-days: 7 | |
path: ${{ env.NuGetDirectory }}/*.nupkg | |
- name: Publish NuGet package | |
run: | | |
for file in $(find ${NuGetDirectory} -name "*.nupkg") | |
do | |
dotnet nuget push "$file" --api-key "${NUGET_PUSH_KEY}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
done |