Skip to content

Commit

Permalink
ci: java version 21
Browse files Browse the repository at this point in the history
  • Loading branch information
alpcoker committed Jan 31, 2024
1 parent c8d202c commit c1ceb97
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,41 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

# SonarScanner requires minimal version of 17, replacing the default 8 in ubuntu-latest
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '21'

- name: Install SonarCloud global tool
run: dotnet tool install --global dotnet-sonarscanner --version 5.15.0
run: dotnet tool install --global dotnet-sonarscanner

- name: Begin SonarCloud scan
run: dotnet sonarscanner begin /o:"photo-cli" /k:"photo-cli_photo-cli" /d:sonar.cs.opencover.reportsPaths="**/*.opencover.xml" /d:sonar.login=${{secrets.SONAR_TOKEN}} /d:sonar.host.url="https://sonarcloud.io"
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: Build
run: dotnet build --configuration Release

- name: Test
env:
PHOTO_CLI_BIG_DATA_CLOUD_API_KEY: ${{secrets.PHOTO_CLI_BIG_DATA_CLOUD_API_KEY}}
PHOTO_CLI_GOOGLE_MAPS_API_KEY: ${{secrets.PHOTO_CLI_GOOGLE_MAPS_API_KEY}}
PHOTO_CLI_LOCATIONIQ_API_KEY: ${{secrets.PHOTO_CLI_LOCATIONIQ_API_KEY}}
run: dotnet test --configuration Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: End SonarCloud scan
run: dotnet sonarscanner end /d:sonar.login=${{secrets.SONAR_TOKEN}}
env:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,49 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

# SonarScanner requires minimal version of 17, replacing the default 8 in ubuntu-latest
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '21'

- name: Install SonarCloud global tool
run: dotnet tool install --global dotnet-sonarscanner

- name: Begin SonarCloud scan
run: dotnet sonarscanner begin -d:sonar.qualitygate.wait=true /o:"photo-cli" /k:"photo-cli_photo-cli" /d:sonar.cs.opencover.reportsPaths="**/*.opencover.xml" /d:sonar.login=${{secrets.SONAR_TOKEN}} /d:sonar.host.url="https://sonarcloud.io"
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: Build
run: dotnet build --configuration Release /p:Version=${VERSION}

- name: Test
env:
PHOTO_CLI_BIG_DATA_CLOUD_API_KEY: ${{secrets.PHOTO_CLI_BIG_DATA_CLOUD_API_KEY}}
PHOTO_CLI_GOOGLE_MAPS_API_KEY: ${{secrets.PHOTO_CLI_GOOGLE_MAPS_API_KEY}}
PHOTO_CLI_LOCATIONIQ_API_KEY: ${{secrets.PHOTO_CLI_LOCATIONIQ_API_KEY}}
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build

- name: End SonarCloud scan
run: dotnet sonarscanner end /d:sonar.login=${{secrets.SONAR_TOKEN}}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .

- name: Publish
run: dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
16 changes: 16 additions & 0 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,50 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

# SonarScanner requires minimal version of 17, replacing the default 8 in ubuntu-latest
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '21'

- name: Install SonarCloud global tool
run: dotnet tool install --global dotnet-sonarscanner

- name: Begin SonarCloud scan
run: dotnet sonarscanner begin -d:sonar.qualitygate.wait=true /o:"photo-cli" /k:"photo-cli_photo-cli" /d:sonar.cs.opencover.reportsPaths="**/*.opencover.xml" /d:sonar.login=${{secrets.SONAR_TOKEN}} /d:sonar.host.url="https://sonarcloud.io"
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: Build
run: dotnet build --configuration Release

- name: Test
env:
PHOTO_CLI_BIG_DATA_CLOUD_API_KEY: ${{secrets.PHOTO_CLI_BIG_DATA_CLOUD_API_KEY}}
PHOTO_CLI_GOOGLE_MAPS_API_KEY: ${{secrets.PHOTO_CLI_GOOGLE_MAPS_API_KEY}}
PHOTO_CLI_LOCATIONIQ_API_KEY: ${{secrets.PHOTO_CLI_LOCATIONIQ_API_KEY}}
run: dotnet test --configuration Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: End SonarCloud scan
run: dotnet sonarscanner end /d:sonar.login=${{secrets.SONAR_TOKEN}}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .

- name: Publish
run: dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

0 comments on commit c1ceb97

Please sign in to comment.