Increasing strategy matrix node version #6
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: CI/CD for .NET REST API and Angular Frontend | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: testdb | |
strategy: | |
matrix: | |
dotnet-version: ['8.x'] | |
node-version: ['22.x'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Set up .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Restore .NET dependencies | |
run: dotnet restore ./Server/MotoDev/Src/MotoDev.Api # Specify the folder for the .NET app here | |
- name: Build .NET project | |
run: dotnet build ./Server/MotoDev/Src/MotoDev.Api --no-restore --configuration Release # Specify the folder for the .NET app here | |
- name: Run .NET tests | |
run: dotnet test ./Server/MotoDev/Src/MotoDev.Api --no-build --verbosity normal # Specify the folder for the .NET app here | |
# Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Angular dependencies | |
run: npm install | |
working-directory: ./Client/MotoDev # Specify the folder for the Angular app here | |
# - name: Run Angular tests | |
# run: npm test -- --watch=false --browsers=ChromeHeadless | |
# working-directory: ./Client/MotoDev # Specify the folder for the Angular app here | |
- name: Build Angular project | |
run: npm run build -- --prod | |
working-directory: ./Client/MotoDev # Specify the folder for the Angular app here | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: '8.x' | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22.x' | |
- name: Install dependencies and build Angular project | |
run: | | |
npm install | |
npm run build -- --prod | |
working-directory: ./Client/MotoDev # Specify the folder for the Angular app here | |
- name: Publish .NET API | |
run: | | |
dotnet publish ./Server/MotoDev/Src/MotoDev.Api -c Release -o publish # Specify the folder for the .NET app here | |
# Add your deployment script here (e.g., copy files to a server or upload to a cloud service) |