Skip to content

Commit 540a78a

Browse files
committed
ci: add SDK examples workflow and badge
Runs sdk_basic_usage (local-only operations) on every push/PR. Excludes sdk_full_deployment which requires VM network connectivity (configure, release, run, test) unavailable on GitHub-hosted runners. Adds the SDK Examples badge to the README alongside the other CI badges.
1 parent 76ef2a0 commit 540a78a

2 files changed

Lines changed: 73 additions & 1 deletion

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: SDK Examples Tests
3+
4+
# This workflow runs SDK examples that are compatible with GitHub-hosted runners.
5+
#
6+
# RUNNER LIMITATION: LXD VMs created on GitHub runners have no internal network
7+
# connectivity. As a result, any example that requires communication with a
8+
# running VM is excluded. The affected commands are: configure, release, run, test.
9+
#
10+
# COMPATIBLE EXAMPLES (can run in CI):
11+
# - sdk_basic_usage — local-only operations (create, list, show, exists,
12+
# validate, destroy, purge). No infrastructure required.
13+
#
14+
# INCOMPATIBLE EXAMPLES (local only, not run here):
15+
# - sdk_full_deployment — uses configure, release, run, and test which require
16+
# VM network connectivity unavailable on GitHub runners.
17+
#
18+
# When new examples that only use compatible operations are added, register them
19+
# in the "Run SDK examples" step below.
20+
21+
on:
22+
push:
23+
pull_request:
24+
workflow_dispatch: # Allow manual triggering
25+
26+
jobs:
27+
sdk-examples:
28+
name: SDK Examples
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Rust toolchain
37+
uses: dtolnay/rust-toolchain@stable
38+
with:
39+
toolchain: stable
40+
41+
- name: Cache Rust dependencies
42+
uses: Swatinem/rust-cache@v2
43+
44+
- name: Set SSH key permissions
45+
run: |
46+
# SSH requires private key files to have restrictive permissions (0600).
47+
# Git checkout does not preserve file permissions, so we set them manually.
48+
chmod 600 fixtures/testing_rsa
49+
ls -la fixtures/testing_rsa
50+
51+
- name: Build SDK examples
52+
run: |
53+
cargo build --examples
54+
55+
- name: Run SDK examples
56+
run: |
57+
echo "🚀 Running SDK basic usage example at $(date)"
58+
cargo run --example sdk_basic_usage
59+
echo "✅ SDK basic usage example completed at $(date)"
60+
61+
- name: Debug information (on failure)
62+
if: failure()
63+
run: |
64+
echo "=== Workspace contents ==="
65+
ls -la
66+
67+
echo "=== Build directory ==="
68+
ls -la build/ 2>/dev/null || echo "No build directory found"
69+
70+
echo "=== System resources ==="
71+
df -h
72+
free -h

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Linting](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml) [![Testing](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml) [![Test Dependency Installer](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml) [![E2E Infrastructure Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml) [![E2E Deployment Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml) [![Test LXD Container Provisioning](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml) [![Coverage](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml) [![Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml) [![Backup Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml) [![Docker Security Scan](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml) [![Code Statistics](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml)
1+
[![Linting](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/linting.yml) [![Testing](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/testing.yml) [![Test Dependency Installer](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-dependency-installer.yml) [![E2E Infrastructure Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-infrastructure.yml) [![E2E Deployment Tests](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-e2e-deployment.yml) [![SDK Examples](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-sdk-examples.yml) [![Test LXD Container Provisioning](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/test-lxd-provision.yml) [![Coverage](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/coverage.yml) [![Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/container.yaml) [![Backup Container](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/backup-container.yaml) [![Docker Security Scan](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/docker-security-scan.yml) [![Code Statistics](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml/badge.svg)](https://github.com/torrust/torrust-tracker-deployer/actions/workflows/code-statistics.yml)
22

33
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/torrust/torrust-tracker-deployer?quickstart=1)
44

0 commit comments

Comments
 (0)