Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 54 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,70 @@ on:
- 'docs/**'
- 'LICENSE'
- '.gitignore'
pull_request_target:
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE'
- '.gitignore'
name: Test

jobs:
linux:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-go@v6
with:
go-version: '1.26.1'
cache: true
cache-dependency-path: go.sum
- name: Compute dispatch id
id: dispatch
run: echo "id=skywire-pr-${{ github.event.pull_request.number }}-run-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT"

- uses: golangci/golangci-lint-action@v9
with:
version: v2.11.4

- name: Install Dependencies
shell: bash
run: make install-shellcheck

- name: Lint Shell Scripts
run: make lint-shell

- name: Check Format and Run Tests
run: make check

- name: Setup SSH Key, Build and Run E2E
shell: bash
- name: Trigger remote linux test on mrpalide/ci-runner
env:
GH_TOKEN: ${{ secrets.CI_RUNNER_DISPATCH_TOKEN }}
DISPATCH_ID: ${{ steps.dispatch.outputs.id }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -e
sudo ./ci_scripts/create-ip-aliases.sh
make e2e-build
make e2e-run
gh api repos/mrpalide/ci-runner/dispatches \
--method POST \
-f event_type=skywire-linux-test \
-f "client_payload[dispatch_id]=$DISPATCH_ID" \
-f "client_payload[repository]=$REPO" \
-F "client_payload[pr_number]=$PR_NUMBER" \
-f "client_payload[sha]=$SHA"

- name: Locate the remote workflow run
id: find
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Test E2E
run: make e2e-test

- name: Clean E2E
run: make e2e-stop
GH_TOKEN: ${{ secrets.CI_RUNNER_DISPATCH_TOKEN }}
DISPATCH_ID: ${{ steps.dispatch.outputs.id }}
run: |
for i in $(seq 1 60); do
RUN_ID=$(gh api -X GET repos/mrpalide/ci-runner/actions/runs \
-F event=repository_dispatch -F per_page=30 \
--jq ".workflow_runs[] | select(.display_title | contains(\"${DISPATCH_ID}\")) | .id" \
| head -n 1)
if [ -n "$RUN_ID" ]; then
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
echo "Found remote run: https://github.com/mrpalide/ci-runner/actions/runs/$RUN_ID"
exit 0
fi
sleep 5
done
echo "::error::Timed out waiting for remote workflow run to appear"
exit 1

- name: Wait for remote run to finish
env:
GH_TOKEN: ${{ secrets.CI_RUNNER_DISPATCH_TOKEN }}
run: gh run watch ${{ steps.find.outputs.run_id }} --repo mrpalide/ci-runner --exit-status

darwin:
if: github.event_name == 'pull_request'
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -77,6 +92,7 @@ jobs:
GO111MODULE=on go test -cover -timeout=5m -mod=vendor -tags 'no_ci' ./internal/... ./pkg/... ./cmd/skywire-cli/commands/config/...

windows:
if: github.event_name == 'pull_request'
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
Expand Down