diff --git a/.github/workflows/mandatory-tests.yml b/.github/workflows/mandatory-tests.yml index 253abb1b5..7ca9ff81c 100644 --- a/.github/workflows/mandatory-tests.yml +++ b/.github/workflows/mandatory-tests.yml @@ -1,11 +1,157 @@ -name: Run mandatory tests -on: pull_request +# Step 6 Github Secrets +name: CI/CD Pipeline + +on: [push] + jobs: - build: + test: runs-on: ubuntu-latest + env: + NODE_ENV: test steps: - - uses: actions/checkout@v2 - - name: Install modules - run: npm install - - name: Run mandatory tests - run: npm test -- --selectProjects mandatory + - name: Checkout code + uses: actions/checkout@v3 + - name: Install Dependencies + run: npm install + - name: Run tests + run: npm test + + deploy: + needs: test + runs-on: ubuntu-latest + env: + NODE_ENV: production + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Deploy + env: + API_KEY: ${{ secrets.API_KEY }} # Access the secret here + run: | + # Use the API_KEY secret in your deployment script + echo "Deploying with API key: $API_KEY" + # Replace the following line with your actual deployment command + # For example: npm deploy + echo "Deployment command here" + + +# Step 5 Github Environment Variables +# name: CI/CD Pipeline + +# on: +# push: + +# jobs: +# test: +# runs-on: ubuntu-latest +# env: +# NODE_ENV: test +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Install Dependencies +# run: npm install +# - name: Run tests +# run: npm test + +# deploy: +# needs: test +# runs-on: ubuntu-latest +# env: +# NODE_ENV: production +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Deploy +# run: npm deploy + +# Step 4 Creating a Workflow with Multiple Jobs +# name: CI/CD Pipeline + +# on: [push] + +# jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Install Dependencies +# run: npm install +# - name: Run tests +# run: npm test + +# deploy: +# needs: test +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Deploy +# run: npm deploy + +# Step 3 Adding Deployment Stages +# name: CI/CD + +# on: +# push: + +# jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Install Dependencies +# run: npm install +# - name: Run tests +# run: npm test + +# deploy: +# runs-on: ubuntu-latest +# steps: +# - name: Deploy +# run: npm deploy + +# Step 2 Adding Testing Stages +# name: CI + +# on: [push] + +# jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# - name: Install Dependencies +# run: npm install +# - name: Run tests +# run: npm test + + +# Step 1 Setting up a Simple Workflow +# name: CI + +# on: [push] + +# jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 + +# Original code +# name: Run mandatory tests +# on: pull_request +# jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: Install modules +# run: npm install +# - name: Run mandatory tests +# run: npm test -- --selectProjects mandatory +