Skip to content

Commit

Permalink
run on GitHub Actions
Browse files Browse the repository at this point in the history
```
git rebase --strategy-option theirs scala-steward-org/main
```
  • Loading branch information
scala-steward-bot authored and xuwei-k committed Nov 27, 2024
1 parent f20d2a4 commit e906ada
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 418 deletions.
188 changes: 14 additions & 174 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Continuous Integration
name: CI

on:
pull_request:
branches: ['**']
push:
branches: ['**']
tags: [v*]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
workflow_dispatch:
schedule:
- cron: '30 */2 * * *'


concurrency:
Expand All @@ -24,166 +13,17 @@ concurrency:

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13]
java: [temurin@21, temurin@17, temurin@11]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@21)
id: setup-java-temurin-21
if: matrix.java == 'temurin@21'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@21' && steps.setup-java-temurin-21.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v4
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
distribution: adopt
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- uses: coursier/setup-action@v1
with:
apps: scalafmt

- name: Build project
run: sbt '++ ${{ matrix.scala }}' validate

- name: Codecov
uses: codecov/codecov-action@v3

- name: Make target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
run: mkdir -p target modules/docs/.jvm/target modules/dummy/.jvm/target modules/core/.jvm/target modules/benchmark/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
run: tar cf targets.tar target modules/docs/.jvm/target modules/dummy/.jvm/target modules/core/.jvm/target modules/benchmark/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@21]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@21)
id: setup-java-temurin-21
if: matrix.java == 'temurin@21'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@21' && steps.setup-java-temurin-21.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (2.13)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13

- name: Inflate target directories (2.13)
run: |
tar xf targets.tar
rm targets.tar
- name: Publish JARs
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ci-release

- name: Publish Docker image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sbt core/Docker/publish
- run: echo "${{ secrets.APP_PRIVATE_KEY }}" > key.pem
- uses: coursier/coursier-setup@v1
- run: cs install scalafmt
- run: cs install scalafix
- uses: sbt/setup-sbt@v1
- run: GITHUB_TOKEN=${{ secrets.MY_GITHUB_TOKEN }} sbt -v runSteward || true
59 changes: 0 additions & 59 deletions .github/workflows/clean.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-Xms4096m
-Xmx4096m
-Xss6m
23 changes: 9 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ val projectName = "scala-steward"
val rootPkg = groupId.replace("-", "")
val gitHubOwner = "scala-steward-org"
val gitHubUrl = s"https://github.com/$gitHubOwner/$projectName"
val mainBranch = "main"
val gitHubUserContent = s"https://raw.githubusercontent.com/$gitHubOwner/$projectName/$mainBranch"
val mainBranch = "master"
val gitHubUserContent = s"https://raw.githubusercontent.com/scala-steward-bot/scala-steward/cron"

val moduleCrossPlatformMatrix: Map[String, List[Platform]] = Map(
"benchmark" -> List(JVMPlatform),
Expand Down Expand Up @@ -299,6 +299,7 @@ def myCrossProject(name: String): CrossProject =
lazy val commonSettings = Def.settings(
compileSettings,
metadataSettings,
scalacOptions -= "-Xfatal-warnings",
scaladocSettings
)

Expand Down Expand Up @@ -442,18 +443,12 @@ runSteward := Def.taskDyn {
val args = Seq(
Seq("--workspace", s"$projectDir/workspace"),
Seq("--repos-file", s"$projectDir/repos.md"),
Seq("--git-author-email", s"dev@$projectName.org"),
Seq("--forge-login", gitHubLogin),
Seq("--git-ask-pass", s"$home/.github/askpass/$gitHubLogin.sh"),
// Seq("--github-app-id", IO.read(gitHubAppDir / "scala-steward.app-id.txt").trim),
// Seq("--github-app-key-file", s"$gitHubAppDir/scala-steward.private-key.pem"),
Seq("--whitelist", s"$home/.cache/coursier"),
Seq("--whitelist", s"$home/.cache/JNA"),
Seq("--whitelist", s"$home/.cache/mill"),
Seq("--whitelist", s"$home/.ivy2"),
Seq("--whitelist", s"$home/.m2"),
Seq("--whitelist", s"$home/.mill"),
Seq("--whitelist", s"$home/.sbt")
Seq("--git-author-email", "[email protected]"),
Seq("--forge-login", "scala-steward-bot"),
Seq("--git-ask-pass", s"$projectDir/git_ask_pass.sh"),
Seq("--disable-sandbox"),
Seq("--github-app-id", "89853"),
Seq("--github-app-key-file", s"$projectDir/key.pem")
).flatten.mkString(" ", " ", "")
(core.jvm / Compile / run).toTask(args)
}.value
Expand Down
1 change: 1 addition & 0 deletions git_ask_pass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo ${GITHUB_TOKEN}
Loading

0 comments on commit e906ada

Please sign in to comment.