Skip to content

Build Windows and macOS binaries in GitHub Actions #143

Build Windows and macOS binaries in GitHub Actions

Build Windows and macOS binaries in GitHub Actions #143

Workflow file for this run

name: Continuous integration
on: [push, pull_request]
jobs:
assets:
name: Build assets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install JS dependencies
run: pnpm install
- name: Format UI assets
run: pnpm fmt:check
- name: Build UI assets
run: pnpm build
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache Rust
uses: ./.github/actions/cargo-cache
with:
key: assets
- name: Convert assets to Rust
run: cargo xtask assets
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: assets
path: src/html/assets.rs
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.77 # MSRV
- stable
- nightly
needs: assets
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download assets
uses: actions/download-artifact@v4
with:
name: assets
path: src/html
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache Rust
uses: ./.github/actions/cargo-cache
with:
key: build-${{ matrix.rust }}
- name: Build code
run: cargo build
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.rust }}
path: target/debug/margo
check:
name: Check
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download assets
uses: actions/download-artifact@v4
with:
name: assets
path: src/html
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Rust
uses: ./.github/actions/cargo-cache
with:
key: check
lockfiles: |-
Cargo.lock
conformance/Cargo.lock
targets: |-
target
conformance/target
- name: Download binary
uses: actions/download-artifact@v4
with:
name: binary-stable
path: .
- name: Register binary
run: |
MARGO_BINARY="$(pwd)/margo"
chmod +x "${MARGO_BINARY}"
echo "MARGO_BINARY=${MARGO_BINARY}" >> $GITHUB_ENV
echo "${MARGO_BINARY}"
"${MARGO_BINARY}" --help
- name: Format code
run: cargo fmt --all -- --check
- name: Lint code
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Test binary
run: cargo test
- name: Test conformance
run: cd conformance && cargo run
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: integration-tests
bundler-cache: true
- name: Lint UI Tests
run: cd integration-tests && bundle exec rubocop
- name: Test UI
run: cd integration-tests && bundle exec rspec