Merge pull request #67 from shalak/patch-1 #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_call: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Copy appsettings.json -> appsettings.Development.json | |
run: cp "./backend/appsettings.json" "./backend/appsettings.Development.json" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
working-directory: ./backend | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
working-directory: ./backend | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: backend | |
path: backend/bin/Release/net7.0 | |
test-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Copy appsettings.json -> appsettings.Development.json | |
run: cp "./backend/appsettings.json" "./backend/appsettings.Development.json" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
working-directory: ./backend.unittests | |
- name: Build test | |
run: dotnet build --no-restore --configuration Release | |
working-directory: ./backend.unittests | |
- name: Test | |
run: dotnet test --no-build --verbosity normal --configuration Release | |
working-directory: ./backend.unittests | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Build | |
working-directory: ./frontend | |
run: | | |
npm install | |
npx webpack --config ./webpack.production.config.js | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend | |
path: frontend/dist.production | |
combine-artifacts: | |
needs: [build-backend, build-frontend] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: frontend | |
path: frontend/dist.production | |
- uses: actions/download-artifact@v3 | |
with: | |
name: backend | |
path: backend/bin/Release/net7.0 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dockerfile | |
path: | | |
frontend/dist.production | |
backend/bin/Release/net7.0 | |
Dockerfile |