-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from lucidsoftware/ci
build: Add github actions
- Loading branch information
Showing
7 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "*.*" | ||
|
||
env: | ||
MYSQL_USER: root | ||
MYSQL_PASSWORD: root | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: corretto | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.ivy2 | ||
~/.sbt | ||
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | ||
- name: Start mysql | ||
run: sudo /etc/init.d/mysql start | ||
- name: Set SBT_OPTS | ||
run: bash generate_sbt_opts.sh | ||
- name: Build | ||
run: sbt package | ||
- name: Test | ||
run: sbt test | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: jars | ||
path: '*/target/**/*.jar' | ||
retention-days: 1 | ||
publish: | ||
if: ${{ github.event_name != 'pull_request' }} && (github.repository == 'lucidsoftware/java-thread-context') }} | ||
needs: build | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.ivy2 | ||
~/.sbt | ||
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | ||
- name: Set SBT_OPTS | ||
run: bash generate_sbt_opts.sh | ||
- name: Publish to Sonatype | ||
run: bash publish.sh | ||
env: | ||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
release: | ||
if: ${{ startsWith(github.ref, 'refs/tags') && (github.repository == 'lucidsoftware/relate') }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: jars | ||
- name: Upload Assets | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
set -x | ||
tag="${GITHUB_REF#refs/tags/}" | ||
targets=($(printf -- "-a %s " */target/**/*.jar)) | ||
hub release create "${targets[@]}" -m "Release $tag" $tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ Relate.sublime-project | |
Relate.sublime-workspace | ||
.ensime | ||
.history | ||
.bsp | ||
.idea* | ||
lib_managed/* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,23 +5,23 @@ lazy val `macros2.11` = macros("2.11.12") | |
lazy val `macros2.12` = macros("2.12.11") | ||
lazy val `macros2.13` = macros("2.13.2") | ||
lazy val macrosAggregate = macros.aggregate(`macros2.11`, `macros2.12`, `macros2.13`).settings( | ||
skip in publish := true | ||
publish / skip := true | ||
) | ||
|
||
lazy val relate = project.in(file("relate")).cross | ||
lazy val `relate2.11` = relate("2.11.12") | ||
lazy val `relate2.12` = relate("2.12.11") | ||
lazy val `relate2.13` = relate("2.13.2") | ||
lazy val relateAggregate = relate.aggregate(`relate2.11`, `relate2.12`, `relate2.13`).settings( | ||
skip in publish := true | ||
publish / skip := true | ||
) | ||
|
||
lazy val postgres = project.in(file("postgres")).cross.dependsOn(relate) | ||
lazy val `postgres2.11` = postgres("2.11.12") | ||
lazy val `postgres2.12` = postgres("2.12.11") | ||
lazy val `postgres2.13` = postgres("2.13.2") | ||
lazy val postgresAggregate = postgres.aggregate(`postgres2.11`, `postgres2.12`, `postgres2.13`).settings( | ||
skip in publish := true | ||
publish / skip := true | ||
) | ||
|
||
val benchmarkTag = Tags.Tag("benchmark") | ||
|
@@ -49,9 +49,9 @@ inScope(Global)(Seq( | |
"-feature" | ||
), | ||
scmInfo := Some(ScmInfo(url("https://github.com/lucidsoftware/relate"), "scm:git:[email protected]:lucidsoftware/relate.git")), | ||
tags in (Benchmark, test) += benchmarkTag -> 1, | ||
tags in (Benchmark, testOnly) += benchmarkTag -> 1, | ||
tags in (Benchmark, testQuick) += benchmarkTag -> 1, | ||
Benchmark / test / tags += benchmarkTag -> 1, | ||
Benchmark / testOnly / tags += benchmarkTag -> 1, | ||
Benchmark / testQuick / tags += benchmarkTag -> 1, | ||
version := sys.props.getOrElse("build.version", "0-SNAPSHOT") | ||
)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
if [[ $GITHUB_REF_TYPE = tag ]]; then | ||
version="${GITHUB_REF_NAME}" | ||
else | ||
version="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}-SNAPSHOT" | ||
fi | ||
echo "SBT_OPTS=-Dbuild.version=$version" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.3.3 | ||
sbt.version=1.8.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
addSbtPlugin("com.lucidchart" % "sbt-cross" % "4.0") | ||
|
||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") | ||
|
||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.18") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "$PGP_SECRET" | base64 --decode | gpg --import | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
command="; publishSigned; sonatypeBundleRelease" | ||
else | ||
command="publishSigned" | ||
fi | ||
echo "Running: sbt \"$command\"" | ||
exec sbt "$command" | ||
|