Merge pull request 'add ci/cd actions workflow' (#1) from development into main
Reviewed-on: #1
This commit is contained in:
commit
15b128c28b
120
.github/workflows/ci-cd.yml
vendored
Normal file
120
.github/workflows/ci-cd.yml
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
---
|
||||
|
||||
on: push
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
test_artifacts_name: test_artifacts
|
||||
application_artifacts_name: application_artifacts
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
build_artifacts_path: ${{github.workspace}}/build
|
||||
test_artifacts_path: ${{env.build_artifacts_path}}/tests
|
||||
application_artifacts_path: ${{env.build_artifacts_path}}/application
|
||||
NUGET_PACKAGES: ${{github.workspace}}/.nuget/packages
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup dotnet environment
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: global.json
|
||||
cache: true
|
||||
cache-dependency-path: |
|
||||
src/Application/packages.lock.json
|
||||
src/Identity/packages.lock.json
|
||||
src/Infrastructure/packages.lock.json
|
||||
src/Persistence/packages.lock.json
|
||||
src/Configuration/packages.lock.json
|
||||
src/HttpApi/packages.lock.json
|
||||
tst/Application.IntegrationTests/packages.lock.json
|
||||
- name: Download package dependencies
|
||||
run: dotnet restore .
|
||||
- name: Build Application.IntegrationTests
|
||||
run: >
|
||||
dotnet publish ./tst/Application.IntegrationTests
|
||||
--output ${test_artifacts_path} --configuration Release
|
||||
--self-contained --use-current-runtime
|
||||
-p:PublishSingleFile=true -p:PublishSingleFile=true
|
||||
- name: Clean test artifacts directory
|
||||
run: >
|
||||
find ${test_artifacts_path} -type f -print0 |
|
||||
perl -0ne 'print if /.*(pdb|dll|txt|json|targets|props)/s' |
|
||||
xargs -r0 rm -Rf;
|
||||
find ${test_artifacts_path} -mindepth 1 -type d -print0 |
|
||||
xargs -r0 rm -Rf
|
||||
- name: Upload test artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{env.test_artifacts_name}}
|
||||
path: ${{env.test_artifacts_path}}
|
||||
- name: Build HttpApi project
|
||||
run: >
|
||||
dotnet publish ./src/HttpApi --output ${application_artifacts_path}
|
||||
--configuration Release -p:PublishSingleFile=true
|
||||
--self-contained --use-current-runtime
|
||||
-p:PublishSingleFile=true -p:PublishSingleFile=true
|
||||
- name: Clean application artifacts directory
|
||||
run: >
|
||||
find ${application_artifacts_path} -type f -print0 |
|
||||
perl -0ne 'print if /.*(\.pdb|\.dll|\.so)/s' |
|
||||
xargs -r0 rm -Rf;
|
||||
find ${application_artifacts_path} -mindepth 1 -type d -print0 |
|
||||
xargs -r0 rm -Rf
|
||||
- name: Upload application artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{env.application_artifacts_name}}
|
||||
path: ${{env.application_artifacts_path}}
|
||||
|
||||
tests:
|
||||
needs: build
|
||||
env:
|
||||
artifacts_path: ./artifacts
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{env.test_artifacts_name}}
|
||||
path: ${{env.artifacts_path}}
|
||||
- name: Make Application.IntegrationTests executalbe
|
||||
run: chmod u+x ${artifacts_path}/Application.IntegrationTests
|
||||
- name: Run Application.IntegrationTests
|
||||
run: ${artifacts_path}/Application.IntegrationTests
|
||||
|
||||
build-docker:
|
||||
needs: tests
|
||||
env:
|
||||
registry: gitea.cuqmbr.xyz
|
||||
steps:
|
||||
- name: Login to Docker Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.registry}}
|
||||
username: ${{vars.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_TOKEN}}
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
# TODO: split tag names into multiple lines
|
||||
tags: |
|
||||
${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:${{github.sha}}
|
||||
${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:latest
|
||||
#
|
||||
# deploy:
|
||||
# needs: build-docker
|
||||
# steps:
|
||||
# - name: Checkout infrastructure repository
|
||||
# - name: Run ansible deployment playbook
|
||||
# # Use ${{github.sha}} when specifying image to deploy
|
@ -59,6 +59,12 @@
|
||||
"Microsoft.Extensions.Options": "9.0.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"System.Linq.Dynamic.Core": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.6.2, )",
|
||||
@ -173,6 +179,7 @@
|
||||
"domain": {
|
||||
"type": "Project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {}
|
||||
}
|
||||
}
|
@ -150,6 +150,12 @@
|
||||
"Microsoft.Extensions.Primitives": "9.0.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"System.Text.Json": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.4, )",
|
||||
@ -846,6 +852,46 @@
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "[9.0.4, )"
|
||||
}
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {
|
||||
"Microsoft.Win32.Registry": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "+FWlwd//+Tt56316p00hVePBCouXyEzT86Jb3+AuRotTND0IYn0OO3obs1gnQEs/txEnt+rF2JBGLItTG+Be6A==",
|
||||
"dependencies": {
|
||||
"System.Security.AccessControl": "4.5.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"SQLitePCLRaw.lib.e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.1.10",
|
||||
"contentHash": "mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA=="
|
||||
},
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.0.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Cryptography.Pkcs": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.1",
|
||||
"contentHash": "CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA=="
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
|
||||
},
|
||||
"System.Text.Encodings.Web": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -62,6 +62,12 @@
|
||||
"Microsoft.IdentityModel.Logging": "8.8.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.4, )",
|
||||
@ -595,6 +601,41 @@
|
||||
"domain": {
|
||||
"type": "Project"
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {
|
||||
"Microsoft.Win32.Registry": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "+FWlwd//+Tt56316p00hVePBCouXyEzT86Jb3+AuRotTND0IYn0OO3obs1gnQEs/txEnt+rF2JBGLItTG+Be6A==",
|
||||
"dependencies": {
|
||||
"System.Security.AccessControl": "4.5.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.0.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Cryptography.Pkcs": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.1",
|
||||
"contentHash": "CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA=="
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
|
||||
},
|
||||
"System.Text.Encodings.Web": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,12 @@
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net9.0": {
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"AspNetCore.Localizer.Json": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1",
|
||||
@ -179,6 +185,7 @@
|
||||
"domain": {
|
||||
"type": "Project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {}
|
||||
}
|
||||
}
|
@ -51,6 +51,12 @@
|
||||
"Microsoft.Extensions.Primitives": "9.0.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.4, )",
|
||||
@ -335,6 +341,13 @@
|
||||
"domain": {
|
||||
"type": "Project"
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {
|
||||
"SQLitePCLRaw.lib.e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.1.10",
|
||||
"contentHash": "mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -36,4 +36,8 @@
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -11,6 +11,12 @@
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.ILLink.Tasks": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.3, )",
|
||||
"resolved": "9.0.3",
|
||||
"contentHash": "1rqGTfubVg0qj2PsK6esyq3PIxtYJYrN3LsYUV9RrvH3anmt3fT3ozYdAZZH4U8JU/pt5pPIUk8NBSu26wtekA=="
|
||||
},
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.13.0, )",
|
||||
@ -1019,6 +1025,51 @@
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "[9.0.4, )"
|
||||
}
|
||||
}
|
||||
},
|
||||
"net9.0/linux-x64": {
|
||||
"Microsoft.Win32.Registry": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "+FWlwd//+Tt56316p00hVePBCouXyEzT86Jb3+AuRotTND0IYn0OO3obs1gnQEs/txEnt+rF2JBGLItTG+Be6A==",
|
||||
"dependencies": {
|
||||
"System.Security.AccessControl": "4.5.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"SQLitePCLRaw.lib.e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.1.10",
|
||||
"contentHash": "mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA=="
|
||||
},
|
||||
"System.Diagnostics.EventLog": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
"contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw=="
|
||||
},
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.0.0",
|
||||
"System.Security.Principal.Windows": "4.5.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Cryptography.Pkcs": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.1",
|
||||
"contentHash": "CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA=="
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
|
||||
},
|
||||
"System.Text.Encodings.Web": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user