Skip to content

Commit

Permalink
build(CI): add shared setup action steps (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-vrijswijk authored Oct 15, 2024
1 parent 00b2dd3 commit be0882a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 36 deletions.
20 changes: 20 additions & 0 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Setup CI"

description: "Set up Java, sbt and cache for CI"

inputs:
java-version:
description: "The Java version to use"
default: "21"
required: false

runs:
using: "composite"
steps:
- uses: actions/setup-java@v4
name: Set up JDK
with:
distribution: "temurin"
java-version: "${{ inputs.java-version }}"
cache: "sbt"
- uses: sbt/setup-sbt@v1
42 changes: 6 additions & 36 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,15 @@ jobs:
# Fetch all tags
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: git fetch --tags
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- uses: ./.github/setup
- name: Compile code
run: sbt "compile; docs3/mdoc --check; mimaReportBinaryIssues"

formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- uses: ./.github/setup
- name: Check formatting
run: sbt scalafmtCheckAll

Expand All @@ -50,25 +40,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- uses: ./.github/setup
- name: Test
run: sbt test

test-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- uses: ./.github/setup
- uses: actions/setup-node@v4
with:
node-version: 20
Expand All @@ -87,12 +67,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- uses: ./.github/setup
- name: Run stryker
run: sbt 'project WeaponRegeX; stryker'
env:
Expand All @@ -112,13 +87,8 @@ jobs:
fetch-depth: 0
# Fetch all tags
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'sbt'
- run: git fetch --tags
- uses: ./.github/setup
- name: Set NPM Env
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish code
Expand Down

0 comments on commit be0882a

Please sign in to comment.