/swiftwasm-action

GitHub Action with SwiftWasm toolchain and SDK preinstalled

Primary LanguageDockerfileApache License 2.0Apache-2.0

Warning

Deprecated: This Action is no longer necessary. Please use swiftwasm/setup-swiftwasm and carton version 1.0.0 or later.

See pointfreeco/swift-custom-dump#113 as an example of migration

SwiftWasm GitHub Action

This action builds your project with the SwiftWasm toolchain and SDK, and has carton and its WebAssembly dependencies preinstalled.

Inputs

shell-action

Optional The shell command to run on your project. Default is carton test.

Example usage

name: Build and test with SwiftWasm

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  swiftwasm_build:
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v3
      - uses: swiftwasm/swiftwasm-action@v5.9
        with:
          shell-action: carton test

Usage with GitHub Pages

GitHub Pages is an easy way to host SwiftWasm apps. Follow the GitHub Pages guide, and then use an appropriate action after running carton bundle to publish the results:

name: Deploy to GitHub Pages

on:
  push:
    branches: [main]

jobs:
  swiftwasm_deploy:
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v3

      - uses: swiftwasm/swiftwasm-action@v5.9
        with:
          shell-action: carton bundle
      - uses: actions/upload-pages-artifact@v1
        with:
          path: ./Bundle

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - id: deployment
        uses: actions/deploy-pages@v2