Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(CI): add shared setup action steps #403

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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