From b11da78a28dd9a4af9b200d4cdce830f3849c63e Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Fri, 14 Jun 2024 09:52:04 -0300 Subject: [PATCH] Build full OS matrix, fix publish workflow --- .github/workflows/build.yml | 62 +++++++++++++++++++++++--------- .github/workflows/os-matrix.json | 1 + .github/workflows/publish.yml | 7 +++- .netconfig | 4 +-- 4 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/os-matrix.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3894ee3..9b78e76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,24 +19,53 @@ env: DOTNET_NOLOGO: true VersionPrefix: 42.42.${{ github.run_number }} VersionLabel: ${{ github.ref }} + PackOnBuild: true + GeneratePackageOnBuild: true + GH_TOKEN: ${{ secrets.GH_TOKEN }} + +defaults: + run: + shell: bash jobs: - build: + os-matrix: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.lookup.outputs.matrix }} steps: - name: ๐Ÿค˜ checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: ๐Ÿ”Ž lookup + id: lookup + shell: pwsh + run: | + $path = './.github/workflows/os-matrix.json' + $os = if (test-path $path) { cat $path } else { '["ubuntu-latest"]' } + echo "matrix=$os" >> $env:GITHUB_OUTPUT + + build: + needs: os-matrix + name: build-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ${{ fromJSON(needs.os-matrix.outputs.matrix) }} + steps: + - name: ๐Ÿค˜ checkout + uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.x' - dotnet-quality: 'preview' - - name: ๐Ÿ™ build - run: dotnet build -m:1 + run: dotnet build -m:1 -bl:build.binlog + + - name: โš™ GNU grep + if: matrix.os == 'macOS-latest' + run: | + brew install grep + echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> .bash_profile - name: โš™ azurite run: | @@ -46,8 +75,12 @@ jobs: - name: ๐Ÿงช test uses: ./.github/workflows/test - - name: ๐Ÿ“ฆ pack - run: dotnet pack -m:1 + - name: ๐Ÿ› logs + uses: actions/upload-artifact@v3 + if: runner.debug && always() + with: + name: logs + path: '*.binlog' # Only push CI package to sleet feed if building on ubuntu (fastest) - name: ๐Ÿš€ sleet @@ -62,17 +95,12 @@ jobs: runs-on: ubuntu-latest steps: - name: ๐Ÿค˜ checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.x' - dotnet-quality: 'preview' - - name: โœ“ ensure format run: | dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget - dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget + dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget \ No newline at end of file diff --git a/.github/workflows/os-matrix.json b/.github/workflows/os-matrix.json new file mode 100644 index 0000000..f27f6f0 --- /dev/null +++ b/.github/workflows/os-matrix.json @@ -0,0 +1 @@ +["ubuntu-latest", "windows-latest", "macOS-latest"] \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1c2833b..5a6177e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,6 +27,11 @@ jobs: - name: ๐Ÿ™ build run: dotnet build -m:1 -p:version=${GITHUB_REF#refs/*/v} -bl:build.binlog + - name: โš™ azurite + run: | + npm install azurite@3.20.1 + npx azurite & + - name: ๐Ÿงช test uses: ./.github/workflows/test @@ -38,4 +43,4 @@ jobs: path: '*.binlog' - name: ๐Ÿš€ nuget - run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate + run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate \ No newline at end of file diff --git a/.netconfig b/.netconfig index 81a78fa..836043d 100644 --- a/.netconfig +++ b/.netconfig @@ -68,9 +68,7 @@ weak [file ".github/workflows/publish.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/publish.yml - sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9 - etag = 9ea4083894308a610742488923d2a44778ebba6ca73fb13424647d9a82c918b4 - weak + skip [file ".github/workflows/sponsor.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/sponsor.yml sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9