Parallelize Superset startup on management nodes #245
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: "Tests" | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: "**" | |
| env: | |
| TERRAFORM_WORKING_DIRECTORY: "./tests/setup" | |
| ANSIBLE_WORKING_DIRECTORY: "./tests/testsuite" | |
| jobs: | |
| tests: | |
| runs-on: "ubuntu-22.04" | |
| steps: | |
| - name: "Free disk space" | |
| run: | | |
| sudo rm -rf \ | |
| /usr/local/lib/android \ | |
| /usr/share/dotnet \ | |
| /opt/ghc \ | |
| /usr/local/share/boost \ | |
| /usr/local/graalvm \ | |
| /usr/local/share/chromium \ | |
| /usr/local/share/powershell | |
| sudo docker image prune --all --force | |
| - uses: "actions/checkout@v4" | |
| - uses: "actions/setup-node@v3" | |
| with: | |
| node-version: "20" | |
| - uses: "hashicorp/setup-terraform@v3" | |
| with: | |
| terraform_version: "1.0.10" | |
| - uses: "actions/setup-python@v3" | |
| with: | |
| python-version: "3.10.12" | |
| - name: "Install Python dependencies" | |
| run: "pip install --no-cache-dir --user ansible==9.5.1 paramiko==3.5.0" | |
| - name: "Initialize Terraform infrastructure" | |
| run: "terraform init" | |
| working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}" | |
| - name: "Apply Terraform infrastructure" | |
| run: "terraform apply --auto-approve" | |
| working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}" | |
| - name: "Build and pre-load service images into test containers" | |
| run: | | |
| build_and_load() { | |
| local image_name="$1" | |
| local build_context="$2" | |
| shift 2 | |
| local nodes=("$@") | |
| docker build --quiet -t "${image_name}:latest" "$build_context" | |
| for node in "${nodes[@]}"; do | |
| docker save "${image_name}:latest" | docker exec -i "$node" docker load | |
| done | |
| docker rmi "${image_name}:latest" || true | |
| docker image prune --force | |
| } | |
| build_and_load "ghcr.io/szachovy/superset-cluster-mysql-server" \ | |
| "services/mysql-server" node-2 node-3 node-4 | |
| build_and_load "ghcr.io/szachovy/superset-cluster-mysql-mgmt" \ | |
| "services/mysql-mgmt" node-0 node-1 | |
| build_and_load "ghcr.io/szachovy/superset-cluster-superset-service" \ | |
| "services/superset" node-0 node-1 | |
| docker image prune --all --force | |
| - name: "Run Ansible testsuite" | |
| run: | | |
| ansible-playbook --inventory inventory.yml deploy.yml \ | |
| 2>&1 | tee -a /tmp/superset_cluster_testsuite.log | |
| working-directory: "${{ env.ANSIBLE_WORKING_DIRECTORY }}" | |
| - uses: "actions/upload-artifact@v4" | |
| if: "${{ always() }}" | |
| with: | |
| path: "/tmp/superset_cluster_testsuite.log" | |
| - name: "Destroy Terraform environment" | |
| run: "terraform destroy --auto-approve" | |
| if: "${{ always() }}" | |
| working-directory: "${{ env.TERRAFORM_WORKING_DIRECTORY }}" |