Create config.yml (#355) #2289
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
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | |
on: | |
- workflow_dispatch | |
- pull_request | |
- push | |
name: CI | |
jobs: | |
licenses: | |
name: License update | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Support longpaths | |
run: git config --global core.longpaths true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
- run: dotnet tool restore | |
working-directory: ./commercetools.Sdk | |
- run: dotnet restore --configfile Nuget.config --packages ../packages | |
working-directory: ./commercetools.Sdk | |
- run: dotnet build --no-restore --source ../packages -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet tool install --global dotnet-project-licenses | |
- run: ./license-check.sh | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
if: github.event_name == 'push' && github.ref != 'refs/heads/master' | |
with: | |
file_pattern: 'licenses/index.json' | |
commit_message: "TASK: Updating license information" | |
commit_user_name: automation-commercetools | |
commit_user_email: automation@commercetools.com | |
commit_author: Auto Mation <automation@commercetools.com> | |
disable_globbing: true | |
unittests: | |
name: Unit tests | |
continue-on-error: true | |
strategy: | |
matrix: | |
osversion: | |
- windows-latest | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.osversion }} | |
steps: | |
- name: Support longpaths | |
run: git config --global core.longpaths true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
- run: dotnet tool restore | |
working-directory: ./commercetools.Sdk | |
- run: dotnet restore --configfile Nuget.config --packages ../packages | |
working-directory: ./commercetools.Sdk | |
- run: dotnet build --no-restore --source ../packages -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test --verbosity=normal Tests/commercetools.Api.Serialization.Tests --no-build -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.Api.Tests --no-build -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.ImportApi.Tests --no-build -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test --verbosity=normal Tests/commercetools.Sdk.HistoryApi.Tests --no-build -c Release | |
working-directory: ./commercetools.Sdk | |
integrationtests: | |
name: Integration tests | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
ClientType: | |
- Stream | |
- String | |
env: | |
CTP_ClientType: ${{ matrix.ClientType }} | |
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID }} | |
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }} | |
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }} | |
CTP_Client__Scope: ${{ secrets.CTP_SCOPE }} | |
CTP_Import__ClientId: ${{ secrets.CTP_CLIENT_ID }} | |
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET }} | |
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY }} | |
CTP_Import__Scope: ${{ secrets.CTP_SCOPE }} | |
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/" | |
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID }} | |
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET }} | |
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY }} | |
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
- run: dotnet tool restore | |
working-directory: ./commercetools.Sdk | |
- run: dotnet restore --configfile Nuget.config --packages ../packages | |
working-directory: ./commercetools.Sdk | |
- run: dotnet build --no-restore --source ../packages -c Release | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test IntegrationTests/commercetools.Api.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'push' | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test IntegrationTests/commercetools.Api.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'pull_request' | |
working-directory: ./commercetools.Sdk | |
env: | |
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }} | |
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }} | |
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }} | |
CTP_Client__Scope: ${{ secrets.CTP_SCOPE_PR }} | |
CTP_Import__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }} | |
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }} | |
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }} | |
CTP_Import__Scope: ${{ secrets.CTP_SCOPE_PR }} | |
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/" | |
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }} | |
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }} | |
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }} | |
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }} | |
- run: dotnet test IntegrationTests/commercetools.ImportApi.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'push' | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test IntegrationTests/commercetools.ImportApi.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'pull_request' | |
working-directory: ./commercetools.Sdk | |
env: | |
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }} | |
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }} | |
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }} | |
CTP_Client__Scope: ${{ secrets.CTP_SCOPE_PR }} | |
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }} | |
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }} | |
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }} | |
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }} | |
- run: dotnet test IntegrationTests/commercetools.GraphQL.Api.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'push' | |
working-directory: ./commercetools.Sdk | |
- run: dotnet test IntegrationTests/commercetools.GraphQL.Api.IntegrationTests --verbosity=normal --no-build -c Release | |
if: github.event_name == 'pull_request' | |
working-directory: ./commercetools.Sdk | |
env: | |
CTP_Client__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }} | |
CTP_Client__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }} | |
CTP_Client__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }} | |
CTP_Client__Scope: ${{ secrets.CTP_SCOPE_PR }} | |
CTP_Import__ClientId: ${{ secrets.CTP_CLIENT_ID_PR }} | |
CTP_Import__ClientSecret: ${{ secrets.CTP_CLIENT_SECRET_PR }} | |
CTP_Import__ProjectKey: ${{ secrets.CTP_PROJECT_KEY_PR }} | |
CTP_Import__Scope: ${{ secrets.CTP_SCOPE_PR }} | |
CTP_Import__ApiBaseAddress: "https://import.europe-west1.gcp.commercetools.com/" | |
CTP_MeClient__ClientId: ${{ secrets.CTP_MECLIENT_ID_PR }} | |
CTP_MeClient__ClientSecret: ${{ secrets.CTP_MECLIENT_SECRET_PR }} | |
CTP_MeClient__ProjectKey: ${{ secrets.CTP_MEPROJECT_KEY_PR }} | |
CTP_MeClient__Scope: ${{ secrets.CTP_MESCOPES_PR }} | |
artifacts: | |
name: Create artifacts | |
runs-on: ubuntu-latest | |
needs: [unittests, integrationtests] | |
steps: | |
- uses: actions/checkout@v3 | |
# Authenticates packages to push to GPR | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
source-url: https://nuget.pkg.github.com/commercetools/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: ./patch_csproj.rb --version 0.1.0-alpha-${{ github.run_number }} --patch **/*.csproj | |
- run: dotnet tool restore | |
working-directory: ./commercetools.Sdk | |
- run: dotnet restore --configfile Nuget.config --packages ../packages | |
working-directory: ./commercetools.Sdk | |
- run: dotnet build --no-restore --source ../packages -c Release | |
working-directory: ./commercetools.Sdk | |
- name: Create the package | |
run: dotnet pack -c Release -o ../pack/ --configfile Nuget.config | |
working-directory: ./commercetools.Sdk | |
- name: List packages | |
run: ls -la pack | |
- name: Publish Nuget to GitHub registry | |
if: github.ref == 'refs/heads/master' | |
run: dotnet nuget push "pack/*.nupkg" -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/commercetools/index.json --skip-duplicate --no-symbols | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: commercetools.Sdkv2.0.1.0-alpha-${{ github.run_number }} | |
path: pack | |