|
| 1 | +# Builds and runs tests in all three supported OSes |
| 2 | +# Pushes CI feed if secrets.SLEET_CONNECTION is provided |
| 3 | + |
| 4 | +name: build |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + configuration: |
| 9 | + type: choice |
| 10 | + description: Configuration |
| 11 | + options: |
| 12 | + - Release |
| 13 | + - Debug |
| 14 | + push: |
| 15 | + branches: [ main, dev, 'dev/*', 'feature/*', 'rel/*' ] |
| 16 | + paths-ignore: |
| 17 | + - changelog.md |
| 18 | + - readme.md |
| 19 | + pull_request: |
| 20 | + types: [opened, synchronize, reopened] |
| 21 | + |
| 22 | +env: |
| 23 | + DOTNET_NOLOGO: true |
| 24 | + PackOnBuild: true |
| 25 | + GeneratePackageOnBuild: true |
| 26 | + VersionPrefix: 42.42.${{ github.run_number }} |
| 27 | + VersionLabel: ${{ github.ref }} |
| 28 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 29 | + MSBUILDTERMINALLOGGER: auto |
| 30 | + Configuration: ${{ github.event.inputs.configuration || 'Release' }} |
| 31 | + SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }} |
| 32 | + |
| 33 | +defaults: |
| 34 | + run: |
| 35 | + shell: bash |
| 36 | + |
| 37 | +jobs: |
| 38 | + os-matrix: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + outputs: |
| 41 | + matrix: ${{ steps.lookup.outputs.matrix }} |
| 42 | + steps: |
| 43 | + - name: 🤘 checkout |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: 🔎 lookup |
| 47 | + id: lookup |
| 48 | + shell: pwsh |
| 49 | + run: | |
| 50 | + $path = './.github/workflows/os-matrix.json' |
| 51 | + $os = if (test-path $path) { cat $path } else { '["ubuntu-latest"]' } |
| 52 | + echo "matrix=$os" >> $env:GITHUB_OUTPUT |
| 53 | +
|
| 54 | + build: |
| 55 | + needs: os-matrix |
| 56 | + name: build-${{ matrix.os }} |
| 57 | + runs-on: ${{ matrix.os }} |
| 58 | + strategy: |
| 59 | + matrix: |
| 60 | + os: ${{ fromJSON(needs.os-matrix.outputs.matrix) }} |
| 61 | + steps: |
| 62 | + - name: 🤘 checkout |
| 63 | + uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + submodules: recursive |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - name: ⚙ dotnet |
| 69 | + uses: devlooped/actions-dotnet-env@v1 |
| 70 | + |
| 71 | + - name: 🙏 build |
| 72 | + run: dotnet build -m:1 -bl:build.binlog |
| 73 | + |
| 74 | + - name: 🧪 test |
| 75 | + run: | |
| 76 | + dotnet tool update -g dotnet-retest |
| 77 | + dotnet retest -- --no-build |
| 78 | +
|
| 79 | + - name: 🐛 logs |
| 80 | + uses: actions/upload-artifact@v4 |
| 81 | + if: runner.debug && always() |
| 82 | + with: |
| 83 | + name: logs |
| 84 | + path: '*.binlog' |
| 85 | + |
| 86 | + - name: 🚀 sleet |
| 87 | + env: |
| 88 | + SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }} |
| 89 | + if: env.SLEET_CONNECTION != '' |
| 90 | + run: | |
| 91 | + dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r) |
| 92 | + sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found" |
| 93 | +
|
| 94 | + dotnet-format: |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - name: 🤘 checkout |
| 98 | + uses: actions/checkout@v4 |
| 99 | + with: |
| 100 | + submodules: recursive |
| 101 | + fetch-depth: 0 |
| 102 | + |
| 103 | + - name: ⚙ dotnet |
| 104 | + uses: devlooped/actions-dotnet-env@v1 |
| 105 | + |
| 106 | + - name: ✓ ensure format |
| 107 | + run: | |
| 108 | + dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget |
| 109 | + dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget |
0 commit comments