-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflows, samples, tests, and formatting checks (#238)
Co-authored-by: Ivan Maximov <[email protected]>
- Loading branch information
Showing
38 changed files
with
649 additions
and
131 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build artifacts | ||
|
||
# ==== NOTE: do not rename this yml file or the run_number will be reset ==== | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json | ||
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build solution [Release] | ||
run: dotnet build --no-restore -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER | ||
- name: Pack solution [Release] | ||
run: dotnet pack --no-restore --no-build -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER -o out | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Nuget packages | ||
path: | | ||
out/* | ||
- name: Publish Nuget packages to GitHub registry | ||
run: dotnet nuget push "out/*" -k ${{secrets.GITHUB_TOKEN}} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Check formatting | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json | ||
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Check formatting | ||
run: dotnet format --no-restore --verify-no-changes --severity warn || (echo "Run 'dotnet format' to fix issues" && exit 1) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Publish release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Check github.ref starts with 'refs/tags/' | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
echo Error! github.ref does not start with 'refs/tags' | ||
echo github.ref: ${{ github.ref }} | ||
exit 1 | ||
- name: Set version number environment variable | ||
env: | ||
github_ref: ${{ github.ref }} | ||
run: | | ||
version="${github_ref:10}" | ||
echo version=$version | ||
echo "version=$version" >> $GITHUB_ENV | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://api.nuget.org/v3/index.json | ||
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.CONV_NUGET_AUTH_TOKEN}} | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build solution [Release] | ||
run: dotnet build --no-restore -c Release -p:Version=$version | ||
- name: Pack solution [Release] | ||
run: dotnet pack --no-restore --no-build -c Release -p:Version=$version -o out | ||
- name: Upload Nuget packages as workflow artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Nuget packages | ||
path: | | ||
out/* | ||
- name: Publish Nuget packages to Nuget registry | ||
run: dotnet nuget push "out/*" -k ${{secrets.CONV_NUGET_AUTH_TOKEN}} | ||
- name: Upload Nuget packages as release artifacts | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
console.log('environment', process.versions); | ||
const fs = require('fs').promises; | ||
const { repo: { owner, repo }, sha } = context; | ||
for (let file of await fs.readdir('out')) { | ||
console.log('uploading', file); | ||
await github.rest.repos.uploadReleaseAsset({ | ||
owner, | ||
repo, | ||
release_id: ${{ github.event.release.id }}, | ||
name: file, | ||
data: await fs.readFile(`out/${file}`) | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run code tests | ||
|
||
on: [pull_request] | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json | ||
env: | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build solution [Release] | ||
run: dotnet build --no-restore -c Release | ||
- name: Build solution [Debug] | ||
run: dotnet build --no-restore -c Debug | ||
- name: Test solution [Debug] | ||
run: dotnet test --no-restore --no-build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Check if PR title contains [WIP] | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened # when PR is opened | ||
- edited # when PR is edited | ||
- synchronize # when code is added | ||
- reopened # when a closed PR is reopened | ||
|
||
jobs: | ||
check-title: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Fail build if pull request title contains [WIP] | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
if: ${{ contains(github.event.pull_request.title, '[WIP]') }} # This function is case insensitive. | ||
run: | | ||
echo Warning! PR title "$TITLE" contains [WIP]. Remove [WIP] from the title when PR is ready. | ||
exit 1 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"projects": [ | ||
"src", | ||
"test", | ||
"deps/graphql-dotnet/src" | ||
"test" | ||
] | ||
} |
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
Oops, something went wrong.