Skip to content

Wyn CI/CD with GitHub Actions

Wyn compiles fast — a typical project builds in under 2 seconds. That makes CI pipelines quick and cheap. Here's how to set up GitHub Actions for building, testing, cross-compiling, and deploying Wyn projects.

Basic CI Workflow

Create .github/workflows/ci.yml:

yaml
name: CI
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Wyn
        run: curl -fsSL https://wynlang.com/install.sh | sh

      - name: Build
        run: wyn build main.wyn --release -o app

      - name: Run tests
        run: wyn test tests/

      - name: Upload binary
        uses: actions/upload-artifact@v4
        with:
          name: app-linux
          path: app

This installs Wyn (~10 seconds), compiles your project (~1-2 seconds), and runs tests. Total pipeline time: under 30 seconds for most projects.

Cross-Compilation Matrix

Build for all 5 supported targets in parallel:

yaml
name: Release
on:
  push:
    tags: ['v*']

jobs:
  build:
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: linux-x86_64
            artifact: app-linux-x86_64
          - os: ubuntu-latest
            target: linux-aarch64
            artifact: app-linux-aarch64
          - os: macos-latest
            target: macos-x86_64
            artifact: app-macos-x86_64
          - os: macos-latest
            target: macos-aarch64
            artifact: app-macos-aarch64
          - os: ubuntu-latest
            target: windows-x86_64
            artifact: app-windows-x86_64.exe

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4

      - name: Install Wyn
        run: curl -fsSL https://wynlang.com/install.sh | sh

      - name: Build
        run: wyn build main.wyn --release --target ${{ matrix.target }} -o ${{ matrix.artifact }}

      - name: Upload
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.artifact }}
          path: ${{ matrix.artifact }}

All 5 targets build in parallel. Each takes ~15-30 seconds.

Docker Build and Push

Build a Docker image and push to a container registry on every tag:

yaml
name: Docker
on:
  push:
    tags: ['v*']

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Log in to registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}

Pair this with the Docker deployment guide for the Dockerfile.

Test and Lint

yaml
- name: Type check
  run: wyn check src/

- name: Run tests
  run: wyn test tests/

- name: Check formatting
  run: wyn fmt --check src/

wyn check runs the type checker without compiling — catches type mismatches, undefined variables, and wrong argument counts in ~200ms.

Deploy on Push to Main

Combine CI with wyn deploy for automatic deployment:

yaml
name: Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Wyn
        run: curl -fsSL https://wynlang.com/install.sh | sh

      - name: Build
        run: wyn build main.wyn --release --target linux-x86_64 -o app

      - name: Deploy to server
        env:
          SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
        run: |
          mkdir -p ~/.ssh
          echo "$SSH_KEY" > ~/.ssh/id_ed25519
          chmod 600 ~/.ssh/id_ed25519
          scp -o StrictHostKeyChecking=no app [email protected]:/opt/myapp/app
          ssh [email protected] "sudo systemctl restart myapp"

Caching

Wyn doesn't have a dependency cache like node_modules or target/ — the compiler is self-contained. But you can cache the Wyn installation:

yaml
- name: Cache Wyn
  uses: actions/cache@v4
  with:
    path: ~/.wyn
    key: wyn-${{ runner.os }}

- name: Install Wyn
  run: |
    if [ ! -f ~/.wyn/bin/wyn ]; then
      curl -fsSL https://wynlang.com/install.sh | sh
    fi

This saves ~10 seconds on subsequent runs.

Pipeline Timing

Typical CI times for a 1,000-line Wyn project:

StepTime
Checkout~2s
Install Wyn (cached)~1s
wyn check~200ms
wyn build --release~1.5s
wyn test (50 tests)~3s
Upload artifact~2s
Total~10s

Compare that to Rust (~2-5 minutes) or a Node.js project with npm install (~30-60 seconds).

See Also

MIT License — v1.11