Spread tests for docs #400
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: Spread tests for docs | |
| on: | |
| pull_request: | |
| paths: | |
| - spread.yaml | |
| - docs/**/code/** | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - spread.yaml | |
| - docs/**/code/** | |
| schedule: | |
| - cron: "0 0 * * 0" # Midnight UTC on Sundays | |
| jobs: | |
| snap-build: | |
| runs-on: [self-hosted, linux, amd64, noble, medium] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Build snap | |
| uses: snapcore/action-build@v1 | |
| id: charmcraft | |
| - name: Upload snap artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: snap | |
| path: ${{ steps.charmcraft.outputs.snap }} | |
| spread-select: | |
| runs-on: [spread-installed] | |
| outputs: | |
| systems: ${{ steps.select.outputs.systems }} | |
| steps: | |
| - name: Checkout charmcraft | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Find spread systems | |
| id: select | |
| run: | | |
| echo systems=$(spread -list ci:docs/ | jq --raw-input . | jq --slurp --compact-output) | tee -a "${GITHUB_OUTPUT}" | |
| docs-tests: | |
| runs-on: [self-hosted, linux, amd64, noble, large] | |
| needs: [spread-select, snap-build] | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| system: ${{ fromJSON(needs.spread-select.outputs.systems) }} | |
| steps: | |
| - name: Fix network issues related to docker and lxd | |
| run: | | |
| sudo iptables -P FORWARD ACCEPT | |
| sudo ip6tables -P FORWARD ACCEPT | |
| - name: Checkout charmcraft | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Cleanup job workspace | |
| run: | | |
| rm -rf "${{ github.workspace }}" | |
| mkdir "${{ github.workspace }}" | |
| - name: Checkout charmcraft | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Download snap artifact | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: snap | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.24 | |
| - name: Install spread | |
| run: | | |
| go install github.com/snapcore/spread/cmd/spread@latest | |
| - name: Run spread | |
| run: | | |
| $(go env GOPATH)/bin/spread "${{ matrix.system }}" | |
| - name: Discard spread workers | |
| if: always() | |
| run: | | |
| shopt -s nullglob | |
| for r in .spread-reuse.*.yaml; do | |
| spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')" | |
| done |