Skip to content

Commit 82dcfe9

Browse files
Merge pull request #64 from Macro-Deck-App/develop
Develop
2 parents 7dcd1f6 + a531341 commit 82dcfe9

File tree

152 files changed

+2537
-2358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+2537
-2358
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./src/ExtensionStoreAPI/Config/config.json
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Base Image Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v3
13+
14+
- name: Login to GitHub Container Registry
15+
uses: docker/login-action@v1
16+
with:
17+
registry: ghcr.io
18+
username: ${{ github.repository_owner }}
19+
password: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Build the Docker image
22+
run: docker build . --file Dockerfile --tag ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
23+
24+
- name: Push Docker image
25+
run: docker push ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
push:
6+
branches:
7+
- '**'
8+
- '!main'
9+
- '!develop'
10+
11+
jobs:
12+
base_image_build:
13+
name: Base image build
14+
uses: ./.github/workflows/base-image-build.yml
15+
if: ${{ github.event_name != 'push' || github.event.pull_request.head.sha != github.sha }}
16+
secrets: inherit
17+
final_image_build:
18+
name: UpdateService image build
19+
uses: ./.github/workflows/final-image-build.yml
20+
needs: [base_image_build]
21+
if: ${{ github.event_name != 'push' || github.event.pull_request.head.sha != github.sha }}
22+
secrets: inherit
23+
unit_tests:
24+
name: Unit Tests
25+
uses: ./.github/workflows/unit-tests.yml
26+
needs: [base_image_build]
27+
if: ${{ github.event_name != 'push' || github.event.pull_request.head.sha != github.sha }}
28+
secrets: inherit
29+
integration_tests:
30+
name: Integration Tests
31+
uses: ./.github/workflows/integration-tests.yml
32+
needs: [base_image_build]
33+
if: ${{ github.event_name != 'push' || github.event.pull_request.head.sha != github.sha }}
34+
secrets: inherit

.github/workflows/deploy-develop.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,30 @@ on:
66
branches: [ "develop" ]
77

88
jobs:
9-
tests:
10-
uses: ./.github/workflows/tests.yml
9+
ci:
10+
uses: ./.github/workflows/ci.yml
1111
name: Build and test
12+
1213
deploy:
1314
name: Build and deploy Docker image
14-
needs: [tests]
15+
needs: [ci]
1516
runs-on: ubuntu-latest
1617
steps:
17-
- uses: actions/checkout@v3
18-
- name: Build the Docker image
19-
run: docker build . --file MacroDeckExtensionStoreAPI/Dockerfile --tag suchbyte/macro-deck-extensionstoreapi:dev_${{ github.sha }}
20-
- name: Log into registry
21-
uses: docker/login-action@40891eba8c2bcd1309b07ba8b11232f313e86779
22-
with:
23-
registry: docker.io
24-
username: suchbyte
25-
password: ${{ secrets.DOCKER_PASSWORD }}
26-
- name: Push the Docker image
27-
run: docker push suchbyte/macro-deck-extensionstoreapi:dev_${{ github.sha }}
2818
- name: Updating the image on the server
29-
uses: appleboy/ssh-action@v0.1.8
19+
uses: appleboy/ssh-action@v0.1.10
3020
with:
3121
host: ${{ secrets.DOCKER_HOST }}
3222
username: ${{ secrets.GITHUBWORKFLOWS_USER }}
3323
password: ${{ secrets.GITHUBWORKFLOWS_USER_PASSWORD }}
3424
port: ${{ secrets.DOCKER_HOST_PORT }}
3525
script: |
36-
cd "scripts/ExtensionStoreAPI/"
37-
./update_develop.sh dev_${{ github.sha }}
26+
cd "scripts/extension-store-api/"
27+
./update_develop.sh ${{ github.sha }}
28+
3829
- uses: fjogeleit/http-request-action@v1
3930
with:
4031
url: 'https://bot.api.macro-deck.app/webhook/extensionstoreapi-workflow'
4132
method: 'POST'
4233
bearerToken: ${{ secrets.WEBHOOK_KEY }}
4334
customHeaders: '{"Content-Type": "application/json" }'
44-
data: '{"toEveryone":false,"embed":{"color":{"r":0,"g":1,"b":0},"description":"https://test.extensionstore.api.macro-deck.app is now on dev_${{ github.sha }}.","fields":[{"name":"Branch","value":"Develop","inline":false},{"name":"SHA","value":"${{ github.sha }}","inline":false}]}}'
45-
35+
data: '{"toEveryone":false,"embed":{"color":{"r":0,"g":1,"b":0},"description":"https://test.extensionstore.api.macro-deck.app is now on dev_${{ github.sha }}.","fields":[{"name":"Branch","value":"Develop","inline":false},{"name":"SHA","value":"${{ github.sha }}","inline":false}]}}'

