diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 5ae388ee2..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,73 +0,0 @@ -version: 2.1 - -jobs: - test: - docker: - - image: circleci/openjdk:11 - steps: - - checkout - - run: ./gradlew check - shadow_jar: - docker: - - image: circleci/openjdk:11 - steps: - - checkout - - run: ./gradlew shadowJar - - persist_to_workspace: - root: build - paths: - - libs/stellar-sdk.jar - deploy: - docker: - - image: cimg/go:1.17 - steps: - - attach_workspace: - at: ./build - - run: - name: "Install github.com/github-release/github-release v0.10.0" - command: | - go get github.com/github-release/github-release@v0.10.0 - - run: - name: "Upload JAR to GitHub Release" - command: | - github-release upload -s ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -f ./build/libs/stellar-sdk.jar -n java-stellar-sdk.jar - - after_deploy: - docker: - - image: circleci/openjdk:11 - steps: - - checkout - - run: ./after_deploy.sh - -workflows: - version: 2 - test-and-deploy: - jobs: - - test: - filters: # required since `deploy` has tag filters AND requires `build` - tags: - only: /.*/ - - shadow_jar: - requires: - - test - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ - - deploy: - requires: - - shadow_jar - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ - - after_deploy: - requires: - - deploy - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 000000000..80e146490 --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -0,0 +1,98 @@ +name: "Test and Deploy" + +on: + push: + branches: [ master ] + pull_request: + release: + types: + - created + +env: + JAVA_VERSION: '11' + JAVA_DISTRIBUTION: 'microsoft' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Test + run: ./gradlew check + + shadow_jar: + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Build JAR + run: ./gradlew shadowJar + - name: Persist JAR Artifact + uses: actions/upload-artifact@v3 + with: + name: jar + path: build/libs/stellar-sdk.jar + + javadoc: + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Generate Documentation + run: ./gradlew javadoc + - name: Persist Documentation + uses: actions/upload-artifact@v3 + with: + name: javadoc + path: javadoc + + deploy: + needs: [ shadow_jar, javadoc ] + permissions: + contents: write + if: github.event_name == 'release' && github.event.action == 'created' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Download JAR Artifact + uses: actions/download-artifact@v2 + with: + name: jar + path: jar + - name: Download Java Documentation + uses: actions/download-artifact@v2 + with: + name: javadoc + path: javadoc + - name: Archive Documentation + run: tar -czf stellar-sdk-javadoc.tar.gz javadoc + - name: Upload artifacts to GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: | + jar/stellar-sdk.jar + stellar-sdk-javadoc.tar.gz + - name: Upload Documentation to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: javadoc + diff --git a/after_deploy.sh b/after_deploy.sh deleted file mode 100755 index 4df2347b8..000000000 --- a/after_deploy.sh +++ /dev/null @@ -1,16 +0,0 @@ -echo "machine github.com login stellar-jenkins password $GITHUB_TOKEN" >~/.netrc -git clone -b gh-pages "https://stellar-jenkins@github.com/stellar/java-stellar-sdk.git" javadoc - -if [ ! -d "javadoc" ]; then - echo "Error cloning" - exit 1 -fi - -rm -rf javadoc/* # Remove all files without hidden (.git) -javadoc -public -splitindex -windowtitle "java-stellar-sdk documentation" -d ./javadoc -sourcepath ./src/main/java/ -subpackages org.stellar.sdk -exclude org.stellar.sdk.xdr -cd javadoc -git config user.name "post-release-script" -git config user.email "post-release-script@stellar.org" -git add . -git commit -m $CIRCLE_TAG -git push origin gh-pages diff --git a/build.gradle b/build.gradle index b52c646e7..b59e585d3 100644 --- a/build.gradle +++ b/build.gradle @@ -102,4 +102,16 @@ tasks.register('updateGitHook', Copy) { rename { fileName -> fileName.endsWith('.sh') ? fileName[0..-4] : fileName } +} + +tasks.javadoc { + destinationDir = file('javadoc') + failOnError = true + exclude("org/stellar/sdk/xdr/**") + // cast options to StandardJavadocDocletOptions + // https://docs.gradle.org/current/javadoc/org/gradle/external/javadoc/StandardJavadocDocletOptions.html + StandardJavadocDocletOptions options = options as StandardJavadocDocletOptions + options.setSplitIndex(true) + options.setMemberLevel(JavadocMemberLevel.PUBLIC) + options.setEncoding('UTF-8') } \ No newline at end of file