Skip to content

Commit

Permalink
chore: Update matrix-config.yml to include database options for MySQL…
Browse files Browse the repository at this point in the history
…, PostgreSQL, and SQLite
  • Loading branch information
timothywarner committed Aug 7, 2024
1 parent 59c201c commit d4c6215
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ai-node-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build and Deploy Node App to Azure

on:
push:
branches: [ "main" ]
workflow_dispatch:

env:
NODE_APP_PATH: './node-app'

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ secrets.NODE_VERSION }}

# Cache Node.js dependencies
- name: Cache Node.js dependencies
id: cache-node-modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ secrets.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ secrets.NODE_VERSION }}-
# Install dependencies
- name: Install dependencies
run: |
npm ci
npm config set cache ~/.npm --global
working-directory: ${{ env.NODE_APP_PATH }}

# Run tests
- name: Run tests
run: npm test
working-directory: ${{ env.NODE_APP_PATH }}

# Build the app
- name: Build app
run: npm run build
working-directory: ${{ env.NODE_APP_PATH }}

# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: node-app-build
path: ${{ env.NODE_APP_PATH }}/dist

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
# Download build artifacts from the build job
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app-build

# Deploy to Azure WebApp
- name: 'Deploy to Azure WebApp'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.NODE_APP_PATH }}

# Print GitHub context
- name: Print GitHub context
run: |
echo "Repository: ${{ github.repository }}"
echo "Ref: ${{ github.ref }}"
echo "SHA: ${{ github.sha }}"
echo "Actor: ${{ github.actor }}"
echo "Event Name: ${{ github.event_name }}"
echo "Workflow: ${{ github.workflow }}"
echo "Run ID: ${{ github.run_id }}"
echo "Run Number: ${{ github.run_number }}"
15 changes: 15 additions & 0 deletions .github/workflows/matrix-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12.x, 14.x, 16.x]
database: [mysql, postgresql, sqlite]

steps:
- name: Checkout repository
Expand All @@ -23,6 +25,19 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Set up database
run: |
if [ "${{ matrix.database }}" == "mysql" ]; then
echo "Setting up MySQL..."
# Add commands to set up MySQL
elif [ "${{ matrix.database }}" == "postgresql" ]; then
echo "Setting up PostgreSQL..."
# Add commands to set up PostgreSQL
elif [ "${{ matrix.database }}" == "sqlite" ]; then
echo "Setting up SQLite..."
# Add commands to set up SQLite
fi
- name: Run tests
run: npm test

Expand Down

0 comments on commit d4c6215

Please sign in to comment.