refactor(svcs): ♻️ prepare for initial aspire->main merge

This commit is contained in:
Collin Barrett 2024-06-13 14:15:13 -05:00
parent 05da0f26cf
commit fa0602a37b
9 changed files with 18 additions and 135 deletions

17
.github/README.md vendored
View file

@ -6,19 +6,6 @@
<a href="https://madewithreactjs.com/p/filterlists/shield-link"><img alt="MadeWithReactJS.com" src="https://madewithreactjs.com/storage/repo-shields/2335-shield.svg"/></a>
<br/>FilterLists is the independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances.</p>
# 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 `<password>` with a custom password:

View file

@ -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:

View file

@ -4,7 +4,6 @@ on:
pull_request:
branches:
- main
- aspire # TODO: rm after testing passes
paths:
- .github/workflows/directory-migrate.yml
- services/Directory/data/**

View file

@ -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: >

View file

@ -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

View file

@ -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);

View file

@ -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<FilterLists_AppHost>();
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);
}
}

View file

@ -1,29 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="8.0.1"/>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FilterLists.AppHost\FilterLists.AppHost.csproj"/>
</ItemGroup>
<ItemGroup>
<Using Include="Aspire.Hosting.Testing"/>
<Using Include="Xunit"/>
</ItemGroup>
</Project>

View file

@ -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