.github/workflows/deploy-production.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,30 @@ on:
55
types: [published]
66

77
jobs:
8-
tests:
9-
uses: ./.github/workflows/tests.yml
8+
ci:
9+
uses: ./.github/workflows/ci.yml
1010
name: Build and test
11+
1112
deploy:
1213
name: Build and deploy Docker image
13-
needs: [tests]
14+
needs: [ci]
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v3
17-
- uses: kzrnm/get-net-sdk-project-versions-action@v1
18-
id: get-version
19-
with:
20-
proj-path: MacroDeckExtensionStoreAPI/MacroDeckExtensionStoreAPI.csproj
21-
- name: Build the Docker image
22-
run: docker build . --file MacroDeckExtensionStoreAPI/Dockerfile --tag suchbyte/macro-deck-extensionstoreapi:${{steps.get-version.outputs.version}}
23-
- name: Log into registry
24-
uses: docker/login-action@40891eba8c2bcd1309b07ba8b11232f313e86779
25-
with:
26-
registry: docker.io
27-
username: suchbyte
28-
password: ${{ secrets.DOCKER_PASSWORD }}
29-
- name: Push the Docker image
30-
run: docker push suchbyte/macro-deck-extensionstoreapi:${{steps.get-version.outputs.version}}
3117
- name: Updating the image on the server
32-
uses: appleboy/ssh-action@v0.1.8
18+
uses: appleboy/ssh-action@v0.1.10
3319
with:
3420
host: ${{ secrets.DOCKER_HOST }}
3521
username: ${{ secrets.GITHUBWORKFLOWS_USER }}
3622
password: ${{ secrets.GITHUBWORKFLOWS_USER_PASSWORD }}
3723
port: ${{ secrets.DOCKER_HOST_PORT }}
3824
script: |
39-
cd "scripts/ExtensionStoreAPI/"
40-
./update_production.sh ${{steps.get-version.outputs.version}}
25+
cd "scripts/extension-store-api/"
26+
./update_production.sh ${{ github.sha }}
27+
4128
- uses: fjogeleit/http-request-action@v1
4229
with:
4330
url: 'https://bot.api.macro-deck.app/webhook/extensionstoreapi-workflow'
4431
method: 'POST'
4532
bearerToken: ${{ secrets.WEBHOOK_KEY }}
4633
customHeaders: '{"Content-Type": "application/json" }'
47-
data: '{"toEveryone":false,"embed":{"color":{"r":0,"g":1,"b":0},"description":"https://extensionstore.api.macro-deck.app is now on dev_${{ github.sha }}.","fields":[{"name":"Branch","value":"Develop","inline":false},{"name":"SHA","value":"${{ github.sha }}","inline":false}]}}'
48-
34+
data: '{"toEveryone":false,"embed":{"color":{"r":0,"g":1,"b":0},"description":"https://extensionstore.api.macro-deck.app is now on dev_${{ github.sha }}.","fields":[{"name":"Branch","value":"Develop","inline":false},{"name":"SHA","value":"${{ github.sha }}","inline":false}]}}'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Base Image Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v3
13+
14+
- name: Login to GitHub Container Registry
15+
uses: docker/login-action@v1
16+
with:
17+
registry: ghcr.io
18+
username: ${{ github.repository_owner }}
19+
password: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Pull the base image
22+
run: docker pull ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
23+
24+
- name: Build the Docker image
25+
run: docker build ./src/ExtensionStoreAPI --build-arg BASE_IMAGE=ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }} --file ./src/ExtensionStoreAPI/Dockerfile --tag ghcr.io/macro-deck-app/extension-store-api:${{ github.sha }}
26+
27+
- name: Push Docker image
28+
run: docker push ghcr.io/macro-deck-app/extension-store-api:${{ github.sha }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Integration Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
services:
11+
postgres:
12+
image: postgres:15
13+
env:
14+
POSTGRES_USER: extensionstore
15+
POSTGRES_PASSWORD: test
16+
POSTGRES_DB: extensionstoreintegrationtest
17+
ports:
18+
- 5432:5432
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
25+
steps:
26+
- name: Login to GitHub Container Registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.repository_owner }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
#- name: Pull the base image
34+
# run: docker pull ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
35+
36+
#- name: Run Tests inside Docker container
37+
# run: >
38+
# docker run --rm --network="host" --env ASPNETCORE_ENVIRONMENT=GitHubIntegrationTest
39+
# ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
40+
# dotnet test "tests/ExtensionStoreAPI.Tests.IntegrationTests/ExtensionStoreAPI.Tests.IntegrationTests.csproj"

