Skip to content

Commit

Permalink
don't ignore dev PRs (#69)
Browse files Browse the repository at this point in the history
* don't ignore dev PRs

* rework actions

* minimize test output
  • Loading branch information
adamhathcock authored Jul 24, 2024
1 parent 3a94a63 commit ffc84ba
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
51 changes: 3 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,11 @@
name: .NET Build

on:
pull_request: # Run build on every pull request that is not to main/dev
pull_request: # Run build on every pull request that is not to main
branches-ignore:
- main
- dev
workflow_call:
secrets:
codecov_token:
required: true
outputs:
version:
value: ${{ jobs.build.outputs.version }}

jobs:
build:
runs-on: windows-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)

- name: Cache Nuget
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: ⚒️ Run GitVersion
run: ./build.ps1 build-server-version

- name: ⚒️ Run build
run: ./build.ps1

- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{ env.GitVersion_FullSemVer }}
path: output/*.*
compression-level: 0 # no compression

- id: set-version
name: Set version to output
run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
jobs:
test:
runs-on: ubuntu-latest
steps:
Expand All @@ -75,4 +30,4 @@ jobs:
uses: codecov/codecov-action@v4
with:
file: Converters/**/coverage.xml
token: ${{ secrets.codecov_token }}
token: ${{ secrets.CODECOV_TOKEN }}
63 changes: 60 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,42 @@ on:

jobs:
build:
uses: ./.github/workflows/ci.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
runs-on: windows-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)

- name: Cache Nuget
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: ⚒️ Run GitVersion
run: ./build.ps1 build-server-version

- name: ⚒️ Run build
run: ./build.ps1

- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{ env.GitVersion_FullSemVer }}
path: output/*.*
compression-level: 0 # no compression

- id: set-version
name: Set version to output
run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
deploy-installers:
runs-on: ubuntu-latest
needs: build
Expand All @@ -28,3 +60,28 @@ jobs:
wait-for-completion-timeout: 10m
display-workflow-run-url: true
display-workflow-run-url-interval: 10s
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)

- name: Cache Nuget
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: ⚒️ Run build
run: ./build.sh test-only

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
file: Converters/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void RemoveDirectory(string d)
Glob.Files(".", "**/*.Tests.csproj"),
file =>
{
Run("dotnet", $"test {file} -c Release --no-build --no-restore --verbosity=normal");
Run("dotnet", $"test {file} -c Release --no-build --no-restore --verbosity=minimal");
}
);

Expand All @@ -144,7 +144,7 @@ void RemoveDirectory(string d)
Run("dotnet", $"restore {file} --locked-mode");
Run(
"dotnet",
$"test {file} -c Release --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage"
$"test {file} -c Release --no-restore --verbosity=minimal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage /p:AltCoverVerbosity=Warning"
);
}
);
Expand Down

0 comments on commit ffc84ba

Please sign in to comment.