mirror of
https://github.com/tailscale/github-action.git
synced 2026-08-20 06:09:23 +00:00
Signed-off-by: Lee Briggs <lee@leebriggs.co.uk> Signed-off-by: Percy Wegmann <percy@tailscale.com>
238 lines
No EOL
7.3 KiB
YAML
238 lines
No EOL
7.3 KiB
YAML
name: "Integration Tests"
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
# Test building the action
|
|
build:
|
|
name: Build Action
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Action
|
|
run: npm run build
|
|
|
|
|
|
# Matrix test for all supported platforms and architectures
|
|
|
|
integration-tests:
|
|
name: Test ${{ matrix.os }} (${{ matrix.arch }})
|
|
needs: build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Linux tests (AMD64)
|
|
- os: ubuntu-latest
|
|
runner-os: Linux
|
|
arch: amd64
|
|
|
|
# Linux tests (ARM64)
|
|
- os: ubuntu-24.04-arm
|
|
runner-os: Linux
|
|
arch: arm64
|
|
|
|
# Windows tests (AMD64)
|
|
- os: windows-latest
|
|
runner-os: Windows
|
|
arch: amd64
|
|
|
|
# Windows tests (ARM64)
|
|
- os: windows-11-arm
|
|
runner-os: Windows
|
|
arch: arm64
|
|
|
|
# macOS intel
|
|
- os: macos-13
|
|
runner-os: macOS
|
|
arch: amd64
|
|
|
|
# macOS ARM
|
|
- os: macos-14
|
|
runner-os: macOS
|
|
arch: arm64
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# Test with OAuth authentication
|
|
- name: Test Tailscale Setup (OAuth)
|
|
id: tailscale-oauth
|
|
uses: ./
|
|
with:
|
|
oauth-client-id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }}
|
|
oauth-client-secret: ${{ secrets.TAILSCALE_OAUTH_CLIENT_SECRET }}
|
|
tags: "tag:ci"
|
|
version: "1.82.0"
|
|
use-cache: true
|
|
timeout: "3m"
|
|
retry: 3
|
|
|
|
# Test Tailscale status command
|
|
- name: Check Tailscale Status
|
|
if: steps.tailscale-oauth.outcome == 'success'
|
|
run: |
|
|
echo "Testing Tailscale status command..."
|
|
if [ "${{ matrix.runner-os }}" == "Windows" ]; then
|
|
# Windows uses system-installed binary without sudo
|
|
tailscale status
|
|
tailscale version
|
|
else
|
|
# Linux and macOS use system-installed binary with sudo
|
|
sudo -E tailscale status
|
|
tailscale version
|
|
fi
|
|
shell: bash
|
|
|
|
|
|
# Speed comparison between our action and the official Tailscale action
|
|
speed-comparison:
|
|
name: Speed Comparison (${{ matrix.os }})
|
|
needs: build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Test on a subset of platforms for speed comparison
|
|
- os: ubuntu-latest
|
|
runner-os: Linux
|
|
- os: windows-latest
|
|
runner-os: Windows
|
|
- os: macos-14
|
|
runner-os: macOS
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# Test our action with timing
|
|
- name: Test Our Action (jaxxstorm/action-setup-tailscale)
|
|
id: our-action
|
|
run: |
|
|
echo "::group::Our Action Performance Test"
|
|
start_time=$(date +%s%N)
|
|
echo "START_TIME=$start_time" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Run Our Action
|
|
uses: ./
|
|
with:
|
|
oauth-client-id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }}
|
|
oauth-client-secret: ${{ secrets.TAILSCALE_OAUTH_CLIENT_SECRET }}
|
|
tags: "tag:ci"
|
|
version: "1.82.0"
|
|
use-cache: true
|
|
timeout: "3m"
|
|
retry: 3
|
|
|
|
- name: Calculate Our Action Time
|
|
run: |
|
|
end_time=$(date +%s%N)
|
|
duration=$(( (end_time - START_TIME) / 1000000 ))
|
|
echo "OUR_ACTION_TIME=${duration}ms" >> $GITHUB_ENV
|
|
echo "::notice::Our action completed in ${duration}ms"
|
|
echo "::endgroup::"
|
|
shell: bash
|
|
|
|
# Clean up for next test
|
|
- name: Cleanup Between Tests
|
|
run: |
|
|
echo "::group::Cleanup Between Tests"
|
|
if [ "${{ matrix.runner-os }}" == "Windows" ]; then
|
|
# Windows cleanup
|
|
tailscale logout || true
|
|
# Stop and remove Tailscale service if needed
|
|
sc stop Tailscale || true
|
|
# Uninstall via registry or control panel if needed
|
|
else
|
|
# Linux/macOS cleanup
|
|
sudo -E tailscale logout || true
|
|
if [ "${{ matrix.runner-os }}" == "macOS" ]; then
|
|
sudo launchctl stop com.tailscale.tailscaled || true
|
|
sudo launchctl unload /Library/LaunchDaemons/com.tailscale.tailscaled.plist || true
|
|
brew uninstall tailscale || true
|
|
else
|
|
sudo pkill tailscaled || true
|
|
sudo apt-get remove -y tailscale || true
|
|
fi
|
|
fi
|
|
echo "::endgroup::"
|
|
shell: bash
|
|
continue-on-error: true
|
|
|
|
# Test official Tailscale action with timing
|
|
- name: Test Official Action (tailscale/github-action)
|
|
run: |
|
|
echo "::group::Official Action Performance Test"
|
|
start_time=$(date +%s%N)
|
|
echo "OFFICIAL_START_TIME=$start_time" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Run Official Action
|
|
uses: tailscale/github-action@v2
|
|
with:
|
|
oauth-client-id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }}
|
|
oauth-secret: ${{ secrets.TAILSCALE_OAUTH_CLIENT_SECRET }}
|
|
tags: "tag:ci"
|
|
version: "1.82.0"
|
|
|
|
- name: Calculate Official Action Time & Compare
|
|
run: |
|
|
end_time=$(date +%s%N)
|
|
official_duration=$(( (end_time - OFFICIAL_START_TIME) / 1000000 ))
|
|
echo "OFFICIAL_ACTION_TIME=${official_duration}ms" >> $GITHUB_ENV
|
|
echo "::endgroup::"
|
|
|
|
# Performance comparison
|
|
echo "::group::Performance Comparison Results"
|
|
echo "📊 **Performance Comparison on ${{ matrix.os }}:**"
|
|
echo "🚀 Our Action: ${OUR_ACTION_TIME}"
|
|
echo "🏢 Official Action: ${official_duration}ms"
|
|
|
|
if [ "${OUR_ACTION_TIME%ms}" -lt "${official_duration}" ]; then
|
|
improvement=$(( official_duration - ${OUR_ACTION_TIME%ms} ))
|
|
percentage=$(( improvement * 100 / official_duration ))
|
|
echo "✅ Our action is ${improvement}ms (${percentage}%) faster!"
|
|
echo "::notice::Performance Win: Our action is ${improvement}ms (${percentage}%) faster than official action on ${{ matrix.os }}"
|
|
elif [ "${OUR_ACTION_TIME%ms}" -gt "${official_duration}" ]; then
|
|
regression=$(( ${OUR_ACTION_TIME%ms} - official_duration ))
|
|
percentage=$(( regression * 100 / ${OUR_ACTION_TIME%ms} ))
|
|
echo "⚠️ Our action is ${regression}ms (${percentage}%) slower"
|
|
echo "::warning::Performance Regression: Our action is ${regression}ms (${percentage}%) slower than official action on ${{ matrix.os }}"
|
|
else
|
|
echo "🤝 Both actions have similar performance"
|
|
echo "::notice::Performance Tie: Both actions have similar performance on ${{ matrix.os }}"
|
|
fi
|
|
echo "::endgroup::"
|
|
shell: bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|