Skip to content

Commit

Permalink
Publish Athena to Maven Central (#57)
Browse files Browse the repository at this point in the history
* Publish Athena to Maven Central

* Publish Athena to Maven Central
  • Loading branch information
QubitPi authored Jan 12, 2024
1 parent e9ab19d commit d1e67f4
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 18 deletions.
55 changes: 46 additions & 9 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ jobs:
- uses: actionshub/markdownlint@main
with:
filesToIgnoreRegex: "docs/node_modules\\/.*"
# markdown-link-check:
# name: Markdown Link Check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: gaurav-nelson/github-action-markdown-link-check@v1
# with:
# use-verbose-mode: "yes"
markdown-link-check:
name: Markdown Link Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: "yes"

tests:
name: Unit & Integration Tests
needs: [yaml-lint, markdown-lint]
needs: [yaml-lint, markdown-lint, markdown-link-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -131,3 +131,40 @@ jobs:
context: athena-examples/athena-example-books
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/athena-example-books:latest

maven-release:
name: Publish Athena to Maven Central
if: github.ref == 'refs/heads/master'
needs: tests
runs-on: ubuntu-latest
permissions:
contents: write # allow for pushing tag
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # https://github.com/actions/checkout/issues/338#issuecomment-732300720
- name: Set up JDK
uses: QubitPi/hashicorp-aws/hashicorp/webservice/auxiliary/github/actions/jdk-setup@master
- name: Tag for release
run: |
git config --global user.name '$USER'
git config --global user.email '$EMAIL'
.github/tag-for-release.bash
- name: Set release version
run: |
VERSION=$(git describe)
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false
mvn versions:update-property -Dproperty=version.athena -DnewVersion=$VERSION -DgenerateBackupPoms=false
- name: Generate settings file
uses: whelk-io/maven-settings-xml-action@v20
with:
servers: >
[
{
"id": "ossrh",
"username": "${{ secrets.USERNAME }}",
"password": "${{ secrets.PASSWORD }}"
}
]
- name: Publish to Maven Central
run: mvn --batch-mode deploy
10 changes: 5 additions & 5 deletions docs/pages/guide/v1/08-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ The tests contain 2 parts

1. Groovy Spock unit tests on

- [Injected Query DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLQueryDataFetcherSpec.groovy)
- [Injected Mutation DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLMutationDataFetcherSpec.groovy)
- [Injected Query DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLQueryDataFetcherSpec.groovy)
- [Injected Mutation DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLMutationDataFetcherSpec.groovy)

2. Live DB tests on endpoints

- In [file servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/web/endpoints/FileServletSpec.groovy)
- In [file servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/web/endpoints/FileServletSpec.groovy)
and
[meta data servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/web/endpoints/MetaServletSpec.groovy),
[Flyway migration](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLDBResourceManager.groovy)
[meta data servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/web/endpoints/MetaServletSpec.groovy),
[Flyway migration](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLDBResourceManager.groovy)
injects real data into a Derby in-meomroy SQL DB
- The Derby data is injected via a shared [DBCP DataSource](#reference---apache-commons-dbcp2) declared in
[application BinderFactory](../../../../athena-examples/athena-example-books/src/main/java/org/qubitpi/athena/example/books/application/BooksBinderFactory.java)
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/guide/v1/14-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ is carried out using
<img src="../../../assets/img/class-diagram.png" class="img-fluid" alt="Error loading class-diagram.png" width="100%">

Each
[`***ServletSpec.groovy`](https://github.com/QubitPi/athena/tree/master/athena-core/src/test/groovy/com/qubitpi/athena/web/endpoints)
[`***ServletSpec.groovy`](https://github.com/QubitPi/athena/tree/master/athena-core/src/test/groovy/org/qubitpi/athena/web/endpoints)
follows the following pattern to setup, run, and shutdown tests:

### 1. Initialize ApplicationState
Expand Down
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
</licenses>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>github</id>
<name>GitHub QubitPi Apache Maven Packages</name>
<url>https://maven.pkg.github.com/QubitPi/athena</url>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -588,6 +591,18 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit d1e67f4

Please sign in to comment.