Просмотр исходного кода

remove old app test workflow; add new one (#4377)

d-g-town 2 лет назад
Родитель
Сommit
459df01fa8
2 измененных файлов с 42 добавлено и 107 удалено
  1. 0 107
      .github/workflows/dev_cli.yml
  2. 42 0
      .github/workflows/internal-tools-app-tests.yml

+ 0 - 107
.github/workflows/dev_cli.yml

@@ -1,107 +0,0 @@
-on:
-  workflow_run:
-    workflows: ["Deploy Porter to Internal Tooling"]
-    branches: [master]
-    types: 
-      - completed
-name: Release dev cli and run integration tests
-jobs:
-  build-linux:
-    name: Build Linux binaries
-    runs-on: ubuntu-latest
-    if: ${{ github.event.workflow_run.conclusion == 'success' }}
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v3
-      - name: Set up Go
-        uses: actions/setup-go@v4
-        with:
-          cache: false
-          go-version: '1.20.5'
-          go-version-file: go.mod
-      - name: Build Linux binaries
-        run: |
-          go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd/config.Version=dev_${{ github.sha }}' -X 'github.com/porter-dev/porter/cli/cmd/errors.SentryDSN=${{secrets.SENTRY_DSN}}'" -a -tags cli -o ./porter ./cli &
-          wait
-        env:
-          GOOS: linux
-          GOARCH: amd64
-          CGO_ENABLED: 0
-      - name: Zip Linux binaries
-        run: |
-          mkdir -p ./release/linux
-          zip --junk-paths ./release/linux/porter_dev_${{ github.sha }}_Linux_x86_64.zip ./porter
-      - name: Upload binaries
-        uses: actions/upload-artifact@v3
-        with:
-          path: ./release/linux
-          name: linux-binaries
-          retention-days: 1
-  release:
-    name: Zip binaries, create release and upload assets
-    runs-on: ubuntu-latest
-    needs:
-      - build-linux
-    steps:
-      - name: Download binaries
-        uses: actions/download-artifact@v3
-        with:
-          name: linux-binaries
-          path: release/linux
-      - name: Create Release
-        id: create_release
-        uses: softprops/action-gh-release@v1
-        with:
-          tag_name: dev_${{ github.sha }}
-          name: Release dev cli for ${{ github.sha }}
-          token: ${{ secrets.GITHUB_TOKEN }}
-          draft: false
-          prerelease: true
-      - name: Upload Linux CLI Release Asset
-        id: upload-linux-cli-release-asset
-        uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          GITHUB_TAG: dev_${{ github.sha }}
-        with:
-          upload_url: ${{ steps.create_release.outputs.upload_url }}
-          asset_path: ./release/linux/porter_dev_${{ github.sha }}_Linux_x86_64.zip
-          asset_name: porter_dev_${{ github.sha }}_Linux_x86_64.zip
-          asset_content_type: application/zip
-  build-push-docker-cli:
-    name: Build a new porter-cli docker image and push to dev tag
-    runs-on: ubuntu-latest
-    needs: release
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v3
-      - name: Login to GHCR
-        id: login-ghcr
-        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
-      - name: Build
-        run: |
-          docker build ./services/porter_cli_container \
-            -t ghcr.io/porter-dev/porter/porter-cli:dev \
-            -f ./services/porter_cli_container/Dockerfile \
-            --build-arg VERSION=dev \
-            --build-arg SENTRY_DSN=${{secrets.SENTRY_DSN}}
-      - name: Push to GHCR
-        run: |
-          docker tag ghcr.io/porter-dev/porter/porter-cli:dev ghcr.io/porter-dev/porter/porter-cli:dev
-          docker push ghcr.io/porter-dev/porter/porter-cli:dev
-  run-integration-tests:
-    name: run integration tests to test new build
-    runs-on: ubuntu-latest
-    needs: build-push-docker-cli
-    steps:   
-    - name: Porter app run
-      uses: porter-dev/porter-cli-action@v0.1.0
-      with:
-        command: app run app-integration-tests --job trigger
-      env:
-        PORTER_CLUSTER: "142"
-        PORTER_HOST: https://dashboard.internal-tools.porter.run
-        PORTER_PROJECT: "301"
-        PORTER_TOKEN: ${{ secrets.APP_INTEGRATION_PROJECT_TOKEN }}
-        PORTER_SERVICE: porter
-        PORTER_COMMIT: ${{ github.sha }}

+ 42 - 0
.github/workflows/internal-tools-app-tests.yml

@@ -0,0 +1,42 @@
+on:
+  workflow_run:
+    workflows: ["Deploy Porter to Internal Tooling"]
+    branches: [master]
+    types:
+      - completed
+name: Run internal tools app tests
+jobs:
+  integration-tests:
+    name: Run app tests
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        yaml: ['js-test-app-buildpack', 'js-test-app-dockerfile', 'nginx', 'next-test-app-dockerfile']
+      fail-fast: false
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          repository: porter-dev/app-integration-tests
+          ref: refs/heads/main
+      - name: Run test
+        uses: ./.github/actions
+        with:
+          host: https://dashboard.internal-tools.porter.run
+          project: "301"
+          cluster: "142"
+          token: ${{ secrets.APP_INTEGRATION_PROJECT_TOKEN }}
+          yaml_file: ./test-yamls/${{ matrix.yaml }}.yaml
+  notify-on-failure:
+    name: Notify on failure
+    needs: integration-tests
+    runs-on: ubuntu-latest
+    if: failure()
+    steps:
+      - name: Notify Slack on failure
+        env:
+          SLACK_WEBHOOK_URL: ${{ secrets.APP_INTEGRATION_SLACK_WEBHOOK }}
+          RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+          REPO: ${{ github.repository }}
+        run: |
+          curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"<!subteam^S05LXJ5DU9L> \`$REPO\` integration tests failed in \`internal-tools\`: $RUN_URL \"}" $SLACK_WEBHOOK_URL