Skip to content

Commit

Permalink
Merge pull request #91 from chatwork/feature/sbt-ci-release
Browse files Browse the repository at this point in the history
add support for sbt-ci-release
  • Loading branch information
j5ik2o authored Jul 21, 2021
2 parents 60f3353 + ce677a8 commit e96c468
Show file tree
Hide file tree
Showing 50 changed files with 355 additions and 175 deletions.
35 changes: 0 additions & 35 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @j5ik2o @exoego
6 changes: 6 additions & 0 deletions .github/clean-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

rm -rf "$HOME/.ivy2/local" || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
59 changes: 59 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Bump Version
on:
workflow_dispatch:
inputs:
force:
description: 'force release'
required: false
default: '0'
schedule:
- cron: '0 0 * * *'
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
persist-credentials: false
token: ${{ secrets.CW_SCALA_STEWARD_TOKEN }}
- name: Calculate changes from the latest tag to HEAD
id: changes
run: |
LATEST_TAG=$(git describe --abbrev=0 --tags)
echo "latest-tag = $LATEST_TAG"
COUNT=$(git log $LATEST_TAG..HEAD --pretty=format:"%s" --no-merges \
--grep='^build:' \
--grep='^ci:' \
--grep='^feat:' \
--grep='^fix:' \
--grep='^docs:' \
--grep='^style:' \
--grep='^refactor:' \
--grep='^perf:' \
--grep='^test:' \
--grep='^revert:' \
--grep='^chore:' | awk 'END{print NR}')
echo "steps.changes.outputs.count = $COUNT"
FORCE=${{ github.event.inputs.force }}
if [[ "$FORCE" = "1" ]]; then
echo "::set-output name=count::1"
else
echo "::set-output name=count::$COUNT"
fi
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.CW_SCALA_STEWARD_TOKEN }}
default_bump: patch
if: steps.changes.outputs.count > 0
- name: Create a GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.CW_SCALA_STEWARD_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
if: steps.changes.outputs.count > 0
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI
on:
push:
branches:
- main
paths:
- '**.scala'
- '**.java'
- '**.sbt'
- '.scalafmt.conf'
- '.github/workflows/ci.yml'
pull_request:
branches:
- main
paths:
- '**.scala'
- '**.java'
- '**.sbt'
- '.scalafmt.conf'
- '.github/workflows/ci.yml'
schedule:
- cron: '0 * * * *'
jobs:
lint:
runs-on: ubuntu-latest
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
with:
java-version: "[email protected]"
- uses: coursier/cache-action@v6
- run: sbt -v lint
- name: clean up
run: "${GITHUB_WORKSPACE}/.github/clean-up.sh"
test:
strategy:
fail-fast: false
matrix:
jdk: [ [email protected], [email protected], [email protected] ]
scala: [ 3.0.1, 2.13.5, 2.12.13 ]
runs-on: ubuntu-latest
needs: lint
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
AWS_REGION: ap-northeast-1
TEST_TIME_FACTOR: 3
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
with:
java-version: ${{ matrix.jdk }}
- uses: coursier/cache-action@v6
- uses: olafurpg/setup-gpg@v3
- name: sbt test
run: sbt -v ++${{ matrix.scala }} test
- name: clean up
run: "${GITHUB_WORKSPACE}/.github/clean-up.sh"
automerge:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: test
steps:
- name: automerge
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.CW_SCALA_STEWARD_TOKEN }}"
MERGE_LABELS: ""
MERGE_METHOD: "rebase"
MERGE_FILTER_AUTHOR: "cw-scala-steward"
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release
on:
push:
tags:
- v[1-9]+.[0-9]+.[0-9]+
jobs:
release:
runs-on: ubuntu-latest
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
with:
java-version: "[email protected]"
- uses: coursier/cache-action@v6
- uses: olafurpg/setup-gpg@v3
- run: sbt -v ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: clean up
run: "${GITHUB_WORKSPACE}/.github/clean-up.sh"
15 changes: 15 additions & 0 deletions .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Scala Steward
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
scala-steward:
runs-on: ubuntu-latest
steps:
- uses: scala-steward-org/scala-steward-action@v2
if: ${{ !github.event.repository.fork }}
with:
github-token: ${{ secrets.CW_SCALA_STEWARD_TOKEN }}
author-email: "[email protected]"
author-name: "cw-scala-steward"
32 changes: 32 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Snapshot
on:
workflow_run:
workflows:
- CI
types:
- completed
jobs:
snapshot:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
with:
java-version: "[email protected]"
- uses: coursier/cache-action@v6
- uses: olafurpg/setup-gpg@v3
- run: sbt -v ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: clean up
run: "${GITHUB_WORKSPACE}/.github/clean-up.sh"
2 changes: 2 additions & 0 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
updatePullRequests = "always"
commits.message = "build: Update ${artifactName} from ${currentVersion} to ${nextVersion}"
11 changes: 11 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rules = [
//Semantic Rules
//ExplicitResultTypes, // Deactivated as scalafix on Scala 3 fails otherwise
RemoveUnused,
NoAutoTupling,
//Syntactic Rules
DisableSyntax,
ProcedureSyntax,
LeakingImplicitClassVal,
NoValInForComprehension
]
21 changes: 11 additions & 10 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
version = 2.7.5
style = defaultWithAlign
danglingParentheses.preset = true
indentOperator.preset = spray
includeCurlyBraceInSelectChains = true
maxColumn = 120
rewrite.rules = [RedundantParens, SortImports, PreferCurlyFors]
spaces.inImportCurlyBraces = true
binPack.literalArgumentLists = false
unindentTopLevelOperators = true
version = 3.0.0-RC3
style = defaultWithAlign
danglingParentheses.preset = true
indentOperator.preset = spray
includeCurlyBraceInSelectChains = true
maxColumn = 120
rewrite.rules = [RedundantParens, SortImports, PreferCurlyFors]
spaces.inImportCurlyBraces = true
binPack.literalArgumentLists = false
unindentTopLevelOperators = true
optIn.breaksInsideChains = true
Loading

0 comments on commit e96c468

Please sign in to comment.