From a53a669f5c8696454e3a16539ee830ae545371aa Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 14:16:26 -0400 Subject: [PATCH 01/15] Add concurrency check to size labelling --- .github/workflows/size-label.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/size-label.yml b/.github/workflows/size-label.yml index 096ce4c643..0d0e503813 100644 --- a/.github/workflows/size-label.yml +++ b/.github/workflows/size-label.yml @@ -2,6 +2,10 @@ name: Size Labelling on: pull_request_target: +concurrency: + group: "size-labelling-${{ github.head_ref || github.run_id }}-${{ github.event_name }}" + cancel-in-progress: true + jobs: size-label: name: Add Size Label From d9af57b809b5f8e8450ab10f642812093266130c Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 14:31:15 -0400 Subject: [PATCH 02/15] Flaky test Improvements - Consider tests flaky if `Build` or `apt` steps fail. - Only attempt up to 4 re-runs. --- .github/workflows/ci-pipeline.yml | 69 +++++++++++--------- .github/workflows/scripts/rerunFlakyTests.js | 21 ++++-- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 71d1b2f844..afafa48b6a 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -67,7 +67,7 @@ jobs: with: ref: "refs/pull/${{ inputs.pull_request_number }}/merge" - - name: Build ReleaseNotes + - name: Build ReleaseNotes # Name checked in rerunFlakyTests.js run: dotnet publish -c Release -p:TGS_HOST_NO_WEBPANEL=true -o release_notes_bins tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj - name: Store ReleaseNotes Binaries @@ -108,7 +108,7 @@ jobs: - name: Setup Telemetry Key File run: echo "fake_telemetry_key" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build + - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true - name: Perform CodeQL Analysis @@ -124,7 +124,7 @@ jobs: byond: [ '510.1346', '511.1385', '512.1488', '513.1542', '514.1589', 'EDGE' ] runs-on: ubuntu-latest steps: - - name: Install x86 libc Dependencies + - name: Install Native x86 libc Dependencies # Name checked in rerunFlakyTests.js run: | sudo dpkg --add-architecture i386 sudo apt-get update @@ -137,7 +137,7 @@ jobs: path: ~/byond-zips-cache key: byond-zips - - name: Build BYOND Cache if Necessary and Install + - name: Setup BYOND Cache if Necessary and Install run: | echo "Setting up BYOND." FULL_VERSION=${{ matrix.byond }} @@ -184,7 +184,7 @@ jobs: run: echo "head_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Build DMAPI Test Project + - name: Compile DMAPI Test Project run: | set -e retval=1 @@ -244,7 +244,7 @@ jobs: git checkout ${{ matrix.committish }} git submodule update --init --recursive - - name: Build OpenDream + - name: Build OpenDream # Name checked in rerunFlakyTests.js run: | cd $HOME/OpenDream/OpenDreamPackageTool dotnet build -c Release --nologo -v q --property WarningLevel=0 /clp:ErrorsOnly @@ -254,7 +254,7 @@ jobs: cd $HOME/OpenDream dotnet run -c Release --project OpenDreamPackageTool --no-build -- --tgs -o tgs_deploy - - name: Build DMAPI + - name: Compile DMAPI Test Project run: | cd tests/DMAPI/BasicOperation $HOME/OpenDream/tgs_deploy/bin/compiler/DMCompiler --verbose --notices-enabled "basic operation_test.dme" @@ -345,7 +345,7 @@ jobs: name: release_notes_bins path: release_notes_bins - - name: Build Changelog (Incremental) + - name: Compile Changelog (Incremental) run: | mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --generate-full-notes @@ -410,7 +410,7 @@ jobs: shell: bash run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Docker Image + - name: Build Docker Image # Name checked in rerunFlakyTests.js run: docker build . -f build/Dockerfile --build-arg TGS_TELEMETRY_KEY_FILE=${{ env.TGS_TELEMETRY_KEY_FILE }} - name: Delete Telemetry Key File @@ -429,7 +429,7 @@ jobs: TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt runs-on: ubuntu-latest steps: - - name: Install x86 libc Dependencies + - name: Install Native x86 libc Dependencies # Name checked in rerunFlakyTests.js run: | sudo dpkg --add-architecture i386 sudo apt-get update @@ -462,7 +462,7 @@ jobs: - name: Setup Telemetry Key File run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build + - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWindows - name: Delete Telemetry Key File @@ -525,7 +525,7 @@ jobs: shell: bash run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build + - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWix - name: Delete Telemetry Key File @@ -656,7 +656,7 @@ jobs: shell: bash run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build + - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }} tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj - name: Delete Telemetry Key File @@ -820,7 +820,7 @@ jobs: - name: Disable ptrace_scope run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - - name: Install Native Dependencies + - name: Install Native Dependencies # Name checked in rerunFlakyTests.js run: | sudo dpkg --add-architecture i386 sudo apt-get update @@ -876,7 +876,7 @@ jobs: - name: Setup Telemetry Key File run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build + - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWindows tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj - name: Delete Telemetry Key File @@ -1228,7 +1228,7 @@ jobs: env: TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt steps: - - name: Install Native Dependencies + - name: Install Native Dependencies # Name checked in rerunFlakyTests.js run: | sudo dpkg --add-architecture i386 sudo apt-get update @@ -1241,7 +1241,7 @@ jobs: echo ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }} | gpg --batch --yes --passphrase-fd 0 --import private.pgp rm private.pgp - - name: Install dotnet-sdk system package + - name: Install Native dotnet-sdk Package # Name checked in rerunFlakyTests.js if: (!contains(env.TGS_DOTNET_QUALITY, 'preview')) run: | sudo apt-get update @@ -1383,7 +1383,7 @@ jobs: shell: bash run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Host + - name: Build Host # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj - name: Delete Telemetry Key File @@ -1391,14 +1391,14 @@ jobs: if: always() run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Service + - name: Build Service # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj - name: Prepare Artifacts shell: powershell run: build/package/winget/prepare_installer_input_artifacts.ps1 - - name: Build Installer .exe + - name: Build Installer .exe # Name checked in rerunFlakyTests.js run: | cd build/package/winget/Tgstation.Server.Host.Service.Wix.Bundle dotnet build -c Release @@ -1789,7 +1789,8 @@ jobs: shell: bash run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Host # We need to rebuild the installer.exe so it can be properly signed + # We need to rebuild the installer.exe so it can be properly signed + - name: Build Host # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj - name: Delete Telemetry Key File @@ -1797,14 +1798,14 @@ jobs: if: always() run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Service + - name: Build Service # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj - name: Prepare Artifacts shell: powershell run: build/package/winget/prepare_installer_input_artifacts.ps1 - - name: Build Installer .exe + - name: Build Installer .exe # Name checked in rerunFlakyTests.js run: | cd build/package/winget/Tgstation.Server.Host.Service.Wix.Bundle dotnet build -c Release @@ -2012,7 +2013,7 @@ jobs: name: release_notes_bins path: release_notes_bins - - name: Build Changelog (Incremental) + - name: Compile Changelog (Incremental) run: | mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --generate-full-notes @@ -2044,14 +2045,16 @@ jobs: needs: deploy-tgs runs-on: ubuntu-latest steps: + - name: Install Native Packages # Name checked in rerunFlakyTests.js + run: | + sudo apt-get update + sudo apt-get install -y xmlstarlet + - name: Checkout uses: actions/checkout@v4 - name: Parse TGS version - run: | - sudo apt-get update - sudo apt-get install -y xmlstarlet - echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV + run: echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV - name: Docker Build and Push uses: elgohr/Publish-Docker-Github-Action@43dc228e327224b2eda11c8883232afd5b34943b # v5 @@ -2067,14 +2070,16 @@ jobs: needs: deploy-tgs runs-on: ubuntu-latest steps: + - name: Install Native Packages # Name checked in rerunFlakyTests.js + run: | + sudo apt-get update + sudo apt-get install -y xmlstarlet + - name: Checkout uses: actions/checkout@v4 - name: Parse TGS version - run: | - sudo apt-get update - sudo apt-get install -y xmlstarlet - echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV + run: echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV - name: Trigger tgstation-ppa workflow run: | diff --git a/.github/workflows/scripts/rerunFlakyTests.js b/.github/workflows/scripts/rerunFlakyTests.js index 7dda0f389a..e2dc2d3c73 100644 --- a/.github/workflows/scripts/rerunFlakyTests.js +++ b/.github/workflows/scripts/rerunFlakyTests.js @@ -1,4 +1,12 @@ -// Only check jobs that start with these. +const MAX_ATTEMPTS = 5; + +// If any job fails with a step starting with these it'll be considered flaky +const CONSIDERED_STEP_PREFIXES = [ + "Build", // Nuget.org sporadic issues + "Install Native", // apt repository issues +]; + +// Otherwise only check jobs that start with these. // Helps make sure we don't restart something like which is not known to be flaky. const CONSIDERED_JOBS = [ "Windows Live Tests", @@ -25,6 +33,10 @@ async function getFailedJobsForRun(github, context, workflowRunId, runAttempt) { } export async function rerunFlakyTests({ github, context }) { + if (context.payload.workflow_run.run_attempt >= MAX_ATTEMPTS) { + console.log(`Jobs have reached maximum attempt count of ${context.payload.workflow_run.run_attempt}, Will not re-run.`) + } + const failingJobs = await getFailedJobsForRun( github, context, @@ -33,7 +45,7 @@ export async function rerunFlakyTests({ github, context }) { ); if (failingJobs.length > 3) { - console.log("Many jobs failing. PROBABLY not flaky, not rerunning."); + console.log("Many jobs failing. PROBABLY not flaky, Will not re-run."); return; } @@ -41,10 +53,11 @@ export async function rerunFlakyTests({ github, context }) { console.log(`Failing job: ${job.name}`) return CONSIDERED_JOBS .flatMap(jobName => [jobName, 'CI Pipeline / ' + jobName]) - .some((title) => job.name.startsWith(title)); + .some((title) => job.name.startsWith(title)) + || CONSIDERED_STEP_PREFIXES.some(consideredStep => job.steps.some(step => step.name.startsWith(consideredStep) && step.conclusion == "failure")); }); if (filteredFailingJobs.length !== failingJobs.length) { - console.log("One or more failing jobs are NOT designated flaky. Not rerunning."); + console.log("One or more failing jobs are NOT designated flaky. Will not re-run."); return; } From 3037cec627aca4d04e5f3fa36b9eccaa19616b5d Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 14:53:20 -0400 Subject: [PATCH 03/15] Minor notes about the difference between the shared and common libraries --- src/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/README.md b/src/README.md index 8a2271c3bf..76cb6bdf5d 100644 --- a/src/README.md +++ b/src/README.md @@ -9,3 +9,7 @@ This is a series of README.md files aimed at directing people around the codebas - To explore the C# client code navigate to [Tgstation.Server.Client](./Tgstation.Server.Client). [Tgstation.Server.Host.Watchdog](./Tgstation.Server.Host.Watchdog), [Tgstation.Server.Host.Service](./Tgstation.Server.Host.Service), and [Tgstation.Server.Host.Console](./Tgstation.Server.Host.Console) are related to the Service/Console runners which have the simple task of executing Tgstation.Server.Host and updating it when requested. + +[Tgstation.Server.Common](./Tgstation.Server.Common) are functions and dependencies shared publically (Published to Nuget). + +[Tgstation.Server.Shared](./Tgstation.Server.Shared) are functions and dependencies shared internally (Not published to Nuget). From 0c305da9be749ec535c67ddc63aac94e63a83a85 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 18:16:02 -0400 Subject: [PATCH 04/15] Avoid building ReleaseNotes in .deb build --- .github/workflows/ci-pipeline.yml | 10 ++++++++++ build/package/deb/build_package.sh | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index afafa48b6a..53336bcba3 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -1224,6 +1224,7 @@ jobs: build-deb: name: Build .deb Package # Can't do i386 due to https://github.com/dotnet/core/issues/4595 + needs: build-releasenotes runs-on: ubuntu-latest env: TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt @@ -1260,6 +1261,12 @@ jobs: sudo ln -s $DOTNET_PATH /usr/bin/dotnet echo "New dotnet path should be $DOTNET_PATH" + - name: Retrieve ReleaseNotes Binaries + uses: actions/download-artifact@v4 + with: + name: release_notes_bins + path: release_notes_bins + - name: Checkout (Branch) uses: actions/checkout@v4 if: github.event_name == 'push' || github.event_name == 'schedule' @@ -1278,11 +1285,14 @@ jobs: - name: Execute Build Script (Unsigned) if: (!(github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master')) + env: + RELEASE_NOTES_DLL_PATH: release_notes_bins/Tgstation.Server.ReleaseNotes.dll run: sudo -E build/package/deb/build_package.sh - name: Execute Build Script (Signed) if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master') env: + RELEASE_NOTES_DLL_PATH: release_notes_bins/Tgstation.Server.ReleaseNotes.dll PACKAGING_KEYGRIP: ${{ vars.PACKAGING_KEYGRIP }} run: sudo -E build/package/deb/build_package.sh diff --git a/build/package/deb/build_package.sh b/build/package/deb/build_package.sh index a48071f219..29d828f1bb 100755 --- a/build/package/deb/build_package.sh +++ b/build/package/deb/build_package.sh @@ -59,7 +59,11 @@ dh_make -p tgstation-server_$TGS_VERSION -y --createorig -s rm -f debian/README* debian/changelog debian/*.ex debian/upstream/*.ex pushd .. -dotnet run -c Release -p:TGS_HOST_NO_WEBPANEL=true --project tools/Tgstation.Server.ReleaseNotes $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT +if [[ -z "$RELEASE_NOTES_DLL_PATH" ]]; then + dotnet run -c Release -p:TGS_HOST_NO_WEBPANEL=true --project tools/Tgstation.Server.ReleaseNotes $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT +else + dotnet $RELEASE_NOTES_DLL_PATH $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT +fi popd cp -r build/package/deb/debian/* debian/ From e6de4b856750898629ba7d5f4049524c124f90ac Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 18:56:08 -0400 Subject: [PATCH 05/15] Fix description of forked PR message --- .github/workflows/ci-security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-security.yml b/.github/workflows/ci-security.yml index d89d2d3055..19edfa31dd 100644 --- a/.github/workflows/ci-security.yml +++ b/.github/workflows/ci-security.yml @@ -27,7 +27,7 @@ jobs: if: github.event.action == 'opened' && !contains(github.event.pull_request.labels.*.name, 'CI Cleared') && github.event.pull_request.user.id != 49699333 uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 with: - message: Thank you for contributing to ${{ github.event.pull_request.base.repo.name }}! The workflow '${{ github.workflow }}' requires repository secrets and will not run without approval. Maintainers can add the `CI Cleared` label to allow it to run. Note that any changes to ci-security.yml will not be reflected in the run and the ci-pipeline.yml at the HEAD of the pull request will be used. + message: Thank you for contributing to ${{ github.event.pull_request.base.repo.name }}! The workflow '${{ github.workflow }}' requires repository secrets and will not run without approval. Maintainers can add the `CI Cleared` label to allow it to run. Note that any changes to ci-security.yml and ci-pipeline.yml will not be reflected. - name: Comment on dependabot PR if: github.event.action == 'opened' && !contains(github.event.pull_request.labels.*.name, 'CI Cleared') && github.event.pull_request.user.id == 49699333 From 2bb8ceeb277575b0665ed1aace25bf51d182d27f Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 18 Aug 2024 21:26:59 -0400 Subject: [PATCH 06/15] Fix .deb build path --- .github/workflows/ci-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 53336bcba3..9469319bc7 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -1286,13 +1286,13 @@ jobs: - name: Execute Build Script (Unsigned) if: (!(github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master')) env: - RELEASE_NOTES_DLL_PATH: release_notes_bins/Tgstation.Server.ReleaseNotes.dll + RELEASE_NOTES_DLL_PATH: ${{ github.workspace }}/release_notes_bins/Tgstation.Server.ReleaseNotes.dll run: sudo -E build/package/deb/build_package.sh - name: Execute Build Script (Signed) if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master') env: - RELEASE_NOTES_DLL_PATH: release_notes_bins/Tgstation.Server.ReleaseNotes.dll + RELEASE_NOTES_DLL_PATH: ${{ github.workspace }}/release_notes_bins/Tgstation.Server.ReleaseNotes.dll PACKAGING_KEYGRIP: ${{ vars.PACKAGING_KEYGRIP }} run: sudo -E build/package/deb/build_package.sh From a7005195d8ee6441bc0013a0e42d79005f129579 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Mon, 19 Aug 2024 21:43:18 -0400 Subject: [PATCH 07/15] Strip Codecov checks entirely. We'll revisit after we see how it works after the v4 uploader change --- .github/workflows/scripts/rerunFlakyTests.js | 3 +-- .../Tgstation.Server.ReleaseNotes/Program.cs | 25 +------------------ 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/scripts/rerunFlakyTests.js b/.github/workflows/scripts/rerunFlakyTests.js index e2dc2d3c73..f8e5078066 100644 --- a/.github/workflows/scripts/rerunFlakyTests.js +++ b/.github/workflows/scripts/rerunFlakyTests.js @@ -11,8 +11,7 @@ const CONSIDERED_STEP_PREFIXES = [ const CONSIDERED_JOBS = [ "Windows Live Tests", "Linux Live Tests", - "Build .deb Package", - "Upload Code Coverage" + "Build .deb Package" ]; async function getFailedJobsForRun(github, context, workflowRunId, runAttempt) { diff --git a/tools/Tgstation.Server.ReleaseNotes/Program.cs b/tools/Tgstation.Server.ReleaseNotes/Program.cs index c59f86fd19..46c887fd5f 100644 --- a/tools/Tgstation.Server.ReleaseNotes/Program.cs +++ b/tools/Tgstation.Server.ReleaseNotes/Program.cs @@ -60,7 +60,6 @@ static async Task Main(string[] args) var fullNotes = versionString.Equals("--generate-full-notes", StringComparison.OrdinalIgnoreCase); var nuget = versionString.Equals("--nuget", StringComparison.OrdinalIgnoreCase); var genToken = versionString.Equals("--token-output-file", StringComparison.OrdinalIgnoreCase); - var waitCodecov = versionString.Equals("--wait-codecov", StringComparison.OrdinalIgnoreCase); if ((!Version.TryParse(versionString, out var version) || version.Revision != -1) && !ensureRelease @@ -68,8 +67,7 @@ static async Task Main(string[] args) && !shaCheck && !fullNotes && !nuget - && !genToken - && !waitCodecov) + && !genToken) { Console.WriteLine("Invalid version: " + versionString); return 2; @@ -157,11 +155,6 @@ static async Task Main(string[] args) client.Credentials = new Credentials(githubToken); } - if (waitCodecov) - { - return await CodecovCheck(client, Int64.Parse(args[1])); - } - if (linkWinget) { if (args.Length < 2 || !Uri.TryCreate(args[1], new UriCreationOptions(), out var actionsUrl)) @@ -1678,21 +1671,5 @@ static void DebugAssert(bool condition, string message = null) else Debug.Assert(condition); } - - static async ValueTask CodecovCheck(IGitHubClient client, long runId) - { - var currentRun = await client.Actions.Workflows.Runs.Get(RepoOwner, RepoName, runId); - - bool foundRun = false; - for(int i = 0; i < 15 && !foundRun; ++i) - { - var allRuns = await client.Check.Run.GetAllForReference(RepoOwner, RepoName, currentRun.HeadSha); - foundRun = allRuns.CheckRuns.Any(x => x.CheckSuite.Id == currentRun.Id && x.Name == "codecov/project"); - if (!foundRun && i != 14) - await Task.Delay(TimeSpan.FromMinutes(1)); - } - - return foundRun ? 0 : 24398; - } } } From d0e05950a9f7afc18aece7787b09c09a4aa6e0b0 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Mon, 19 Aug 2024 22:01:59 -0400 Subject: [PATCH 08/15] Add dependabot automerge workflow --- .github/workflows/dependabot-automerge.yml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000000..54cc5f085a --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,25 @@ +name: 'Automerge Dependabot' + +on: + pull_request_target: + types: [ opened, reopened ] + branches: + - dev + - master + +concurrency: + group: "dependabot-automerge-${{ github.head_ref || github.run_id }}-${{ github.event_name }}" + cancel-in-progress: true + +jobs: + automerge: + name: Enable Automerge on Dependabot PRs + runs-on: ubuntu-latest + if: github.event.pull_request.user.id == 49699333 + permissions: + pull-requests: write + steps: + - name: Enable Automerge + uses: daneden/enable-automerge-action@f8558b65c5b8d8bfb592c4e74e3d491624a38fbd #v1.0.2-ish + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 911aeb4375ce3261b5cba002d7b4d7982f4d2189 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 06:40:34 -0400 Subject: [PATCH 09/15] Another flaky step catch --- .github/workflows/ci-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 9469319bc7..f3e0fd7a43 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -249,7 +249,7 @@ jobs: cd $HOME/OpenDream/OpenDreamPackageTool dotnet build -c Release --nologo -v q --property WarningLevel=0 /clp:ErrorsOnly - - name: Create TGS Deployment + - name: Build TGS Deployment # Name checked in rerunFlakyTests.js run: | cd $HOME/OpenDream dotnet run -c Release --project OpenDreamPackageTool --no-build -- --tgs -o tgs_deploy From d6800491ad947f64c907a6b45035210706da193d Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 06:42:14 -0400 Subject: [PATCH 10/15] Fix relative pathing --- build/package/deb/build_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package/deb/build_package.sh b/build/package/deb/build_package.sh index 29d828f1bb..62f3374748 100755 --- a/build/package/deb/build_package.sh +++ b/build/package/deb/build_package.sh @@ -62,7 +62,7 @@ pushd .. if [[ -z "$RELEASE_NOTES_DLL_PATH" ]]; then dotnet run -c Release -p:TGS_HOST_NO_WEBPANEL=true --project tools/Tgstation.Server.ReleaseNotes $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT else - dotnet $RELEASE_NOTES_DLL_PATH $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT + dotnet ../$RELEASE_NOTES_DLL_PATH $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT fi popd From 81b8080652edab5919af3db632c41296f7310c14 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 06:45:14 -0400 Subject: [PATCH 11/15] Make dependabot run on GitHub Actions --- .github/dependabot.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c3351535e..30e8c16db3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,18 @@ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file version: 2 updates: - - package-ecosystem: "nuget" - directory: "/" + - package-ecosystem: nuget + directory: / schedule: - interval: "daily" + interval: daily labels: - - "Dependencies" + - Dependencies open-pull-requests-limit: 100 + - package-ecosystem: github-actions + directory: "/" + target-branch: master + schedule: + interval: daily + labels: + - Dependencies + - CI/CD From be263166afba26c7fe9b735500523d9922752a2d Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 07:11:26 -0400 Subject: [PATCH 12/15] Fix post deployment conditionals --- .github/workflows/ci-pipeline.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index f3e0fd7a43..e64f461560 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -2006,6 +2006,7 @@ jobs: changelog-regen: name: Regenerate Changelog runs-on: ubuntu-latest + if: (!(cancelled() || failure())) && needs.deploy-tgs.result == 'success' needs: deploy-tgs steps: - name: Setup dotnet @@ -2053,6 +2054,7 @@ jobs: deploy-docker: name: Deploy TGS (Docker) needs: deploy-tgs + if: (!(cancelled() || failure())) && needs.deploy-tgs.result == 'success' runs-on: ubuntu-latest steps: - name: Install Native Packages # Name checked in rerunFlakyTests.js @@ -2078,6 +2080,7 @@ jobs: deploy-ppa: name: Deploy TGS (PPA) needs: deploy-tgs + if: (!(cancelled() || failure())) && needs.deploy-tgs.result == 'success' runs-on: ubuntu-latest steps: - name: Install Native Packages # Name checked in rerunFlakyTests.js @@ -2098,6 +2101,7 @@ jobs: deploy-winget: name: Deploy TGS (winget) needs: deploy-tgs + if: (!(cancelled() || failure())) && needs.deploy-tgs.result == 'success' runs-on: windows-latest steps: - name: Setup dotnet From 4c104591de8800f49b5ff7aa4eae19668633e759 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 16:54:59 -0400 Subject: [PATCH 13/15] Revert "Fix relative pathing" This reverts commit d6800491ad947f64c907a6b45035210706da193d. --- build/package/deb/build_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package/deb/build_package.sh b/build/package/deb/build_package.sh index 62f3374748..29d828f1bb 100755 --- a/build/package/deb/build_package.sh +++ b/build/package/deb/build_package.sh @@ -62,7 +62,7 @@ pushd .. if [[ -z "$RELEASE_NOTES_DLL_PATH" ]]; then dotnet run -c Release -p:TGS_HOST_NO_WEBPANEL=true --project tools/Tgstation.Server.ReleaseNotes $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT else - dotnet ../$RELEASE_NOTES_DLL_PATH $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT + dotnet $RELEASE_NOTES_DLL_PATH $TGS_VERSION --debian packaging/debian/changelog $CURRENT_COMMIT fi popd From 65beb310574ab85f7d8502800cd74459de747d41 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 17:23:59 -0400 Subject: [PATCH 14/15] Fix fucking checkout fucking wiping the workspace --- .github/workflows/ci-pipeline.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index e64f461560..9e72fb60ca 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -1261,12 +1261,6 @@ jobs: sudo ln -s $DOTNET_PATH /usr/bin/dotnet echo "New dotnet path should be $DOTNET_PATH" - - name: Retrieve ReleaseNotes Binaries - uses: actions/download-artifact@v4 - with: - name: release_notes_bins - path: release_notes_bins - - name: Checkout (Branch) uses: actions/checkout@v4 if: github.event_name == 'push' || github.event_name == 'schedule' @@ -1283,6 +1277,12 @@ jobs: - name: Setup Telemetry Key File run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} + - name: Retrieve ReleaseNotes Binaries + uses: actions/download-artifact@v4 + with: + name: release_notes_bins + path: release_notes_bins + - name: Execute Build Script (Unsigned) if: (!(github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master')) env: From 55208b4d2bf2e298eb1e6b9799a8cb84141df182 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Tue, 20 Aug 2024 17:24:25 -0400 Subject: [PATCH 15/15] We only deploy on master --- .github/workflows/ci-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 9e72fb60ca..880b648d5a 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -1236,7 +1236,7 @@ jobs: sudo apt-get install -y -o APT::Immediate-Configure=0 libstdc++6:i386 libgcc-s1:i386 - name: Import GPG Key - if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && (github.event.ref == 'refs/heads/master' || github.event.ref == 'refs/heads/dev')) + if: github.event_name == 'push' && contains(github.event.head_commit.message, '[TGSDeploy]') && github.event.ref == 'refs/heads/master' run: | echo "${{ secrets.PACKAGING_PRIVATE_KEY }}" > private.pgp echo ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }} | gpg --batch --yes --passphrase-fd 0 --import private.pgp