Merge pull request #2 from AndrewQuijano/main #50
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
name: Build Gradle project | |
on: | |
push: | |
jobs: | |
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ | |
create_release: | |
if: github.repository == 'AndrewQuijano/Homomorphic_Encryption' && github.ref == 'refs/heads/main' | |
needs: [test-gradle-project] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
v-version: ${{ steps.version.outputs.v-version }} | |
steps: | |
- name: Get next version | |
uses: reecetech/version-increment@2023.10.2 | |
id: version | |
with: | |
release_branch: main | |
use_api: true | |
increment: patch | |
# Only create a release on main branch, should update to adwise-fiu eventually. | |
upload_release: | |
if: github.repository == 'AndrewQuijano/Homomorphic_Encryption' && github.ref == 'refs/heads/main' | |
needs: [create_release, test-gradle-project] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project sources | |
uses: actions/checkout@v4 | |
- name: Create JAR file | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
cache: 'gradle' | |
- run: sh gradlew jar | |
- name: Release the JAR file | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.create_release.outputs.v-version }} | |
files: build/libs/crypto.jar | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# all branches should be testing code | |
test-gradle-project: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project sources | |
uses: actions/checkout@v4 | |
- name: Setup Gradle | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
cache: 'gradle' | |
- run: sh gradlew build | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |