Skip to content

Commit

Permalink
github actions, run CI on macos and windows as well
Browse files Browse the repository at this point in the history
- ignore whitespace and blank lines when diffing (matches digesting logic)
  • Loading branch information
oyvindberg committed Nov 15, 2022
1 parent 0e70c00 commit 6789cd6
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 56 deletions.
54 changes: 0 additions & 54 deletions .circleci/config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
87 changes: 87 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI Build
on:
pull_request:
branches: [ 'master' ]

jobs:
scalafmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: coursier/[email protected]
with:
apps: scalafmt

- uses: coursier/cache-action@v6

- name: Scalafmt
run: scalafmt -c .scalafmt.conf --check

build:
name: CI Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: coursier/cache-action@v6

- uses: coursier/[email protected]
with:
jvm: adopt:11
apps: sbt

- name: Get tests folder sha
id: get-tests-folder-sha
run: |
echo "::set-output name=sha::$(git ls-tree HEAD tests --object-only)"
- uses: actions/cache@v3
with:
path: test-cache
key: ${{ runner.os }}-${{ steps.get-tests-folder-sha.outputs.sha }}-test-cache-v1

- name: Build and test
run: sbt test
env:
CI: true
CI_TEST_CACHE: ../test-cache

# commented out while I figure out how to speed it up or when to run it
# sbt-scripted-tests:
# name: Run sbt scripted tests
# runs-on: ubuntu-latest
# timeout-minutes: 25
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - uses: coursier/cache-action@v6
#
# # cache artifacts within same date. should help a bit with the compile time
# - name: Get timestamp
# id: get-date
# run: |
# echo "::set-output name=time::$(date +%yy-%m-%d)"
#
# - uses: actions/cache@v3
# with:
# path: ~/.ivy2/local/org.scalablytyped
# key: scripted-v1-${{ steps.get-date.outputs.time }}
#
# - uses: coursier/[email protected]
# with:
# jvm: adopt:11
# apps: sbt
#
# - name: Run scripted
# run: sbt scripted
18 changes: 18 additions & 0 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# note that the proper release is made manually with the release script because it's
# a heavy operation (builds all demo repos)
# that's why we don't trigger on tag
name: Release snapshot
on:
push:
branches: [ 'master' ]
jobs:
release-snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- uses: coursier/[email protected]
apps: sbt

- name: publish snapshot
run: sbt ci-release
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private object GitLock

sealed trait Mode
object Mode {
val isCi = sys.env.contains("CIRCLECI")
val isCi = sys.env.contains("CI")
val isRelease = sys.env.contains("CI_COMMIT_TAG")
val isLocalhost = !isCi
def releaseOnly = if (isLocalhost || isRelease) RunDontStore else Skip
Expand All @@ -39,7 +39,14 @@ object Mode {
}

trait ImporterHarness extends AnyFunSuite {
val baseDir = constants.defaultCacheFolder / 'tests
val baseDir = sys.env.get("CI_TEST_CACHE") match {
case Some(value) if value.startsWith("/") || value.contains(":") =>
os.Path(value)
case Some(value) =>
os.pwd / os.RelPath(value)
case None =>
constants.defaultCacheFolder / 'tests
}
val failureCacheDir = baseDir / 'compileFailures
os.makeDir.all(failureCacheDir)

Expand Down

0 comments on commit 6789cd6

Please sign in to comment.