-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from railwayapp/jr/pro-3696-image-build-and-co…
…ntainer-run-tests image run tests
- Loading branch information
Showing
19 changed files
with
345 additions
and
197 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,5 @@ jobs: | |
- name: Vet | ||
run: go vet ./... | ||
|
||
- name: Test | ||
run: go test ./... | ||
- name: Test Unit | ||
run: go test -short ./... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
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 |
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
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
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
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
Oops, something went wrong.