Skip to content

Commit

Permalink
test2
Browse files Browse the repository at this point in the history
  • Loading branch information
DanHarltey committed Mar 3, 2024
1 parent 9a09d84 commit 2cfa4bd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ jobs:
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest, macos-latest, buildjet-4vcpu-ubuntu-2204-arm]
env:
run_test_coverage: ${{ matrix.os == 'ubuntu-latest' }}
TEST_COVERAGE: ${{ matrix.os == 'ubuntu-latest' }}
NO_NET48: ${{ matrix.os == 'buildjet-4vcpu-ubuntu-2204-arm' }}
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: true

steps:
- name: GIT checkout
Expand All @@ -26,11 +30,14 @@ jobs:
working-directory: scripts
shell: bash
run: |
echo "$run_test_coverage"
echo "$TEST_COVERAGE"
echo "$NO_NET48"
echo "$RUNNER_OS"
echo "$RUNNER_ARCH"
if [ "$RUNNER_OS" == "Linux" ] && [ "$RUNNER_ARCH" == "X64" ]; then
./dotnet_build.sh code_coverage
if [ "$TEST_COVERAGE" == "true" ] then
./dotnet_build.sh test_coverage
elif [ "NO_NET48" == "true" ] then
./dotnet_build.sh no_net48
else
./dotnet_build.sh
fi
Expand All @@ -48,31 +55,31 @@ jobs:
if-no-files-found: error

- name: Upload test coverage to Coveralls
if: runner.os == 'Linux' && runner.arch == 'X64'
if: env.TEST_COVERAGE
uses: coverallsapp/github-action@v2
with:
format: lcov
files: release/coverage.net8.info release/coverage.net48.info

- name: Upload dotnet info
uses: actions/upload-artifact@v4
if: runner.os == 'Linux' && runner.arch == 'X64'
if: env.TEST_COVERAGE
with:
name: Built with
path: release/dotnet_info.txt
if-no-files-found: error

- name: Upload test coverage
uses: actions/upload-artifact@v4
if: runner.os == 'Linux' && runner.arch == 'X64'
if: env.TEST_COVERAGE
with:
name: test coverage
path: release/coverage.*.info
if-no-files-found: error

- name: Upload NuGet packages
uses: actions/upload-artifact@v4
if: runner.os == 'Linux' && runner.arch == 'X64'
if: env.TEST_COVERAGE
with:
name: NuGet packages
path: release/Fastenshtein.*upkg
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Run build script
working-directory: scripts
run: ./dotnet_build.sh code_coverage
run: ./dotnet_build.sh test_coverage

- name: Create GitHub release
working-directory: scripts
Expand Down
6 changes: 5 additions & 1 deletion scripts/dotnet_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ dotnet --info > ../release/dotnet_info.txt
dotnet restore ../
dotnet build ../ --configuration Release --no-restore -p:ContinuousIntegrationBuild=true

if [ $1 = "code_coverage" ]; then
if [ $1 = "test_coverage" ]
then
dotnet test ../ --configuration Release --no-build --verbosity normal --framework net8.0 --collect:"XPlat Code Coverage;Format=lcov"
find ../tests/Fastenshtein.Tests/TestResults/ -name "coverage.info" -type f -exec mv {} ../release/coverage.net8.info \;

dotnet test ../ --configuration Release --no-build --verbosity normal --framework net48 --collect:"XPlat Code Coverage;Format=lcov"
find ../tests/Fastenshtein.Tests/TestResults/ -name "coverage.info" -type f -exec mv {} ../release/coverage.net48.info \;
elif [ $1 = "no_net48" ]
then
dotnet test ../ --configuration Release --no-build --verbosity normal --framework net8.0
else
dotnet test ../ --configuration Release --no-build --verbosity normal
fi
Expand Down

0 comments on commit 2cfa4bd

Please sign in to comment.