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

Merge pull request #1718 from porter-dev/nafees/e2e-tests

[POR-346] Add initial E2E testing for new releases
abelanger5 4 лет назад
Родитель
Сommit
36264dfe12
1 измененных файлов с 106 добавлено и 2 удалено
  1. 106 2
      .github/workflows/prerelease.yaml

+ 106 - 2
.github/workflows/prerelease.yaml

@@ -250,7 +250,7 @@ jobs:
   release:
     name: Zip binaries, create release and upload assets
     runs-on: ubuntu-latest
-    needs: 
+    needs:
     - notarize
     - build-linux
     steps:
@@ -395,4 +395,108 @@ jobs:
             --build-arg VERSION=${{steps.tag_name.outputs.tag}}
       - name: Push
         run: |
-          docker push public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
+          docker push public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
+  update-porter-update-action:
+    name: Update porter-update-action
+    runs-on: ubuntu-latest
+    needs: build-push-docker-cli
+    steps:
+      - name: Get tag name
+        id: tag_name
+        run: |
+          tag=${GITHUB_TAG/refs\/tags\//}
+          echo ::set-output name=tag::$tag
+        env:
+          GITHUB_TAG: ${{ github.ref }}
+      - name: Push new branch with updated CLI
+        run: |
+          git config user.name "Update Bot"
+          git config user.email "support@porter.run"
+
+          cd $GITHUB_WORKSPACE
+
+          git clone https://abelanger5:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-update-action
+
+          cd porter-update-action
+
+          git checkout -b "${{steps.tag_name.outputs.tag}}"
+
+          cat >Dockerfile <<EOL
+          FROM public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
+
+          COPY entrypoint.sh /action/
+
+          ENTRYPOINT ["/action/entrypoint.sh"]
+          EOL
+
+          git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
+
+          git push --set-upstream origin ${{steps.tag_name.outputs.tag}}
+  update-porter-cli-action:
+    name: Update porter-cli-action
+    runs-on: ubuntu-latest
+    needs: build-push-docker-cli
+    steps:
+      - name: Get tag name
+        id: tag_name
+        run: |
+          tag=${GITHUB_TAG/refs\/tags\//}
+          echo ::set-output name=tag::$tag
+        env:
+          GITHUB_TAG: ${{ github.ref }}
+      - name: Push new branch with updated CLI
+        run: |
+          git config user.name "Update Bot"
+          git config user.email "support@porter.run"
+
+          cd $GITHUB_WORKSPACE
+
+          git clone https://abelanger5:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-cli-action
+
+          cd porter-cli-action
+
+          git checkout -b "${{steps.tag_name.outputs.tag}}"
+
+          cat >Dockerfile <<EOL
+          FROM public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
+
+          COPY entrypoint.sh /action/
+
+          ENTRYPOINT ["/action/entrypoint.sh"]
+          EOL
+
+          git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
+
+          git push --set-upstream origin ${{steps.tag_name.outputs.tag}}
+  invoke-new-release-tests-workflows:
+    name: Update new-release-tests
+    runs-on: ubuntu-latest
+    needs: [update-porter-update-action, update-porter-cli-action]
+    steps:
+      - name: Get tag name
+        id: tag_name
+        run: |
+          tag=${GITHUB_TAG/refs\/tags\//}
+          echo ::set-output name=tag::$tag
+        env:
+          GITHUB_TAG: ${{ github.ref }}
+      - name: Update new-release-tests
+        run: |
+          git config user.name "Update Bot"
+          git config user.email "support@porter.run"
+
+          cd $GITHUB_WORKSPACE
+
+          git clone https://abelanger5:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/new-release-tests
+
+          cd new-release-tests/.github/workflows
+
+          sed -i '' 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
+          sed -i '' 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
+
+          sed -i '' 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
+          sed -i '' 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
+
+          git commit -m "Update to Porter GHA version ${{steps.tag_name.outputs.tag}}"
+
+          git push