From fa0602a37b38b235f6122e6f4a96538e4f2d9089 Mon Sep 17 00:00:00 2001 From: Collin Barrett Date: Thu, 13 Jun 2024 14:15:13 -0500 Subject: [PATCH] =?UTF-8?q?refactor(svcs):=20=E2=99=BB=EF=B8=8F=20prepare?= =?UTF-8?q?=20for=20initial=20aspire->main=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/README.md | 17 ---------- .github/dependabot.yml | 22 ------------ .github/workflows/directory-migrate.yml | 1 - .github/workflows/directory.yml | 34 +++++-------------- .github/workflows/web.yml | 19 +++++------ .../FilterLists.Directory.Api/Program.cs | 2 +- .../FilterLists.Tests/DirectoryApiTests.cs | 23 ------------- .../FilterLists.Tests.csproj | 29 ---------------- services/FilterLists.sln | 6 ---- 9 files changed, 18 insertions(+), 135 deletions(-) delete mode 100644 services/FilterLists.Tests/DirectoryApiTests.cs delete mode 100644 services/FilterLists.Tests/FilterLists.Tests.csproj diff --git a/.github/README.md b/.github/README.md index 373b185aa..f3c172679 100644 --- a/.github/README.md +++ b/.github/README.md @@ -6,19 +6,6 @@ MadeWithReactJS.com
FilterLists is the independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances.

