From 1f106ccf5abfd7604a94ee63e247067a27a1873d Mon Sep 17 00:00:00 2001 From: phnx47-bot <78849906+phnx47-bot@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:32:29 +0700 Subject: [PATCH] sync: synced file(s) with prom-client-net/prom-client-tmpl (#165) --- .github/settings.yml | 26 ++++---- .../workflows/{ci-win.yml => build-win.yml} | 4 +- .github/workflows/build.yml | 61 +++++++++++++++++ .github/workflows/ci.yml | 66 ++----------------- 4 files changed, 83 insertions(+), 74 deletions(-) rename .github/workflows/{ci-win.yml => build-win.yml} (90%) create mode 100644 .github/workflows/build.yml diff --git a/.github/settings.yml b/.github/settings.yml index 1966249..9633984 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -8,51 +8,51 @@ repository: labels: - name: dependencies - color: 0052CC + color: '0052CC' description: - name: bug - color: D73A4A + color: 'D73A4A' description: - name: documentation - color: 0075CA + color: '0075CA' description: - name: duplicate - color: CFD3D7 + color: 'CFD3D7' description: - name: enhancement - color: A2EEEF + color: 'A2EEEF' description: - name: good first issue - color: 7057FF + color: '7057FF' description: - name: help wanted - color: 008672 + color: '008672' description: - name: invalid - color: E4E669 + color: 'E4E669' description: - name: question - color: D876E3 + color: 'D876E3' description: - name: wontfix - color: FFFFFF + color: 'FFFFFF' description: - name: vulnerability - color: D1260F + color: 'D1260F' description: - name: sync - color: 6E81A3 + color: '6E81A3' description: branches: @@ -61,7 +61,7 @@ branches: required_pull_request_reviews: null required_status_checks: strict: false - contexts: ['Build, Test & Pack (Linux)'] + contexts: ['Build, Test & Pack'] enforce_admins: false required_linear_history: false restrictions: null diff --git a/.github/workflows/ci-win.yml b/.github/workflows/build-win.yml similarity index 90% rename from .github/workflows/ci-win.yml rename to .github/workflows/build-win.yml index 6a7686d..9b12172 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/build-win.yml @@ -1,4 +1,4 @@ -name: CI Windows +name: Build Win on: push: @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - build-windows: + build-win: name: Build & Test (Windows) runs-on: windows-2022 steps: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..075ed72 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: Build + +on: + pull_request: + branches: + - "main" + workflow_dispatch: + workflow_call: + +jobs: + build: + name: Build, Test & Pack + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + + - name: Build + run: dotnet build -c Release -p:ContinuousIntegrationBuild=true + + - name: Run tests + run: dotnet test --no-build -c Release -p:CollectCoverage=true -e:CoverletOutputFormat=opencover + + - name: Publish to Codecov + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Set Dev version + if: github.ref == 'refs/heads/main' + run: | + version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" + if [ -z "${version}" ]; then + version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" + fi + echo "VERSION=${version}" >> $GITHUB_ENV + + - name: Set Release version + if: startsWith(github.ref, 'refs/tags/v') + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV + + - name: Pack NuGet artifacts + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}" + + - name: Upload artifacts + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + uses: actions/upload-artifact@v4 + with: + name: nupkgs + path: src/**/*nupkg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06561c5..256bb5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI Linux +name: CI on: push: @@ -6,68 +6,16 @@ on: - "main" tags: - "v*" - pull_request: - branches: - - "main" - workflow_dispatch: jobs: - build-linux: - name: Build, Test & Pack (Linux) - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - - - name: Build - run: dotnet build -c Release -p:ContinuousIntegrationBuild=true - - - name: Run tests - run: dotnet test --no-build -c Release -p:CollectCoverage=true -e:CoverletOutputFormat=opencover - - - name: Publish to Codecov - uses: codecov/codecov-action@v5 - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Set Dev version - if: github.ref == 'refs/heads/main' - run: | - version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" - if [ -z "${version}" ]; then - version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" - fi - echo "VERSION=${version}" >> $GITHUB_ENV - - - name: Set Release version - if: startsWith(github.ref, 'refs/tags/v') - run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV - - - name: Pack NuGet artifacts - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') - run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}" - - - name: Upload artifacts - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v4 - with: - name: nupkgs - path: src/**/*nupkg + build: + name: CI Build + uses: ./.github/workflows/build.yml + secrets: inherit github: name: Deploy to GitHub - needs: [build-linux] - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + needs: [build] runs-on: ubuntu-24.04 steps: - name: Download artifacts @@ -79,7 +27,7 @@ jobs: nuget: name: Deploy to NuGet - needs: [build-linux] + needs: [build] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-24.04 steps: