Continuous Integration #1695
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: Continuous Integration | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '45 18 * * *' | |
concurrency: | |
group: ci | |
cancel-in-progress: true | |
env: | |
SYMBOL_PACKAGE: false | |
DOTNET_TEST_TFM: net8.0 | |
jobs: | |
build: | |
name: Build | |
env: | |
build-configuration: Release | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/sliekens/gw2sdk/devcontainer:latest | |
options: --user 1001 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # (no history limit) | |
filter: tree:0 | |
- name: Install dependencies | |
run: dotnet restore --locked-mode | |
- name: Build | |
run: dotnet build --configuration ${{ env.build-configuration }} --no-restore | |
- name: Update test data | |
run: dotnet run --configuration ${{ env.build-configuration }} --project GW2SDK.TestDataHelper -- GW2SDK.Tests/Data | |
- name: Test | |
run: dotnet test --framework $DOTNET_TEST_TFM --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore | |
env: | |
ApiKeyBasic: ${{ secrets.API_TOKEN_BASIC }} | |
ApiKey: ${{ secrets.API_TOKEN_FULL }} | |
GuildLeader__Token: ${{ secrets.API_TOKEN_GUILD_LEADER }} | |
- name: Pack artifacts | |
run: dotnet pack GW2SDK --configuration ${{ env.build-configuration }} --no-build --output artifacts | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: artifacts | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test data on failure | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: test-data | |
path: GW2SDK.Tests/Data | |
deploy-to-github-packages: | |
name: Deploy to GitHub Packages | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-packages | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
path: artifacts | |
- name: Upload packages to GitHub Packages | |
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/sliekens/index.json --api-key ${{secrets.GITHUB_TOKEN}} --skip-duplicate |