|
| 1 | +name: Run tests for all SingleStore versions |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + # Runs at 4:17 AM UTC on the 1st of every month. |
| 7 | + - cron: "17 4 1 * *" |
| 8 | + |
| 9 | +jobs: |
| 10 | + fetch-s2-versions: |
| 11 | + name: Fetch supported SingleStore versions |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + versions: ${{ steps.get_versions.outputs.versions }} |
| 15 | + steps: |
| 16 | + - name: Get supported versions of SingleStore |
| 17 | + id: get_versions |
| 18 | + uses: singlestore-labs/singlestore-supported-versions@main |
| 19 | + with: |
| 20 | + include_rc: true |
| 21 | + |
| 22 | + generate-matrix: |
| 23 | + name: Generate test matrix |
| 24 | + runs-on: ubuntu-latest |
| 25 | + needs: fetch-s2-versions |
| 26 | + outputs: |
| 27 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - name: Clone test suite |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: singlestore-labs/django |
| 34 | + ref: singlestore-test-4.2.x |
| 35 | + path: testrepo |
| 36 | + - name: Generate matrix JSON |
| 37 | + id: set-matrix |
| 38 | + run: | |
| 39 | + versions='${{ needs.fetch-s2-versions.outputs.versions }}' |
| 40 | + groups=$(python scripts/get_test_matrix.py testrepo/tests) |
| 41 | + full_matrix=$(jq -c -n \ |
| 42 | + --argjson versions "$versions" \ |
| 43 | + --argjson groups "$groups" \ |
| 44 | + '[ $versions[] as $v | $groups.include[] | {group: .group, modules: .modules, singlestore_version: $v} ]' |
| 45 | + ) |
| 46 | + echo "$full_matrix" | tee matrix.json |
| 47 | + echo "matrix=$full_matrix" >> $GITHUB_OUTPUT |
| 48 | + env: |
| 49 | + NUM_GROUPS: 5 |
| 50 | + |
| 51 | + run-tests: |
| 52 | + name: Run tests (Group ${{ matrix.group }}, Version ${{ matrix.singlestore_version }}) |
| 53 | + needs: [fetch-s2-versions, generate-matrix] |
| 54 | + runs-on: ubuntu-latest |
| 55 | + strategy: |
| 56 | + fail-fast: false |
| 57 | + matrix: |
| 58 | + include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |
| 59 | + services: |
| 60 | + singlestore: |
| 61 | + image: ghcr.io/singlestore-labs/singlestoredb-dev |
| 62 | + ports: |
| 63 | + - 3306:3306 |
| 64 | + env: |
| 65 | + SINGLESTORE_LICENSE: ${{ secrets.SINGLESTORE_LICENSE }} |
| 66 | + ROOT_PASSWORD: ${{ secrets.SINGLESTORE_PASSWORD }} |
| 67 | + SINGLESTORE_VERSION: ${{ matrix.singlestore_version }} |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Remove unnecessary pre-installed toolchains for free disk space |
| 71 | + run: | |
| 72 | + echo "=== BEFORE ===" |
| 73 | + df -h |
| 74 | + sudo rm -rf /usr/share/dotnet |
| 75 | + sudo rm -rf /opt/ghc |
| 76 | + sudo rm -rf /usr/local/share/boost |
| 77 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 78 | + sudo rm -rf /usr/local/lib/android |
| 79 | + sudo rm -rf /opt/hostedtoolcache |
| 80 | + docker system prune -af || true |
| 81 | + sudo apt-get clean |
| 82 | + echo "=== AFTER ===" |
| 83 | + df -h |
| 84 | +
|
| 85 | + - name: Checkout django-singlestore repo |
| 86 | + uses: actions/checkout@v4 |
| 87 | + |
| 88 | + - name: Checkout test repo |
| 89 | + uses: actions/checkout@v4 |
| 90 | + with: |
| 91 | + repository: singlestore-labs/django |
| 92 | + ref: singlestore-test-4.2.x |
| 93 | + path: testrepo |
| 94 | + |
| 95 | + - name: Set up Python |
| 96 | + uses: actions/setup-python@v4 |
| 97 | + with: |
| 98 | + python-version: "3.10" |
| 99 | + cache: pip |
| 100 | + |
| 101 | + - name: Install test suite and package |
| 102 | + run: | |
| 103 | + pip install singlestoredb |
| 104 | + pip install ./testrepo |
| 105 | + pip install . |
| 106 | +
|
| 107 | + - name: Run test modules for group |
| 108 | + run: | |
| 109 | + echo "Running test modules for group ${{ matrix.group }}" |
| 110 | + python scripts/run_group.py '${{ toJson(matrix.modules) }}' --keepdb |
| 111 | + env: |
| 112 | + SINGLESTORE_PASSWORD: ${{ secrets.SINGLESTORE_PASSWORD }} |
| 113 | + NUM_GROUPS: 5 |
0 commit comments