|
| 1 | +name: e2e |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'release-*' |
| 8 | + paths-ignore: |
| 9 | + - 'docs/**' |
| 10 | + - '**.adoc' |
| 11 | + - '**.md' |
| 12 | + - 'LICENSE' |
| 13 | + push: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + - 'release-*' |
| 17 | + paths-ignore: |
| 18 | + - 'docs/**' |
| 19 | + - '**.adoc' |
| 20 | + - '**.md' |
| 21 | + - 'LICENSE' |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.head_ref }}-${{ github.workflow }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + kubernetes: |
| 29 | + |
| 30 | + runs-on: ubuntu-20.04 |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Cleanup |
| 34 | + run: | |
| 35 | + ls -lart |
| 36 | + echo "Initial status:" |
| 37 | + df -h |
| 38 | +
|
| 39 | + echo "Cleaning up resources:" |
| 40 | + sudo swapoff -a |
| 41 | + sudo rm -f /swapfile |
| 42 | + sudo apt clean |
| 43 | + sudo rm -rf /usr/share/dotnet |
| 44 | + sudo rm -rf /opt/ghc |
| 45 | + sudo rm -rf "/usr/local/share/boost" |
| 46 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 47 | + docker rmi $(docker image ls -aq) |
| 48 | +
|
| 49 | + echo "Final status:" |
| 50 | + df -h |
| 51 | +
|
| 52 | + - name: Checkout code |
| 53 | + uses: actions/checkout@v3 |
| 54 | + with: |
| 55 | + submodules: recursive |
| 56 | + |
| 57 | + - name: Set Go |
| 58 | + uses: actions/setup-go@v3 |
| 59 | + with: |
| 60 | + go-version: v1.19 |
| 61 | + |
| 62 | + - name: Set up gotestfmt |
| 63 | + uses: gotesttools/gotestfmt-action@v2 |
| 64 | + with: |
| 65 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Setup and start KinD cluster |
| 68 | + uses: ./.github/actions/kind |
| 69 | + |
| 70 | + - name: Deploy CodeFlare stack |
| 71 | + id: deploy |
| 72 | + run: | |
| 73 | + echo Deploying CodeFlare operator |
| 74 | + IMG="${REGISTRY_ADDRESS}"/codeflare-operator |
| 75 | + make image-push -e IMG="${IMG}" |
| 76 | + make deploy -e IMG="${IMG}" |
| 77 | + kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager |
| 78 | +
|
| 79 | + echo Setting up CodeFlare stack |
| 80 | + make setup-e2e |
| 81 | +
|
| 82 | + - name: Run e2e tests |
| 83 | + run: | |
| 84 | + export CODEFLARE_TEST_TIMEOUT_SHORT=1m |
| 85 | + export CODEFLARE_TEST_TIMEOUT_MEDIUM=5m |
| 86 | + export CODEFLARE_TEST_TIMEOUT_LONG=10m |
| 87 | +
|
| 88 | + export CODEFLARE_TEST_OUTPUT_DIR=${{ env.TEMP_DIR }} |
| 89 | + echo "CODEFLARE_TEST_OUTPUT_DIR=${CODEFLARE_TEST_OUTPUT_DIR}" >> $GITHUB_ENV |
| 90 | +
|
| 91 | + set -euo pipefail |
| 92 | + go test -timeout 30m -v ./tests/e2e -json 2>&1 | tee ${CODEFLARE_TEST_OUTPUT_DIR}/gotest.log | gotestfmt |
| 93 | +
|
| 94 | + - name: Print CodeFlare operator logs |
| 95 | + if: always() && steps.deploy.outcome == 'success' |
| 96 | + run: | |
| 97 | + echo "Printing CodeFlare operator logs" |
| 98 | + kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log |
| 99 | +
|
| 100 | + - name: Print MCAD controller logs |
| 101 | + if: always() && steps.deploy.outcome == 'success' |
| 102 | + run: | |
| 103 | + echo "Printing MCAD controller logs" |
| 104 | + kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher | tee ${CODEFLARE_TEST_OUTPUT_DIR}/mcad.log |
| 105 | +
|
| 106 | + - name: Print KubeRay operator logs |
| 107 | + if: always() && steps.deploy.outcome == 'success' |
| 108 | + run: | |
| 109 | + echo "Printing KubeRay operator logs" |
| 110 | + kubectl logs -n ray-system --tail -1 -l app.kubernetes.io/name=kuberay | tee ${CODEFLARE_TEST_OUTPUT_DIR}/kuberay.log |
| 111 | +
|
| 112 | + - name: Upload logs |
| 113 | + uses: actions/upload-artifact@v3 |
| 114 | + if: always() && steps.deploy.outcome == 'success' |
| 115 | + with: |
| 116 | + name: logs |
| 117 | + retention-days: 10 |
| 118 | + path: | |
| 119 | + ${{ env.CODEFLARE_TEST_OUTPUT_DIR }}/**/*.log |
0 commit comments