.github/workflows/tests.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Unit Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Login to GitHub Container Registry
12+
uses: docker/login-action@v1
13+
with:
14+
registry: ghcr.io
15+
username: ${{ github.repository_owner }}
16+
password: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Pull the base image
19+
run: docker pull ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
20+
21+
- name: Run Tests inside Docker container
22+
run: >
23+
docker run --rm ghcr.io/macro-deck-app/extension-store-api-base:${{ github.sha }}
24+
dotnet test "tests/ExtensionStoreAPI.Tests.UnitTests/ExtensionStoreAPI.Tests.UnitTests.csproj"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,7 @@ obj/
369369
riderModule.iml
370370
/_ReSharper.Caches/
371371
appsettings.json
372-
appsettings.*.json
372+
appsettings.*.json
373+
storage/
374+
storage/*
375+
/src/ExtensionStoreAPI/storage/

Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
8+
<WarningsAsErrors>CS8602</WarningsAsErrors>
9+
</PropertyGroup>
10+
11+
</Project>

Directory.Packages.props

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="AutoMapper" Version="12.0.1" />
7+
<PackageVersion Include="AutoMapper.EF6" Version="2.1.1" />
8+
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
9+
<PackageVersion Include="Evolve" Version="3.1.0" />
10+
<PackageVersion Include="JetBrains.Annotations" Version="2022.3.1" />
11+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
12+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
13+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="7.0.10" />
14+
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
15+
<PackageVersion Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
16+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
17+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
18+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
19+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.10" />
20+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10" />
21+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
22+
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
23+
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
24+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
25+
<PackageVersion Include="Microsoft.Extensions.Http" Version="7.0.0" />
26+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
27+
<PackageVersion Include="JetBrains.Annotations" Version="2022.3.1" />
28+
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
29+
<PackageVersion Include="SixLabors.ImageSharp" Version="3.0.1" />
30+
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="7.0.10" />
31+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
32+
<PackageVersion Include="NUnit" Version="3.13.3" />
33+
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
34+
<PackageVersion Include="NUnit.Analyzers" Version="3.6.1" />
35+
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
36+
<PackageVersion Include="Moq" Version="4.18.4" />
37+
<PackageVersion Include="Swashbuckle.AspNetCore.Swagger" Version="6.5.0" />
38+
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
39+
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
40+
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
41+
<PackageVersion Include="Serilog" Version="2.12.0" />
42+
<PackageVersion Include="Serilog.AspNetCore" Version="7.0.0" />
43+
<PackageVersion Include="Serilog.Extensions.Hosting" Version="7.0.0" />
44+
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
45+
<PackageVersion Include="Serilog.Extensions.Logging" Version="7.0.0" />
46+
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
47+
</ItemGroup>
48+
</Project>

0 commit comments

Comments
 (0)