From 934bc450bcaba9829db0f20cd238c048bd245322 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:01:21 -0400 Subject: [PATCH 01/33] Add github actions workflow for tests --- .github/workflows/ci.yml | 45 +++++++++++++++++++ .../.idea/indexLayout.xml | 1 + 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b56aa462 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +on: [push, pull_request] +name: Continuous Integration + +jobs: + test: + name: Test + runs-on: ${{matrix.os.fullname}} + strategy: + fail-fast: false + matrix: + os: + - { prettyname: Windows, fullname: windows-latest } + - { prettyname: macOS, fullname: macos-latest } + - { prettyname: Linux, fullname: ubuntu-latest } + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install .NET 5.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "5.0.x" + + - name: Install .NET 6.0 Preview + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "6.0.x" + include-prerelease: true + + - name: Compile + run: dotnet build -C Debug + + - name: Test + run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" + + + # Attempt to upload results even if test fails. + # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#always + - name: Upload Test Results + uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}} + path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx diff --git a/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml b/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml index fbf9ad4b..31d1c3be 100644 --- a/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml +++ b/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml @@ -3,6 +3,7 @@ + .github .gitignore .idea DatabaseMigrations From 39869e81563b9e8e907a72c16ea84393fad659b0 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:09:07 -0400 Subject: [PATCH 02/33] Fix CI crash --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b56aa462..539fd9c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ on: [push, pull_request] name: Continuous Integration +# Inspired by osu! lazer's CI +# https://github.com/ppy/osu/blob/e12249f1270a22cf5811a8bb7a9ee44f2c0250db/.github/workflows/ci.yml + jobs: test: name: Test @@ -12,6 +15,9 @@ jobs: - { prettyname: Windows, fullname: windows-latest } - { prettyname: macOS, fullname: macos-latest } - { prettyname: Linux, fullname: ubuntu-latest } + dotnetVersion: + - { prettyname: .NET 6.0 Preview, fullname: 6.0.x } + - { prettyname: .NET 5.0, fullname: 5.0.x } timeout-minutes: 10 steps: - name: Checkout @@ -29,7 +35,7 @@ jobs: include-prerelease: true - name: Compile - run: dotnet build -C Debug + run: dotnet build -c Debug - name: Test run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" @@ -41,5 +47,5 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}} + name: lighthouse-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}} path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx From 134d96f5b3a1121aa0d9733c6698e124f4dc0c2a Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:15:15 -0400 Subject: [PATCH 03/33] Only install 1 version of dotnet per runner --- .github/workflows/ci.yml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 539fd9c0..202fee8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,38 +7,33 @@ name: Continuous Integration jobs: test: name: Test - runs-on: ${{matrix.os.fullname}} + runs-on: ${{matrix.os.fullName}} strategy: fail-fast: false matrix: os: - - { prettyname: Windows, fullname: windows-latest } - - { prettyname: macOS, fullname: macos-latest } - - { prettyname: Linux, fullname: ubuntu-latest } + - { prettyName: Windows, fullName: windows-latest } + - { prettyName: macOS, fullName: macos-latest } + - { prettyName: Linux, fullName: ubuntu-latest } dotnetVersion: - - { prettyname: .NET 6.0 Preview, fullname: 6.0.x } - - { prettyname: .NET 5.0, fullname: 5.0.x } + - { prettyName: .NET 6.0 Preview, fullName: 6.0.x } + - { prettyName: .NET 5.0, fullName: 5.0.x } timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v2 - - name: Install .NET 5.0 + - name: Install ${{matrix.dotnetVersion.prettyName}} uses: actions/setup-dotnet@v1 with: - dotnet-version: "5.0.x" - - - name: Install .NET 6.0 Preview - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "6.0.x" + dotnet-version: "${{matrix.dotnetVersion.fullName}}" include-prerelease: true - name: Compile run: dotnet build -c Debug - name: Test - run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx" + run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyName}}-${{matrix.threadingMode}}.trx" # Attempt to upload results even if test fails. @@ -47,5 +42,5 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: lighthouse-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}} - path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx + name: lighthouse-test-results-${{matrix.os.prettyName}}-dotnet${{matrix.dotnetVersion.fullName}} + path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyName}}-dotnet${{matrix.dotnetVersion.fullName}}trx From 9644b33dea531c5cdaa45f0dcc06586f56c32e7a Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:16:46 -0400 Subject: [PATCH 04/33] Only do linux jobs for now --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 202fee8f..b597d422 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: fail-fast: false matrix: os: - - { prettyName: Windows, fullName: windows-latest } - - { prettyName: macOS, fullName: macos-latest } +# - { prettyName: Windows, fullName: windows-latest } +# - { prettyName: macOS, fullName: macos-latest } - { prettyName: Linux, fullName: ubuntu-latest } dotnetVersion: - { prettyName: .NET 6.0 Preview, fullName: 6.0.x } From eb6f1e336985d7f69a686030023cdcc84ade5e62 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:19:38 -0400 Subject: [PATCH 05/33] Tell runner to only build for a given framework --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b597d422..09fc84d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: # - { prettyName: macOS, fullName: macos-latest } - { prettyName: Linux, fullName: ubuntu-latest } dotnetVersion: - - { prettyName: .NET 6.0 Preview, fullName: 6.0.x } - - { prettyName: .NET 5.0, fullName: 5.0.x } + - { prettyName: .NET 6.0 Preview, fullName: 6.0.x, msbuildName: net6.0 } + - { prettyName: .NET 5.0, fullName: 5.0.x, msbuildName: net5.0 } timeout-minutes: 10 steps: - name: Checkout @@ -30,7 +30,7 @@ jobs: include-prerelease: true - name: Compile - run: dotnet build -c Debug + run: dotnet build -c Debug -f ${{matrix.dotnetVersion.msbuildName}} - name: Test run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyName}}-${{matrix.threadingMode}}.trx" From 92f577538917e7c1ced613988a45ac9f306e8826 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:29:53 -0400 Subject: [PATCH 06/33] Only use one runner for .NET5/6 --- .github/workflows/ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09fc84d4..60c52eab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,25 +15,29 @@ jobs: # - { prettyName: Windows, fullName: windows-latest } # - { prettyName: macOS, fullName: macos-latest } - { prettyName: Linux, fullName: ubuntu-latest } - dotnetVersion: - - { prettyName: .NET 6.0 Preview, fullName: 6.0.x, msbuildName: net6.0 } - - { prettyName: .NET 5.0, fullName: 5.0.x, msbuildName: net5.0 } + timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v2 - - name: Install ${{matrix.dotnetVersion.prettyName}} + - name: Install .NET 5.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: "${{matrix.dotnetVersion.fullName}}" + dotnet-version: "5.0.x" + include-prerelease: true + + - name: Install .NET 6.0 Preview + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "6.0.x" include-prerelease: true - name: Compile - run: dotnet build -c Debug -f ${{matrix.dotnetVersion.msbuildName}} + run: dotnet build -c Debug - name: Test - run: --logger "trx;LogFileName=TestResults-${{matrix.os.prettyName}}-${{matrix.threadingMode}}.trx" + run: dotnet test --logger "trx;LogFileName=TestResults-${{matrix.os.prettyName}}.trx" # Attempt to upload results even if test fails. @@ -42,5 +46,5 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: lighthouse-test-results-${{matrix.os.prettyName}}-dotnet${{matrix.dotnetVersion.fullName}} - path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyName}}-dotnet${{matrix.dotnetVersion.fullName}}trx + name: lighthouse-test-results-${{matrix.os.prettyName}} + path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyName}}.trx From 354abfe79ad7747612098dfaeaa7a1c2a1f228db Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:37:17 -0400 Subject: [PATCH 07/33] Use CreateHostBuilder --- ProjectLighthouse/Program.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs index 3e74c1f7..780dd5de 100644 --- a/ProjectLighthouse/Program.cs +++ b/ProjectLighthouse/Program.cs @@ -11,13 +11,13 @@ namespace ProjectLighthouse { Console.WriteLine("Welcome to Project Lighthouse!"); Console.WriteLine(ServerSettings.DbConnected ? "Connected to the database." : "Database unavailable. Starting in stateless mode."); - IHostBuilder builder = Host.CreateDefaultBuilder(args); - - builder.ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); - }); - - builder.Build().Run(); + CreateHostBuilder(args).Build().Run(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => { + webBuilder.UseStartup(); + }); } } \ No newline at end of file From 7924f374d4a65f9cdb5417c3733f657d691bbce7 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:41:34 -0400 Subject: [PATCH 08/33] Remove Swashbuckle.AspNetCore --- ProjectLighthouse/ProjectLighthouse.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj index 18ab9cbb..96ea7037 100644 --- a/ProjectLighthouse/ProjectLighthouse.csproj +++ b/ProjectLighthouse/ProjectLighthouse.csproj @@ -10,7 +10,6 @@ - From 5d41c408af08147207055e11c139082291d36e9e Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:45:12 -0400 Subject: [PATCH 09/33] Fix test artifact upload --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60c52eab..a8686b2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ name: Continuous Integration jobs: test: - name: Test + name: Build & Test runs-on: ${{matrix.os.fullName}} strategy: fail-fast: false @@ -47,4 +47,4 @@ jobs: if: ${{ always() }} with: name: lighthouse-test-results-${{matrix.os.prettyName}} - path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyName}}.trx + path: ${{github.workspace}}/ProjectLighthouse.Tests/TestResults/TestResults-${{matrix.os.prettyName}}.trx \ No newline at end of file From cddef117076680fbe6d0a6878cc29fd9c89b5104 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:48:51 -0400 Subject: [PATCH 10/33] Add test reporter --- .github/workflows/test-report.yml | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 00000000..e00bc69c --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,32 @@ +# Yoinked from https://github.com/ppy/osu/blob/e12249f1270a22cf5811a8bb7a9ee44f2c0250db/.github/workflows/report-nunit.yml +# This is a workaround to allow PRs to report their coverage. This will run inside the base repository. +# See: +# * https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories +# * https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token +name: Annotate CI run with test results +on: + workflow_run: + workflows: [ "Continuous Integration" ] + types: + - completed +jobs: + annotate: + name: Annotate CI run with test results + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion != 'cancelled' }} + strategy: + fail-fast: false + matrix: + os: + - { prettyname: Windows } + - { prettyname: macOS } + - { prettyname: Linux } + timeout-minutes: 5 + steps: + - name: Annotate CI run with test results + uses: dorny/test-reporter@v1.4.2 + with: + artifact: lighthouse-test-results-${{matrix.os.prettyName}} + name: Test Results (${{matrix.os.prettyname}}) + path: "*.trx" + reporter: dotnet-trx \ No newline at end of file From 49ce55b8b8046feba9c7874fbf22134aa2b17ef7 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:50:58 -0400 Subject: [PATCH 11/33] Revert "Add test reporter" This reverts commit cddef117076680fbe6d0a6878cc29fd9c89b5104. --- .github/workflows/test-report.yml | 32 ------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml deleted file mode 100644 index e00bc69c..00000000 --- a/.github/workflows/test-report.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Yoinked from https://github.com/ppy/osu/blob/e12249f1270a22cf5811a8bb7a9ee44f2c0250db/.github/workflows/report-nunit.yml -# This is a workaround to allow PRs to report their coverage. This will run inside the base repository. -# See: -# * https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories -# * https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token -name: Annotate CI run with test results -on: - workflow_run: - workflows: [ "Continuous Integration" ] - types: - - completed -jobs: - annotate: - name: Annotate CI run with test results - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion != 'cancelled' }} - strategy: - fail-fast: false - matrix: - os: - - { prettyname: Windows } - - { prettyname: macOS } - - { prettyname: Linux } - timeout-minutes: 5 - steps: - - name: Annotate CI run with test results - uses: dorny/test-reporter@v1.4.2 - with: - artifact: lighthouse-test-results-${{matrix.os.prettyName}} - name: Test Results (${{matrix.os.prettyname}}) - path: "*.trx" - reporter: dotnet-trx \ No newline at end of file From 75bd8e6100965f0075519dd4494a1807586bc510 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 20:54:02 -0400 Subject: [PATCH 12/33] Use process-dotnet-test-results --- .github/workflows/ci.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8686b2a..1d0eb654 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,8 @@ jobs: run: dotnet build -c Debug - name: Test - run: dotnet test --logger "trx;LogFileName=TestResults-${{matrix.os.prettyName}}.trx" + continue-on-error: true + run: dotnet test --logger "trx;LogFileName=${{github.workspace}}/TestResults-${{matrix.os.prettyName}}.trx" # Attempt to upload results even if test fails. @@ -47,4 +48,10 @@ jobs: if: ${{ always() }} with: name: lighthouse-test-results-${{matrix.os.prettyName}} - path: ${{github.workspace}}/ProjectLighthouse.Tests/TestResults/TestResults-${{matrix.os.prettyName}}.trx \ No newline at end of file + path: ${{github.workspace}}/TestResults-${{matrix.os.prettyName}}.trx + + - name: Process Test Results + if: ${{ always() }} + uses: im-open/process-dotnet-test-results@v2.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 2af32ea24bb21eeb764bbc0232e2b1e696d7f799 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:01:43 -0400 Subject: [PATCH 13/33] Exit 1 if there are test failures --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d0eb654..f998d35d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,4 +54,10 @@ jobs: if: ${{ always() }} uses: im-open/process-dotnet-test-results@v2.0.0 with: - github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check Test Results + if: steps.process-trx.outputs.test-outcome == 'Failed' + run: | + echo "There were test failures." + exit 1 \ No newline at end of file From 8b91fdaa542f2863b66b402c63e289d4f3405b5d Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:01:54 -0400 Subject: [PATCH 14/33] Build on all platforms --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f998d35d..74f4934b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: fail-fast: false matrix: os: -# - { prettyName: Windows, fullName: windows-latest } -# - { prettyName: macOS, fullName: macos-latest } + - { prettyName: Windows, fullName: windows-latest } + - { prettyName: macOS, fullName: macos-latest } - { prettyName: Linux, fullName: ubuntu-latest } timeout-minutes: 10 From 57661e3b466f96eac0bb770a305c3d5db3b6bce0 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:02:20 -0400 Subject: [PATCH 15/33] fuck YML syntax --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74f4934b..ebcd197b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,8 +56,8 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check Test Results - if: steps.process-trx.outputs.test-outcome == 'Failed' - run: | - echo "There were test failures." - exit 1 \ No newline at end of file + - name: Check Test Results + if: steps.process-trx.outputs.test-outcome == 'Failed' + run: | + echo "There were test failures." + exit 1 \ No newline at end of file From 3264d95564a74b7770a141e159b57a9d2567d1f3 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:20:29 -0400 Subject: [PATCH 16/33] Add MySQL steps --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebcd197b..98e6e2ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,19 @@ jobs: - name: Compile run: dotnet build -c Debug + - name: Make sure the default MySQL service is stopped + run: sudo service mysql stop + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql database: 'lighthouse' + mysql user: 'lighthouse' + mysql password: 'lighthouse' + + - name: Run database migrations + run: mysql -u lighthouse -p lighthouse lighthouse < DatabaseMigrations/*.sql + - name: Test continue-on-error: true run: dotnet test --logger "trx;LogFileName=${{github.workspace}}/TestResults-${{matrix.os.prettyName}}.trx" From 87a294d25474116087a59aeb87c80c66d572f8bf Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:25:46 -0400 Subject: [PATCH 17/33] Fix database migration step, only setup MySQL on Linux --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98e6e2ef..0ca09e91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,9 +37,11 @@ jobs: run: dotnet build -c Debug - name: Make sure the default MySQL service is stopped + if: ${{ matrix.os.prettyName == 'Linux' }} run: sudo service mysql stop - name: Set up MySQL + if: ${{ matrix.os.prettyName == 'Linux' }} uses: mirromutth/mysql-action@v1.1 with: mysql database: 'lighthouse' @@ -47,7 +49,8 @@ jobs: mysql password: 'lighthouse' - name: Run database migrations - run: mysql -u lighthouse -p lighthouse lighthouse < DatabaseMigrations/*.sql + if: ${{ matrix.os.prettyName == 'Linux' }} + run: cat DatabaseMigrations/*.sql | mysql -u lighthouse -p lighthouse lighthouse - name: Test continue-on-error: true From 1f3842095737ab25482e8748a35cf82cca87c164 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:36:37 -0400 Subject: [PATCH 18/33] use a different method of migration --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ca09e91..1d7d48b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run database migrations if: ${{ matrix.os.prettyName == 'Linux' }} - run: cat DatabaseMigrations/*.sql | mysql -u lighthouse -p lighthouse lighthouse + run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigations*.sql) - name: Test continue-on-error: true From 4ae3ecb1fba4114472d26434033c5cd33bd802a3 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:39:31 -0400 Subject: [PATCH 19/33] Fix missing slash --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d7d48b5..77aadc90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,9 @@ jobs: fail-fast: false matrix: os: - - { prettyName: Windows, fullName: windows-latest } - - { prettyName: macOS, fullName: macos-latest } - - { prettyName: Linux, fullName: ubuntu-latest } + - { prettyName: Windows, fullName: windows-latest, database: false } + - { prettyName: macOS, fullName: macos-latest, database: false } + - { prettyName: Linux, fullName: ubuntu-latest, database: true } timeout-minutes: 10 steps: @@ -37,11 +37,11 @@ jobs: run: dotnet build -c Debug - name: Make sure the default MySQL service is stopped - if: ${{ matrix.os.prettyName == 'Linux' }} + if: ${{ matrix.os.database == 'true' }} run: sudo service mysql stop - name: Set up MySQL - if: ${{ matrix.os.prettyName == 'Linux' }} + if: ${{ matrix.os.database == 'true' }} uses: mirromutth/mysql-action@v1.1 with: mysql database: 'lighthouse' @@ -49,8 +49,8 @@ jobs: mysql password: 'lighthouse' - name: Run database migrations - if: ${{ matrix.os.prettyName == 'Linux' }} - run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigations*.sql) + if: ${{ matrix.os.database == 'true' }} + run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigations/*.sql) - name: Test continue-on-error: true From 37b187f41ee8a7e85b1e1f525f6a1f603cf372b6 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:40:48 -0400 Subject: [PATCH 20/33] oops --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77aadc90..b2f8eb16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: mysql password: 'lighthouse' - name: Run database migrations - if: ${{ matrix.os.database == 'true' }} + if: ${{ matrix.os.database }} run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigations/*.sql) - name: Test From 21ef63167cd512bb6bb5a793a1370588ca4f9cb9 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:42:00 -0400 Subject: [PATCH 21/33] WHY CAN I NOT TYPE --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2f8eb16..1b4440f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigations/*.sql) + run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From 7534f5a9110c1c4928e6375aaa77ffa6ecb3fffe Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:44:43 -0400 Subject: [PATCH 22/33] use long argument names --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b4440f4..3c524fe2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql -B -u lighthouse -p lighthouse lighthouse < <(cat DatabaseMigrations/*.sql) + run: mysql --batch --user=lighthouse --password=lighthouse lighthouse < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From 830449e759a869270680f3c9b9baa529f7d29947 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:47:36 -0400 Subject: [PATCH 23/33] Connect to localhost --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c524fe2..c8c3b291 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql --batch --user=lighthouse --password=lighthouse lighthouse < <(cat DatabaseMigrations/*.sql) + run: mysql --batch --user=lighthouse --password=lighthouse --host=localhost lighthouse < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From 4813fc5be064cab2304139152966fde4be262ab3 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:49:33 -0400 Subject: [PATCH 24/33] force TCP --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8c3b291..f5d3bfe9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql --batch --user=lighthouse --password=lighthouse --host=localhost lighthouse < <(cat DatabaseMigrations/*.sql) + run: mysql --batch --user=lighthouse --password=lighthouse --host=127.0.0.1 --protocol=TCP lighthouse < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From b0d1df506dfb345c7e4e2af3241f2af118e0978e Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 21:51:37 -0400 Subject: [PATCH 25/33] Fix database check again --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5d3bfe9..2089adcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,11 @@ jobs: run: dotnet build -c Debug - name: Make sure the default MySQL service is stopped - if: ${{ matrix.os.database == 'true' }} + if: ${{ matrix.os.database }} run: sudo service mysql stop - name: Set up MySQL - if: ${{ matrix.os.database == 'true' }} + if: ${{ matrix.os.database }} uses: mirromutth/mysql-action@v1.1 with: mysql database: 'lighthouse' @@ -49,7 +49,7 @@ jobs: mysql password: 'lighthouse' - name: Run database migrations - if: ${{ matrix.os.database }} + if: ${{ matrix.os.database }} run: mysql --batch --user=lighthouse --password=lighthouse --host=127.0.0.1 --protocol=TCP lighthouse < <(cat DatabaseMigrations/*.sql) - name: Test From 12b917b0a7fa017b5554a2aa0a2f53f393ff18dd Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:02:53 -0400 Subject: [PATCH 26/33] Use native mysql since the docker thing sucks --- .github/workflows/ci.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2089adcb..dfff0063 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,11 @@ jobs: - { prettyName: Windows, fullName: windows-latest, database: false } - { prettyName: macOS, fullName: macos-latest, database: false } - { prettyName: Linux, fullName: ubuntu-latest, database: true } - timeout-minutes: 10 + env: + DB_DATABASE: lighthouse + DB_USER: lighthouse + DB_PASSWORD: lighthouse steps: - name: Checkout uses: actions/checkout@v2 @@ -36,21 +39,15 @@ jobs: - name: Compile run: dotnet build -c Debug - - name: Make sure the default MySQL service is stopped + - name: Start MySQL if: ${{ matrix.os.database }} - run: sudo service mysql stop - - - name: Set up MySQL - if: ${{ matrix.os.database }} - uses: mirromutth/mysql-action@v1.1 - with: - mysql database: 'lighthouse' - mysql user: 'lighthouse' - mysql password: 'lighthouse' - + run: | + sudo service mysql start + mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} + - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql --batch --user=lighthouse --password=lighthouse --host=127.0.0.1 --protocol=TCP lighthouse < <(cat DatabaseMigrations/*.sql) + run: mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From f86582e393763fabd04361bea19783cc73decbd9 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:09:29 -0400 Subject: [PATCH 27/33] Use actions-setup-mysql for MySQL --- .github/workflows/ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfff0063..358598be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ name: Continuous Integration jobs: test: name: Build & Test + if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ${{matrix.os.fullName}} strategy: fail-fast: false @@ -21,6 +22,11 @@ jobs: DB_USER: lighthouse DB_PASSWORD: lighthouse steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - name: Checkout uses: actions/checkout@v2 @@ -40,14 +46,17 @@ jobs: run: dotnet build -c Debug - name: Start MySQL - if: ${{ matrix.os.database }} - run: | - sudo service mysql start - mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} - + uses: shogo82148/actions-setup-mysql@v1 + with: + user: ${{ env.DB_USER }} + password: ${{ env.DB_PASSWORD }} + mysql-version: '8.0' + - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) + run: | + mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} + mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From 470ea2db7f7c06949b086f348422887621aba611 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:13:04 -0400 Subject: [PATCH 28/33] Force TCP again --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 358598be..64e5ecfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,8 +55,8 @@ jobs: - name: Run database migrations if: ${{ matrix.os.database }} run: | - mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} - mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) + mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -h127.0.0.1 + mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -h127.0.0.1 ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true From d4e9fec9931ffd7eeadbf274ce2652b1d88ddf8d Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:19:43 -0400 Subject: [PATCH 29/33] Use root account for MySQL stuff --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64e5ecfa..9a1a95a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 env: DB_DATABASE: lighthouse - DB_USER: lighthouse + DB_USER: root DB_PASSWORD: lighthouse steps: - name: Cancel previous runs of this workflow @@ -51,6 +51,7 @@ jobs: user: ${{ env.DB_USER }} password: ${{ env.DB_PASSWORD }} mysql-version: '8.0' + root-password: ${{ env.DB_PASSWORD }} - name: Run database migrations if: ${{ matrix.os.database }} From f8be5f9b9bf7c9c4420fc3e77c9e926909d99969 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:21:40 -0400 Subject: [PATCH 30/33] Don't attempt to create root user --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a1a95a1..90ef7a53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,8 +48,6 @@ jobs: - name: Start MySQL uses: shogo82148/actions-setup-mysql@v1 with: - user: ${{ env.DB_USER }} - password: ${{ env.DB_PASSWORD }} mysql-version: '8.0' root-password: ${{ env.DB_PASSWORD }} From ecbb0c59e18a1ebfd145fafb092c58b58ebe0f00 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:24:42 -0400 Subject: [PATCH 31/33] Enable MySQL on Mac and Windows --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90ef7a53..5d090a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: fail-fast: false matrix: os: - - { prettyName: Windows, fullName: windows-latest, database: false } - - { prettyName: macOS, fullName: macos-latest, database: false } + - { prettyName: Windows, fullName: windows-latest, database: true } + - { prettyName: macOS, fullName: macos-latest, database: true } - { prettyName: Linux, fullName: ubuntu-latest, database: true } timeout-minutes: 10 env: From 1a69ea9610041c445c5fede263edd6bd518d1d31 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:25:09 -0400 Subject: [PATCH 32/33] Fix Start MySQL not checking matrix.os.database --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d090a0b..019b4874 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: run: dotnet build -c Debug - name: Start MySQL + if: ${{ matrix.os.database }} uses: shogo82148/actions-setup-mysql@v1 with: mysql-version: '8.0' From c52623d743800061363c2d383e63388efa8b9553 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:29:31 -0400 Subject: [PATCH 33/33] Disable database on windows --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 019b4874..f9533663 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: - - { prettyName: Windows, fullName: windows-latest, database: true } + - { prettyName: Windows, fullName: windows-latest, database: false } - { prettyName: macOS, fullName: macos-latest, database: true } - { prettyName: Linux, fullName: ubuntu-latest, database: true } timeout-minutes: 10