Zmodyfikowano plik ci.yml dla macierzy i artefaktów
All checks were successful
First CI / build (linux-x64) (push) Successful in 1m37s
First CI / build (win-x64) (push) Successful in 1m37s

This commit is contained in:
Aleksandra Olejarz 2024-11-26 14:15:20 +01:00
parent e3ca61ebe5
commit 0114419526

View File

@ -3,26 +3,29 @@ on: [push]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
rid: ["win-x64", "linux-x64"] # Macierz dla dwóch platform
steps: steps:
# Pobierz kod źródłowy z repozytorium
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# Skonfiguruj .NET SDK w wersji 8.0.x
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '8.0.x' dotnet-version: '8.0.x'
# Przywróć zależności
- run: dotnet restore - run: dotnet restore
- run: dotnet build
- run: dotnet test # Kompiluj i publikuj aplikację dla odpowiedniej platformy
- run: dotnet publish -o app -r linux-x64 --sc /p:PublishSingleFile=true,AssemblyName=app - run: dotnet publish -o app-${{ matrix.rid }} -r ${{ matrix.rid }} --sc /p:PublishSingleFile=true
- run: tar cf app.tar app/
# Archiwizuj wyniki kompilacji do pliku .tar
- run: tar -cvf app-${{ matrix.rid }}.tar app-${{ matrix.rid }}
# Wyślij artefakty do systemu CI
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: app.tar name: app-${{ matrix.rid }}
path: app.tar path: app-${{ matrix.rid }}.tar
test:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: app.tar
- run: tar xf app.tar
- run: ./app/app