forked from tgodzik/scalafmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project structure was changed in compliance with sbt-crossproject. googlecode's diffutils had to be removed, as Scala Native does not support java libraries. In it's place, part of diffutils was reimplemented in scala as part of scalafmt-cli. For similar reasons, the java interfaces were reimplemented in scala for Scala Native. Since Scala Native does not yet support glob expressions, a translation function to regex was added, heavily based on a linked stack-overflow answer. SN's regex implementation is currently based on the re2 instead of the standard java regexes. This means there are a number of differences between them, most notably the lack of backtracking in Scala Native. To accomodate that, some regex function reimplementations were done to accomodate the use of the existing scalafmt regexes in Scala Native. Some operations concerning tests were slightly modified to work on Native. For example, renaming a file to an existing directory path could throw errors. This is fine, as it does not concern the core of the test, only things like cleanup. Assumptions about dynamic tests not working on native were added. Scala Native does not support URLs and only has basic reflection support comparable to the one of GraalVM, so the used and expected version of scalafmt must match here as well. Term Display was made single-threaded for the Scala Native implementation, as it does not support concurrency. Since the new implementation caused display artifacts on JVM, the old multithreaded one was kept there. Scala Native setup and testing was added to the CI. The windows was temporarily disabled as it does not pass all of the tests. scala-native sbt command was added for easier scala-native cli building. Co-authored-by: Tomasz Godzik <[email protected]>
- Loading branch information
Showing
64 changed files
with
2,492 additions
and
708 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,38 @@ jobs: | |
- run: | ||
# for GitOps tests | ||
git config --global user.email "[email protected]" && git config --global user.name "scalafmt" | ||
- run: TEST="2.12" sbt ci-test | ||
- run: TEST="2.12" sbt ci-test-jvm | ||
shell: bash | ||
- run: TEST="2.13" sbt ci-test | ||
- run: TEST="2.13" sbt ci-test-jvm | ||
shell: bash | ||
test-scala-native: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macOS-latest, ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: olafurpg/setup-scala@v13 | ||
with: | ||
java-version: [email protected] | ||
- if: matrix.os == 'windows-latest' | ||
name: setup windows environment | ||
run: ./bin/scala-native-setup/windows-setup.sh | ||
- if: matrix.os == 'macOS-latest' | ||
name: setup macOS environment | ||
run: ./bin/scala-native-setup/macos-setup.sh | ||
- if: matrix.os == 'ubuntu-latest' | ||
name: setup ubuntu environment | ||
run: ./bin/scala-native-setup/ubuntu-setup.sh | ||
- name: run tests | ||
run: | | ||
git fetch --tags -f | ||
# for GitOps tests | ||
git config --global user.email "[email protected]" && git config --global user.name "scalafmt" | ||
- run: TEST="2.12" sbt ci-test-native | ||
shell: bash | ||
- run: TEST="2.13" sbt ci-test-native | ||
shell: bash | ||
formatting: | ||
runs-on: ubuntu-latest | ||
|
@@ -81,46 +110,46 @@ jobs: | |
- 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/[email protected] | ||
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@v2 | ||
- name: Docker Meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: scalameta/scalafmt | ||
tags: type=semver,pattern={{raw}} | ||
- name: Downloading scalafmt-linux-musl for Docker Build | ||
uses: actions/[email protected] | ||
with: | ||
name: scalafmt-linux-musl | ||
path: tmp/scalafmt-linux-musl | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
# - uses: actions/upload-artifact@master | ||
# with: | ||
# name: ${{ matrix.artifact }} | ||
# path: scalafmt | ||
# - name: Upload release | ||
# if: github.event_name == 'release' | ||
# uses: actions/[email protected] | ||
# 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@v2 | ||
# - name: Docker Meta | ||
# id: meta | ||
# uses: docker/metadata-action@v3 | ||
# with: | ||
# images: scalameta/scalafmt | ||
# tags: type=semver,pattern={{raw}} | ||
# - name: Downloading scalafmt-linux-musl for Docker Build | ||
# uses: actions/[email protected] | ||
# with: | ||
# name: scalafmt-linux-musl | ||
# path: tmp/scalafmt-linux-musl | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} | ||
# - name: Build and push | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: . | ||
# push: true | ||
# tags: ${{ steps.meta.outputs.tags }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apt-get install -y clang-12.0 | ||
PATH=/usr/lib/llvm-12.0/bin:${PATH} | ||
clang --version |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apt-get install -y clang-12.0 | ||
PATH=/usr/lib/llvm-12.0/bin:${PATH} | ||
clang --version |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
choco install llvm | ||
echo "${env:ProgramFiles}\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
clang --version |
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
Oops, something went wrong.