Skip to content

ci: add GitHub Actions workflow #6

ci: add GitHub Actions workflow

ci: add GitHub Actions workflow #6

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure Windows C compiler
if: runner.os == 'Windows'
shell: pwsh
run: '"MOON_CC=cl.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append'
- name: Install MoonBit
if: runner.os != 'Windows'
shell: bash
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> "$GITHUB_PATH"
echo "MOON_HOME=$HOME/.moon" >> "$GITHUB_ENV"
- name: Install MoonBit
if: runner.os == 'Windows'
shell: pwsh
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
"$env:USERPROFILE\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
"MOON_HOME=$env:USERPROFILE\.moon" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Show MoonBit version
run: moon version --all
- name: Update package registry
run: moon update
- name: Check formatting
run: moon fmt --check
- name: Check packages
run: moon check
- name: Run tests
run: moon test
- name: Generate interfaces
if: runner.os != 'Windows'
run: moon info
- name: Verify generated files are current
if: runner.os != 'Windows'
run: git diff --exit-code