Merge pull request #48 from railwayapp/jr/support-resolving-with-vali… #206
This file contains 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: Run Tests | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "docs/**" | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- "docs/**" | |
jobs: | |
find-examples: | |
runs-on: ubuntu-latest | |
outputs: | |
examples: ${{ steps.find-examples.outputs.examples }} | |
steps: | |
- uses: actions/checkout@v4 | |
- 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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23.4" | |
cache: true | |
# 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 | |
- name: Run test for ${{ matrix.example }} | |
run: | | |
# Add cache import/export flags to the test command | |
go test -v ./integration_tests \ | |
-run "TestExamplesIntegration/${{ matrix.example }}" \ | |
-timeout 30m \ | |
-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 }}" | |
- name: Stop BuildKit | |
if: always() | |
run: docker stop buildkit |