Allow having generated methods in Async methods #490
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| env: | |
| Configuration: Release | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| ACT: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| # os: [ubuntu-latest] | |
| # os: [windows-latest] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Set path for nektos/act | |
| if: ${{ runner.os == 'Windows' && env.ACT }} | |
| run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH | |
| shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}' | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
| - name: "Determine prerequisites" | |
| id: prerequisite | |
| run: | | |
| echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | |
| echo "need_yarn=$(command -v yarn >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | |
| echo "has_git_repo=$(git rev-parse --git-dir > /dev/null 2>&1 && echo 1 || echo 0)" >> $GITHUB_OUTPUT | |
| # Switch to https://github.com/actions/setup-node when it works | |
| - name: Install node | |
| if: ${{ steps.prerequisite.outputs.need_node == '1' }} | |
| run: | | |
| if [ "${{ runner.os }}" = "windows" ] | |
| then | |
| choco install nodejs -y | |
| echo "C:\Program Files\nodejs" >> $GITHUB_PATH | |
| else | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\ | |
| apt-get install -y nodejs | |
| fi | |
| - name: Setup .NET | |
| if: ${{ runner.os != 'Windows' || !env.ACT }} | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 10.0.x | |
| - uses: dotnet/nbgv@master | |
| id: nbgv | |
| if: ${{ steps.prerequisite.outputs.has_git_repo == '1' }} | |
| with: | |
| setAllVars: true | |
| - name: Install yarn | |
| run: | | |
| npm install -g yarn | |
| if [ "${{ runner.os }}" = "windows" ] | |
| then | |
| choco install yarn -y | |
| echo "C:\Program Files (x86)\Yarn\bin" >> $GITHUB_PATH | |
| else | |
| npm install -g yarn | |
| fi | |
| if: ${{ steps.prerequisite.outputs.need_yarn == '1' }} | |
| - run: yarn install | |
| - name: "Run pre-commit hooks" | |
| run: bash $GITHUB_WORKSPACE/.husky/pre-commit normal | |
| # https://github.com/actions/cache/blob/main/examples.md | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore /property:Configuration=Release | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --verbosity normal --settings tests/coverlet.runsettings | |
| - name: Generate code coverage report | |
| run: dotnet dnx --yes dotnet-reportgenerator-globaltool -reports:**/coverage.cobertura.xml -targetdir:./reports/coverage | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| id: codecov | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| if: ${{ env.CODECOV_TOKEN != '' }} | |
| - name: Upload artifacts (code coverage) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_${{ matrix.os }} | |
| path: reports/coverage | |
| if: steps.codecov.outcome == 'success' | |
| - name: Pack | |
| if: ${{ runner.os != 'Windows' }} | |
| run: dotnet pack --configuration Release -o packages --no-build | |
| - name: Upload artifacts (.nupkg) | |
| if: ${{ runner.os != 'Windows' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages | |
| path: packages/ | |
| sign: | |
| needs: build | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Set path for nektos/act | |
| if: ${{ runner.os == 'Windows' && env.ACT }} | |
| run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH | |
| shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}' | |
| - name: "Determine prerequisites" | |
| id: prerequisite | |
| run: | | |
| echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | |
| - name: Setup .NET | |
| if: ${{ runner.os != 'Windows' || !env.ACT }} | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 10.0.x | |
| - name: Install node | |
| if: ${{ steps.prerequisite.outputs.need_node == '1' }} | |
| run: | | |
| if [ "${{ runner.os }}" = "windows" ] | |
| then | |
| choco install nodejs -y | |
| echo "C:\Program Files\nodejs" >> $GITHUB_PATH | |
| else | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\ | |
| apt-get install -y nodejs | |
| fi | |
| - name: Download Package artifact | |
| uses: actions/download-artifact@v4 | |
| - name: Sign | |
| env: | |
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
| AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNER_CLIENT_SECRET }} | |
| AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNER_CLIENT_ID }} | |
| if: ${{ env.AZURE_CLIENT_SECRET != '' && github.ref == 'refs/heads/master' }} | |
| run: | | |
| dotnet dnx --prerelease --yes sign code trusted-signing \ | |
| --base-directory "${{ github.workspace }}/packages" \ | |
| "*.nupkg" \ | |
| --trusted-signing-endpoint "${{ secrets.TRUSTED_SIGNING_ENDPOINT }}" \ | |
| --trusted-signing-account "${{ secrets.TRUSTED_SIGNING_ACCOUNT }}" \ | |
| --trusted-signing-certificate-profile "${{ secrets.TRUSTED_SIGNING_CERTIFICATE_PROFILE }}" \ | |
| -v normal | |
| - name: Upload artifacts (.nupkg) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages-signed | |
| path: packages/ | |
| publish: | |
| needs: sign | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set path for nektos/act | |
| if: ${{ runner.os == 'Windows' && env.ACT }} | |
| run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH | |
| shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}' | |
| - name: Setup .NET | |
| if: ${{ runner.os != 'Windows' || !env.ACT }} | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 10.0.x | |
| - name: Download Package artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: packages-signed | |
| - name: Push to MyGet | |
| env: | |
| MYGET_PUSH_KEY: ${{ secrets.MYGET_PUSH_KEY }} | |
| if: ${{ env.MYGET_PUSH_KEY != '' }} | |
| run: dotnet nuget push *.nupkg -s https://www.myget.org/F/zomp-sync-method-generator/api/v3/index.json -k ${{ secrets.MYGET_PUSH_KEY }} | |
| - name: Push to NuGet | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' }} | |
| run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_PUSH_KEY }} |