Skip to content

FormatOps: in CtrlBodySplits, add consistency #4658

FormatOps: in CtrlBodySplits, add consistency

FormatOps: in CtrlBodySplits, add consistency #4658

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
release:
types: [published]
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
java: [ '11', '21' ]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JVM
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'sbt'
- run:
# for GitOps tests
git config --global user.email "scalafmt@scalameta.org" && git config --global user.name "scalafmt"
- run: TEST="2.12" sbt ci-test
shell: bash
- run: TEST="2.13" sbt ci-test
shell: bash
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'sbt'
- run: ./scalafmt --test
- run: yarn install
- run: yarn format-check
native-image:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-12, ubuntu-latest]
libc: [default, musl]
exclude:
- os: macOS-12
libc: musl
include:
- os: macOS-12
artifact: scalafmt-macos
env:
NATIVE_IMAGE_STATIC: false
- os: ubuntu-latest
libc: default
artifact: scalafmt-linux-glibc
env:
NATIVE_IMAGE_STATIC: true
- os: ubuntu-latest
libc: musl
artifact: scalafmt-linux-musl
env:
NATIVE_IMAGE_STATIC: true
NATIVE_IMAGE_MUSL: true
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v4
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '11'
components: 'native-image'
native-image-musl: ${{ matrix.libc == 'musl' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: bin/build-native-image.sh
env:
CI: true
- uses: actions/upload-artifact@master
with:
name: ${{ matrix.artifact }}
path: scalafmt
- name: Upload release
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: scalafmt
asset_name: ${{ matrix.artifact }}
asset_content_type: application/zip
dockerize:
needs: [native-image,test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && github.event_name != 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: scalameta/scalafmt
tags: type=semver,pattern={{raw}}
- name: Downloading scalafmt-linux-musl for Docker Build
uses: actions/download-artifact@v4
with:
name: scalafmt-linux-musl
path: tmp/scalafmt-linux-musl
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}