Skip to content

Commit

Permalink
fix(#476): Replace pull_request trigger with workflow_run
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Jun 17, 2022
1 parent d18fc52 commit 8a8b3e8
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 56 deletions.
61 changes: 5 additions & 56 deletions .github/workflows/cicd.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Continuous Integration & Delivery
name: Continuous Delivery

on:
push:
branches: [ develop, master, bugfix/*, feature/* ]
pull_request:
branches: [ develop, master ]
workflow_run:
workflows: [ Continuous Integration ]
types: [ completed ]

env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand All @@ -14,59 +13,9 @@ env:
TZ: CET # https://stackoverflow.com/q/53510011

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
clean: true
lfs: true

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore .NET Tools
run: dotnet tool restore

- name: Restore NuGet Packages
run: dotnet cake --target=Restore-NuGet-Packages

- name: Run Build
run: dotnet cake --target=Build

- name: Run Tests
run: dotnet cake --target=Tests --test-filter=FullyQualifiedName~${{ startsWith(matrix.os, 'ubuntu') && 'DotNet.Testcontainers' || 'DotNet.Testcontainers.Tests.Unit.Containers.Windows' }}

- name: Get Logs
run: Get-ChildItem -Path . -Include *.log -Recurse | % { Get-Content -Path $_.FullName }
shell: pwsh

- name: Rename Test And Coverage Results
run: Get-ChildItem -Path 'test-coverage' -Filter *.xml | Rename-Item -NewName { $_.Name -Replace 'coverage', '${{ matrix.os }}'.ToLower() }
shell: pwsh

- name: Upload Test And Coverage Results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: |
test-coverage
test-results
publish:
needs: build

if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: ${{ contains(fromJson('["develop", "master"]'), github.ref_name) && 'production' || 'development' }}

runs-on: ubuntu-20.04

env:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Continuous Integration

on:
push:
branches: [ develop, master, bugfix/*, feature/* ]
pull_request:
branches: [ develop, master ]

env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_VERSION: 6.0.x
TZ: CET # https://stackoverflow.com/q/53510011

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
clean: true
lfs: true

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore .NET Tools
run: dotnet tool restore

- name: Restore NuGet Packages
run: dotnet cake --target=Restore-NuGet-Packages

- name: Run Build
run: dotnet cake --target=Build

- name: Run Tests
run: dotnet cake --target=Tests --test-filter=FullyQualifiedName~${{ startsWith(matrix.os, 'ubuntu') && 'DotNet.Testcontainers' || 'DotNet.Testcontainers.Tests.Unit.Containers.Windows' }}

- name: Get Logs
run: Get-ChildItem -Path . -Include *.log -Recurse | % { Get-Content -Path $_.FullName }
shell: pwsh

- name: Rename Test And Coverage Results
run: Get-ChildItem -Path 'test-coverage' -Filter *.xml | Rename-Item -NewName { $_.Name -Replace 'coverage', '${{ matrix.os }}'.ToLower() }
shell: pwsh

- name: Upload Test And Coverage Results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: |
test-coverage
test-results

0 comments on commit 8a8b3e8

Please sign in to comment.