From 771e7d140c2826a12193e3cfd67226b31eadc5a7 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 3 Mar 2024 18:20:56 +0000 Subject: [PATCH] run-tests-on-pr --- .github/workflows/run-tests-on-pr.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/run-tests-on-pr.yml diff --git a/.github/workflows/run-tests-on-pr.yml b/.github/workflows/run-tests-on-pr.yml new file mode 100644 index 0000000..3992631 --- /dev/null +++ b/.github/workflows/run-tests-on-pr.yml @@ -0,0 +1,58 @@ +name: run-tests-on-pr +permissions: + contents: read + id-token: write +on: + pull_request: +env: + SCORE_COMPOSE_VERSION: 'latest' + SCORE_HELM_VERSION: 'latest' + WORKLOAD_NAME: hello-world +jobs: + job: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: install score-compose + uses: score-spec/setup-score@v2 + with: + file: score-compose + token: ${{ secrets.GITHUB_TOKEN }} + version: ${{ env.SCORE_COMPOSE_VERSION }} + - name: make score-compose + run: | + make score-compose + - name: make compose-up + run: | + make compose-up + - name: make compose-test + run: | + sleep 10 + make compose-test + - name: create kind cluster + run: | + kind create cluster + - name: install score-helm + uses: score-spec/setup-score@v2 + with: + file: score-helm + token: ${{ secrets.GITHUB_TOKEN }} + version: ${{ env.SCORE_HELM_VERSION }} + - name: make score-helm + run: | + make score-helm + - name: make k8s-up + id: helm-install + run: | + make k8s-up + kubectl wait \ + --for=condition=available \ + --timeout=30s \ + deployment/${{ env.WORKLOAD_NAME }} + - name: catch helm install errors + if: ${{ failure() && steps.helm-install.outcome == 'failure' }} + run: | + kubectl get events + kubectl logs \ + -l app.kubernetes.io/name=${{ env.WORKLOAD_NAME }} \ No newline at end of file