Skip to content

Latest commit

 

History

History
109 lines (95 loc) · 2.75 KB

CheatSheet.MD

File metadata and controls

109 lines (95 loc) · 2.75 KB

CHEATSHEET

Build and Unit Test

  build_and_test:
    environment: UAT
    name: Build and run Unit Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up JDK 11
        uses: actions/setup-java@v3
        with:
          java-version: '11'
          distribution: 'temurin'
          cache: maven

      - name: Run Unit Tests
        run: mvn test

      - name: Build with Maven
        run: mvn -DskipTests -B package --no-transfer-progress --file ./pom.xml

      - name: rename Artefakt
        run: mv ./target/*digitalbank*.war ./target/digibank.war

      - uses: actions/upload-artifact@master
        with:
          name: digibank.war
          path: ./target/digibank*

Variables

env:
  UAT_IP: '3.16.21.252'
  UAT_TOMCAT: /home/ec2-user/apache-tomcat-9.0.68/webapps
  UAT_PORT: 22

Deploy and Install

### Build STEP ###
      - name: cleanup destination at $UAT_IP
        uses: appleboy/ssh-action@master
        with:
          host: ${{ env.UAT_IP }}
          username: ${{ secrets.USER }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ env.UAT_PORT }}
          script: rm -rf ./deployment/*

      - name: copy file via ssh password
        uses: appleboy/scp-action@master
        with:
          host: ${{ env.UAT_IP }}
          username: ${{ secrets.USER }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ env.UAT_PORT }}
          source: './target/digibank.war'
          target: 'deployment'
          debug: true
### Install STEP ###
install:
    needs: build_and_deploy
    environment: UAT
    name: Install Application
    runs-on: ubuntu-latest

    steps:
      - name: deploy
        uses: appleboy/ssh-action@master
        with:
          host: ${{ env.UAT_IP }}
          username: ${{ secrets.USER }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ env.UAT_PORT }}
          script: cp -f /home/ec2-user/deployment/target/digibank.war ${{ env.UAT_TOMCAT }}

Run Tests

  automation_tests:
    needs: install
    environment: UAT
    name: Trigger E2E Tests on UAT Environment
    runs-on: ubuntu-latest

    steps:
      - name: Trigger Workflow from e2e tests with Playwright
        run: |
          curl -X POST \
          -H "Authorization: Bearer ${{ secrets.PAT }}" \
          -H "Accept: application/vnd.github.v3+json" \
          https://api.github.com/repos/e2e-pipeline-workshop/digibank-playwright-tests/actions/workflows/run-tests.yml/dispatches \
          -d '{"ref":"main","inputs":{"SUT":"http://url:8080/bank/login","environment":"UAT"}}'

  after_test:
    needs: automation_tests
    name: Cleanup Job
    runs-on: ubuntu-latest

    steps:
      - name: just make a list output
        run: ls -la .