|
| 1 | +name: docker_ci |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "main" |
| 6 | + - "release-[0-9]+.[0-9]" |
| 7 | + tags: "**" |
| 8 | + pull_request: |
| 9 | + branches: "**" |
| 10 | +permissions: read-all |
| 11 | + |
| 12 | +env: |
| 13 | + GOPRIVATE: github.com/slackhq/vitess-addons |
| 14 | + GH_ACCESS_TOKEN: "${{ secrets.GH_ACCESS_TOKEN }}" |
| 15 | + BOOTSTRAP_VERSION: "ci" |
| 16 | + BOOTSTRAP_FLAVOR: "mysql84" |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + name: ${{ matrix.name }} |
| 21 | + runs-on: ubuntu-24.04 |
| 22 | + |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - shard: java |
| 28 | + name: Java Docker Test |
| 29 | + - shard: docker_cluster |
| 30 | + name: Docker Test Cluster |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Harden the runner (Audit all outbound calls) |
| 34 | + uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 |
| 35 | + with: |
| 36 | + egress-policy: audit |
| 37 | + |
| 38 | + - name: Skip CI |
| 39 | + run: | |
| 40 | + if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then |
| 41 | + echo "skipping CI due to the 'Skip CI' label" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | +
|
| 45 | + - name: Check out code |
| 46 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 47 | + with: |
| 48 | + persist-credentials: "false" |
| 49 | + |
| 50 | + - name: Check for changes in relevant files |
| 51 | + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 52 | + id: changes |
| 53 | + with: |
| 54 | + token: "" |
| 55 | + filters: | |
| 56 | + end_to_end: |
| 57 | + - 'test/config.json' |
| 58 | + - 'go/**/*.go' |
| 59 | + - 'test.go' |
| 60 | + - 'Makefile' |
| 61 | + - 'build.env' |
| 62 | + - 'go.sum' |
| 63 | + - 'go.mod' |
| 64 | + - 'proto/*.proto' |
| 65 | + - 'tools/**' |
| 66 | + - 'config/**' |
| 67 | + - 'bootstrap.sh' |
| 68 | + - 'docker/**' |
| 69 | + - 'java/**' |
| 70 | + - '.github/workflows/docker_ci.yml' |
| 71 | +
|
| 72 | + - name: Setup GitHub access token |
| 73 | + if: steps.changes.outputs.end_to_end == 'true' |
| 74 | + run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ |
| 75 | + |
| 76 | + - name: Build bootstrap images |
| 77 | + if: steps.changes.outputs.end_to_end == 'true' |
| 78 | + uses: ./.github/actions/build-bootstrap |
| 79 | + with: |
| 80 | + bootstrap-version: ${{ env.BOOTSTRAP_VERSION }} |
| 81 | + bootstrap-flavor: ${{ env.BOOTSTRAP_FLAVOR }} |
| 82 | + gh-access-token: ${{ env.GH_ACCESS_TOKEN }} |
| 83 | + |
| 84 | + - name: Set up Go |
| 85 | + if: steps.changes.outputs.end_to_end == 'true' |
| 86 | + uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 |
| 87 | + with: |
| 88 | + go-version-file: go.mod |
| 89 | + |
| 90 | + - name: Tune the OS |
| 91 | + if: steps.changes.outputs.end_to_end == 'true' |
| 92 | + uses: ./.github/actions/tune-os |
| 93 | + |
| 94 | + - name: Run docker tests - ${{ matrix.shard }} |
| 95 | + if: steps.changes.outputs.end_to_end == 'true' |
| 96 | + run: | |
| 97 | + go run test.go -docker=true -pull=false -flavor=${{ env.BOOTSTRAP_FLAVOR }} -bootstrap-version=${{ env.BOOTSTRAP_VERSION }} --follow -shard ${{ matrix.shard }} |
0 commit comments