Skip to content

refactor: replace HasMatch with HasFile for specific file paths #1095

refactor: replace HasMatch with HasFile for specific file paths

refactor: replace HasMatch with HasFile for specific file paths #1095

Workflow file for this run

name: Run Tests
on:
push:
branches: [main]
paths-ignore:
- "docs/**"
pull_request:
paths-ignore:
- "docs/**"
schedule:
# run every day to alert against breaking changes in mise backends
# the backends used for various projects (in registry.toml) are compiled into the mise binary, but the code that runs
# these backends, and the services they connect to are not. By running integration tests each day, we'll know if
# something changes in the package ecosystem that breaks one of our build tests.
- cron: "0 0 * * *"
jobs:
find-examples:
runs-on: ubuntu-latest
outputs:
examples: ${{ steps.find-examples.outputs.examples }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Find examples with test.json
id: find-examples
run: |
examples=$(find examples -name "test.json" -exec dirname {} \; | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
echo "examples=$examples" >> "$GITHUB_OUTPUT"
test:
needs: find-examples
runs-on: ubuntu-latest
strategy:
matrix:
example: ${{ fromJson(needs.find-examples.outputs.examples) }}
fail-fast: false
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566
# Set up GitHub Actions runtime for BuildKit cache
- name: Set up BuildKit GHA cache
uses: crazy-max/ghaction-github-runtime@v3
- name: Start BuildKit
run: |
docker run --rm --privileged -d \
--name buildkit \
-e BUILDKIT_DEBUG=1 \
moby/buildkit:latest
# Wait for BuildKit to be ready
sleep 5
echo "BUILDKIT_HOST=docker-container://buildkit" >> $GITHUB_ENV
- name: Install dependencies
run: go mod download
# required for integration tests that use multiple platforms
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Run test for ${{ matrix.example }}
env:
# without the GITHUB_TOKEN, mise will 403 us
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Add cache import/export flags to the test command
go test -v ./integration_tests \
-run "TestExamplesIntegration/${{ matrix.example }}" \
-timeout 20m
# -buildkit-cache-import="type=gha,url=${{ env.ACTIONS_CACHE_URL }},token=${{ env.ACTIONS_RUNTIME_TOKEN }},scope=${{ matrix.example }}" \
# -buildkit-cache-export="type=gha,url=${{ env.ACTIONS_CACHE_URL }},token=${{ env.ACTIONS_RUNTIME_TOKEN }},mode=max,scope=${{ matrix.example }},error=ignore,compression=zstd"
- name: Stop BuildKit
if: always()
run: docker stop buildkit