build #2638
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
pull_request: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ruby | |
bundler-cache: true | |
- name: Lint | |
run: bundle exec rake rubocop | |
spec: | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container.image != 'docker.io/nixos/nix:latest' && matrix.container || null }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
container: | |
- | |
vm: | |
- | |
ruby-version: | |
- '3.1' | |
- '3.2' | |
- '3.3' | |
- jruby | |
- truffleruby | |
- truffleruby+graalvm | |
exclude: | |
- os: windows-latest | |
ruby-version: truffleruby | |
- os: windows-latest | |
ruby-version: truffleruby+graalvm | |
include: | |
- os: ubuntu-latest | |
container: | |
image: docker.io/library/ruby:3.1-alpine | |
- os: ubuntu-latest | |
container: | |
image: docker.io/library/ruby:3.2-alpine | |
- os: ubuntu-latest | |
container: | |
image: docker.io/library/ruby:3.3-alpine | |
- os: ubuntu-latest | |
container: | |
image: docker.io/nixos/nix:latest | |
- os: ubuntu-latest | |
vm: freebsd | |
- os: ubuntu-latest | |
vm: openbsd | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup vm (freebsd) | |
if: matrix.vm == 'freebsd' | |
uses: vmactions/freebsd-vm@v1 | |
- name: Setup vm (openbsd) | |
if: matrix.vm == 'openbsd' | |
uses: vmactions/openbsd-vm@v1 | |
- name: Setup vm shell | |
if: matrix.vm | |
run: | | |
mkdir -p "$HOME/.local/bin" && tee "$HOME/.local/bin/bash" <<'EOF' && chmod a+x "$HOME/.local/bin/bash" | |
#!/bin/bash -- | |
exec ssh ${{ matrix.vm }} "cd $(printf %q "$PWD") && exec \"\$SHELL\"$(test $# -gt 0 && printf ' %q' "${@:1:$#-1}")" <"${@:$#}" | |
EOF | |
- name: Setup nix-shell | |
if: matrix.container.image == 'docker.io/nixos/nix:latest' | |
run: | | |
docker run --rm -dt --name nix --volume "$PWD:$PWD" ${{ matrix.container.image }} | |
mkdir -p "$HOME/.local/bin" && tee "$HOME/.local/bin/bash" <<'EOF' && chmod a+x "$HOME/.local/bin/bash" | |
#!/bin/bash -- | |
exec docker exec -i -w "$PWD" nix nix-shell --packages ruby --run "exec \"\$SHELL\"$(test $# -gt 0 && printf ' %q' "${@:1:$#-1}")" <"${@:$#}" | |
EOF | |
- name: Install dependencies (freebsd) | |
if: matrix.vm == 'freebsd' | |
run: pkg install -y node npm protobuf ruby rubygem-bundler rubygem-rake | |
- name: Install dependencies (openbsd) | |
if: matrix.vm == 'openbsd' | |
run: | | |
ruby=$(pkg_info -Q ruby | grep '^ruby-[0-9]' | sort -rV | head -n 1) | |
pkg_add node protobuf "$ruby" | |
pkg_info "$ruby" | grep 'ln -sf' | $SHELL | |
- name: Install dependencies (alpine) | |
if: endsWith(matrix.container.image, ':alpine') || endsWith(matrix.container.image, '-alpine') | |
run: apk add build-base | |
- name: Setup ruby | |
if: matrix.ruby-version | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
bundler-cache: true | |
- name: Bundle | |
if: "!matrix.ruby-version" | |
run: bundle install | |
- name: Compile | |
if: "!matrix.vm" | |
run: bundle exec rake compile | |
- name: Compile | |
if: matrix.vm | |
run: EMBEDDED_SASS_PROTOCOL=https://github.com/sass/sass/raw/HEAD/spec/embedded_sass.proto PROTOC_BIN=$(which protoc) bundle exec rake compile | |
- name: Spec | |
if: "!matrix.vm" # TODO: https://github.com/sass/dart-sass/pull/2413 | |
run: bundle exec rake spec | |
- name: Install | |
run: rake -f -r bundler/gem_tasks install | |
release: | |
if: github.event.repository.fork == false && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
needs: [lint, spec] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ruby | |
- name: Release | |
run: | | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git config user.name github-actions[bot] | |
rake -f -r bundler/gem_tasks release gem_push=no |