Skip to content

Contract tests (live API) #32

Contract tests (live API)

Contract tests (live API) #32

# Contract test workflow — drift alarm against the live InterlinedList API.
#
# This workflow is intentionally *separate* from ci.yml: it depends on real
# credentials, makes live HTTP calls to https://interlinedlist.com, and is
# gated on the INTERLINEDLIST_EMAIL / INTERLINEDLIST_PASSWORD repository
# secrets. If the secrets are absent the contract suite's XCTest cases
# XCTSkip themselves — the workflow still passes, but the value is zero.
#
# Triggers:
# workflow_dispatch — manual on-demand run.
# schedule — once nightly to catch upstream API drift.
#
# The InterlinedKit SPM suite is the only target — the contract cases live
# in `Packages/InterlinedKit/Tests/InterlinedKitTests/ContractTests.swift`.
name: Contract tests (live API)
on:
workflow_dispatch:
schedule:
# 06:17 UTC daily — off any hour boundary to avoid GH cron contention.
- cron: "17 6 * * *"
concurrency:
group: contract-tests
cancel-in-progress: false
env:
XCODE_VERSION: "16.2"
jobs:
contract:
name: "swift test: InterlinedKit (contract)"
runs-on: macos-15
# Don't fail the workflow if creds are absent — the suite XCTSkips
# rather than fails, but we still want a clean signal in the UI.
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- name: Select Xcode ${{ env.XCODE_VERSION }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Cache SPM build artifacts
uses: actions/cache@v6
with:
path: Packages/InterlinedKit/.build
key: spm-contract-${{ runner.os }}-${{ hashFiles('Packages/InterlinedKit/Package.swift') }}
restore-keys: |
spm-contract-${{ runner.os }}-
- name: Warn if credentials are absent
if: ${{ env.INTERLINEDLIST_EMAIL == '' || env.INTERLINEDLIST_PASSWORD == '' }}
env:
INTERLINEDLIST_EMAIL: ${{ secrets.INTERLINEDLIST_EMAIL }}
INTERLINEDLIST_PASSWORD: ${{ secrets.INTERLINEDLIST_PASSWORD }}
run: |
echo "::warning::INTERLINEDLIST_EMAIL / INTERLINEDLIST_PASSWORD secrets are not set — ContractTests will XCTSkip."
- name: Run contract tests
env:
INTERLINEDLIST_EMAIL: ${{ secrets.INTERLINEDLIST_EMAIL }}
INTERLINEDLIST_PASSWORD: ${{ secrets.INTERLINEDLIST_PASSWORD }}
run: |
swift test \
--package-path Packages/InterlinedKit \
--filter ContractTests