From 568620e10e8964cc0aa887e900886e269bef2e2c Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Wed, 8 Jan 2025 17:12:23 +0000 Subject: [PATCH] solution: CI setup --- .github/workflows/publish.yaml | 62 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 32 ++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..6f5fd7b --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,62 @@ +name: Publish + +on: + release: + types: [created] + +jobs: + publish-github: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + ref: ${{ github.ref }} + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 21 + - name: Check + uses: eskatos/gradle-command-action@v1 + with: + arguments: check + - name: Build + uses: eskatos/gradle-command-action@v1 + with: + arguments: build + - name: Sync Jars + uses: eskatos/gradle-command-action@v1 + with: + arguments: syncJars + - name: Upload Jars + id: upload-release-asset + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} + file: ./build/libs/*.jar + file_glob: true + + publish-gcp-artifacts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + ref: ${{ github.ref }} + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 21 + - name: Check + uses: eskatos/gradle-command-action@v1 + with: + arguments: check + - name: Setup GCP + uses: google-github-actions/setup-gcloud@v0 + with: + project_id: ${{ secrets.GCP_PROJECT_ID }} + service_account_key: ${{ secrets.GCP_ARTIFACTS_KEY }} + export_default_credentials: true + - name: Upload to GCP + uses: eskatos/gradle-command-action@v1 + with: + arguments: publish \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..e0089ad --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,32 @@ +name: Tests + +on: + # if pushed directly to the master + push: + branches: + - master + - release/* + - ci/* + # on a pull request + pull_request: + branches: + - master + - release/* + - ci/* + +jobs: + unit-test: + name: Standard Unit Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 21 + + - name: Check + uses: eskatos/gradle-command-action@v1 + with: + arguments: check \ No newline at end of file