-# Table of Contents - -- [Background](#background) -- [Services](#services) -- [Contributing](#contributing) - - [Adding or Updating Lists](#adding-or-updating-lists) - - [Adding or Updating Rules](#adding-or-updating-rules) - - [Building and Running Locally](#building-and-running-locally) -- [Acknowledgements](#acknowledgements) -- [Miscellany](#miscellany) - - [Disclaimer](#disclaimer) - - [Privacy](#privacy) - # Background FilterLists helps to protect your privacy and security when using the internet. It provides a comprehensive directory of subscription lists to block advertisements, malware, trackers, and other general annoyances. First, install one of the software tools that supports these lists. Then you can subscribe to a set of these lists inside of that software. If you need help or have a comment/question, start a [Discussion](https://github.com/collinbarrett/FilterLists/discussions). @@ -56,10 +43,6 @@ FilterLists is build on the .NET Aspire stack. Install the [.NET Aspire prerequi ### Directory API -#### Configure Azure Resources - -Local debugging depends on an Azure Application Insights resource. Either [configure a connection to your Azure subscription](https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/local-provisioning#configuration) or comment out the `appInsights` resource in `services/FilterLists.AppHost/Program.cs`. - #### Prepare Database Volume So that the database does not need to be re-seeded on every startup, the SQL Server container is configured with a volume mount. Create a persistent password in order for this to be accessed by executing the command below in `services/FilterLists.AppHost` replacing `` with a custom password: diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f79a99088..a24e3a34f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,31 +1,9 @@ version: 2 updates: - - package-ecosystem: docker - directory: /services/Directory/FilterLists.Directory.Api - schedule: - interval: daily - - package-ecosystem: nuget - directory: services/Directory/FilterLists.Directory.Api - schedule: - interval: daily - - package-ecosystem: nuget - directory: services/Directory/FilterLists.Directory.Infrastructure.Migrations.Tests - schedule: - interval: daily - package-ecosystem: nuget directory: services/FilterLists.AppHost schedule: interval: daily - target-branch: aspire # TODO: rm when merging aspire to main - - package-ecosystem: nuget - directory: services/FilterLists.Tests - schedule: - interval: daily - target-branch: aspire # TODO: rm when merging aspire to main - - package-ecosystem: docker - directory: /web - schedule: - interval: daily - package-ecosystem: npm directory: /web schedule: diff --git a/.github/workflows/directory-migrate.yml b/.github/workflows/directory-migrate.yml index 749a005c4..65a7985c7 100644 --- a/.github/workflows/directory-migrate.yml +++ b/.github/workflows/directory-migrate.yml @@ -4,7 +4,6 @@ on: pull_request: branches: - main - - aspire # TODO: rm after testing passes paths: - .github/workflows/directory-migrate.yml - services/Directory/data/** diff --git a/.github/workflows/directory.yml b/.github/workflows/directory.yml index da6cb8487..ca05d315b 100644 --- a/.github/workflows/directory.yml +++ b/.github/workflows/directory.yml @@ -4,19 +4,17 @@ on: push: branches: - main - - aspire # TODO: rm when merging aspire to main paths: - .github/workflows/directory.yml - services/Directory/** - services/FilterLists.ServiceDefaults/** - # TODO: uncomment when merging aspire to main - # pull_request: - # branches: - # - main - # paths: - # - .github/workflows/directory.yml - # - services/Directory/** - # - services/FilterLists.ServiceDefaults/** + pull_request: + branches: + - main + paths: + - .github/workflows/directory.yml + - services/Directory/** + - services/FilterLists.ServiceDefaults/** env: CONTAINER_REGISTRY: ghcr.io @@ -33,7 +31,7 @@ jobs: packages: write env: - CONTAINER_IMAGE_TAG_STABLE: latest-aspire # TODO: drop '-aspire' when merging aspire to main + CONTAINER_IMAGE_TAG_STABLE: latest steps: - name: Checkout @@ -50,22 +48,6 @@ jobs: run: dotnet build -c Release working-directory: ./services/Directory/FilterLists.Directory.Api - # TODO: get test passing - # - name: Install Aspire Workload - # run: | - # dotnet workload update - # dotnet workload install aspire - - # - name: Test - # run: dotnet test -c Release --logger trx - # working-directory: ./services/FilterLists.Tests - - # - name: Upload Test Results - # if: ${{ always() }} - # uses: actions/upload-artifact@v4 - # with: - # path: ./services/FilterLists.Tests/TestResults - - name: Publish & Push if: github.event_name == 'push' run: > diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index ee4c4df40..6b5f1e788 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -4,18 +4,16 @@ on: push: branches: - main - - aspire # TODO: rm when merging aspire to main paths: - .github/workflows/web.yml - web/** - # TODO: uncomment when merging aspire to main - # pull_request: - # types: [opened, synchronize, reopened, closed] - # branches: - # - main - # paths: - # - .github/workflows/web.yml - # - web/** + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - main + paths: + - .github/workflows/web.yml + - web/** jobs: build_and_deploy_job: @@ -25,9 +23,10 @@ jobs: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + # TODO: revise environment for stapp staging sites environment: name: production-web - url: https://aspire.filterlists.com # TODO: change to root when merging aspire to main + url: https://filterlists.com steps: - name: Checkout diff --git a/services/Directory/FilterLists.Directory.Api/Program.cs b/services/Directory/FilterLists.Directory.Api/Program.cs index 0f7bbdb00..83b164749 100644 --- a/services/Directory/FilterLists.Directory.Api/Program.cs +++ b/services/Directory/FilterLists.Directory.Api/Program.cs @@ -5,7 +5,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddCors(options => options.AddDefaultPolicy(policy => - policy.WithOrigins("https://filterlists.com", "https://aspire.filterlists.com") // TODO: rm 'aspire.' when merging aspire to main + policy.WithOrigins("https://filterlists.com") .WithMethods("GET") .AllowAnyHeader())); builder.WebHost.ConfigureKestrel(serverOptions => serverOptions.AddServerHeader = false); diff --git a/services/FilterLists.Tests/DirectoryApiTests.cs b/services/FilterLists.Tests/DirectoryApiTests.cs deleted file mode 100644 index a10e6e6c4..000000000 --- a/services/FilterLists.Tests/DirectoryApiTests.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Net; -using Projects; - -namespace FilterLists.Tests; - -public sealed class DirectoryApiTests -{ - [Fact] - public async Task GetDirectoryApiAliveReturnsOkStatusCode() - { - // Arrange - var appHost = await DistributedApplicationTestingBuilder.CreateAsync(); - await using var app = await appHost.BuildAsync(); - await app.StartAsync(); - - // Act - var httpClient = app.CreateHttpClient("directoryapi"); - var response = await httpClient.GetAsync("/alive"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - } -} \ No newline at end of file diff --git a/services/FilterLists.Tests/FilterLists.Tests.csproj b/services/FilterLists.Tests/FilterLists.Tests.csproj deleted file mode 100644 index 0c680a658..000000000 --- a/services/FilterLists.Tests/FilterLists.Tests.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - net8.0 - enable - enable - false - true - Recommended - - - - - - - - - - - - - - - - - - - - diff --git a/services/FilterLists.sln b/services/FilterLists.sln index f63196781..104657dca 100644 --- a/services/FilterLists.sln +++ b/services/FilterLists.sln @@ -8,8 +8,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.ServiceDefaults EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Directory.Api", "Directory\FilterLists.Directory.Api\FilterLists.Directory.Api.csproj", "{85A14D07-5C37-458A-B74B-4EE67BBA7102}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Tests", "FilterLists.Tests\FilterLists.Tests.csproj", "{063F0781-ECBC-4254-AF2F-1B75C6CC03B4}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Directory", "Directory", "{C4F6197D-9546-480E-AE92-1FC264D8E88F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilterLists.Directory.Infrastructure.Migrations", "Directory\FilterLists.Directory.Infrastructure.Migrations\FilterLists.Directory.Infrastructure.Migrations.csproj", "{37170729-4BC9-412F-9ADF-97592A677E90}" @@ -36,10 +34,6 @@ Global {85A14D07-5C37-458A-B74B-4EE67BBA7102}.Debug|Any CPU.Build.0 = Debug|Any CPU {85A14D07-5C37-458A-B74B-4EE67BBA7102}.Release|Any CPU.ActiveCfg = Release|Any CPU {85A14D07-5C37-458A-B74B-4EE67BBA7102}.Release|Any CPU.Build.0 = Release|Any CPU - {063F0781-ECBC-4254-AF2F-1B75C6CC03B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {063F0781-ECBC-4254-AF2F-1B75C6CC03B4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {063F0781-ECBC-4254-AF2F-1B75C6CC03B4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {063F0781-ECBC-4254-AF2F-1B75C6CC03B4}.Release|Any CPU.Build.0 = Release|Any CPU {37170729-4BC9-412F-9ADF-97592A677E90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {37170729-4BC9-412F-9ADF-97592A677E90}.Debug|Any CPU.Build.0 = Debug|Any CPU {37170729-4BC9-412F-9ADF-97592A677E90}.Release|Any CPU.ActiveCfg = Release|Any CPU