|
| 1 | +name: DEV-GPR-PUSH |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + paths: |
| 8 | + - 'src/bunit.core/**' |
| 9 | + - 'src/bunit.web/**' |
| 10 | + - 'src/bunit.xunit/**' |
| 11 | + |
| 12 | +env: |
| 13 | + VERSION: '' |
| 14 | + BRANCH: '' |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build and verify library |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. |
| 24 | + - uses: dotnet/nbgv@master |
| 25 | + with: |
| 26 | + setAllVars: true |
| 27 | + - name: Setting VERSION and BRANCH env |
| 28 | + run: | |
| 29 | + echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion" |
| 30 | + echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" |
| 31 | + - name: Update tokens in project files |
| 32 | + uses: cschleiden/replace-tokens@v1 |
| 33 | + with: |
| 34 | + files: '["*.csproj", "**/*.csproj"]' |
| 35 | + - uses: actions/setup-dotnet@v1 |
| 36 | + with: |
| 37 | + dotnet-version: '3.1.202' |
| 38 | + - name: Building library |
| 39 | + run: | |
| 40 | + dotnet restore src |
| 41 | + dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 42 | + dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 43 | + dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 44 | + dotnet build src/bunit.testassets/ -c Release --no-restore |
| 45 | + - name: Running unit tests |
| 46 | + run: | |
| 47 | + dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591 |
| 48 | + dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591 |
| 49 | + dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591 |
| 50 | + - name: Creating library package |
| 51 | + run: | |
| 52 | + dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 53 | + dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 54 | + dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 55 | + dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 56 | + - name: Buidling template package |
| 57 | + run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages |
| 58 | + - name: Verifying template |
| 59 | + run: | |
| 60 | + dotnet new --install ${GITHUB_WORKSPACE}/packages/bunit.template.$VERSION.nupkg |
| 61 | + dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test |
| 62 | + dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages |
| 63 | + dotnet test ${GITHUB_WORKSPACE}/Test |
| 64 | + - name: Push packages to GitHub Package Registry |
| 65 | + run: | |
| 66 | + for f in ${GITHUB_WORKSPACE}/packages/*.nupkg |
| 67 | + do |
| 68 | + curl -vX PUT -u "egil:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/egil/ |
| 69 | + done |
| 70 | + shell: bash |
| 71 | +# - name: Push packages to GitHub Package Registry |
| 72 | +# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' --skip-duplicate |
0 commit comments