diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml deleted file mode 100644 index 346e5ea..0000000 --- a/.gitea/workflows/build.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build -on: - workflow_run: - workflows: ["Tests"] - types: - - completed -jobs: - execute-tests: - runs-on: ubuntu-latest - steps: - - name: Set running - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/${{ gitea.workflow }}","status":"running"}' - - name: Checkout - uses: actions/checkout@v4 - - name: Set up java - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Build - id: build - run: ./gradlew build -x test - - name: Publish status - if: always() - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/${{ gitea.workflow }}","status":"${{ steps.build.conclusion }}"}' \ No newline at end of file diff --git a/.gitea/workflows/init.yaml b/.gitea/workflows/init.yaml deleted file mode 100644 index 83b5d9a..0000000 --- a/.gitea/workflows/init.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Init -on: [push] -jobs: - execute-tests: - runs-on: ubuntu-latest - steps: - - name: Reset test status - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/Tests","status":"starting"}' - - name: Reset build status - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/Build","status":"waiting for test"}' \ No newline at end of file diff --git a/.gitea/workflows/tests.yaml b/.gitea/workflows/tests.yaml deleted file mode 100644 index cfb5f37..0000000 --- a/.gitea/workflows/tests.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Tests -on: - workflow_run: - workflows: ["Init"] - types: - - completed -jobs: - execute-tests: - runs-on: ubuntu-latest - steps: - - name: Set running - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/${{ gitea.workflow }}","status":"running"}' - - name: Checkout - uses: actions/checkout@v4 - - name: Set up java - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Run tests - id: tests - run: ./gradlew test - - name: Publish status - if: always() - run: | - curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ - -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ - -H 'Content-Type: application/json' \ - -d '{"action":"${{ gitea.repository }}/action/${{ gitea.workflow }}","status":"${{ steps.tests.conclusion }}"}' \ No newline at end of file diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml new file mode 100644 index 0000000..2c3330e --- /dev/null +++ b/.gitea/workflows/workflow.yaml @@ -0,0 +1,72 @@ +name: Tests +on: [push] +jobs: + reset-status: + runs-on: ubuntu-latest + steps: + - name: Reset test status + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/tests","status":"starting"}' + - name: Reset build status + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/build","status":"waiting for test"}' + tests: + needs: reset-status + runs-on: ubuntu-latest + steps: + - name: Set test running + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/tests","status":"running"}' + - name: Checkout + uses: actions/checkout@v4 + - name: Set up java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Run tests + id: tests + run: ./gradlew test + - name: Publish test status + if: always() + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/tests","status":"${{ steps.tests.conclusion }}"}' + build: + needs: tests + runs-on: ubuntu-latest + steps: + - name: Set build running + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/build","status":"running"}' + - name: Checkout + uses: actions/checkout@v4 + - name: Set up java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build + id: build + run: ./gradlew build -x test + - name: Publish build status + if: always() + run: | + curl -v -X POST https://barrelsofdata.com/api/v1/git/action/status/publish \ + -H 'X-API-KEY: ${{ secrets.STATUS_PUBLISH_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{"action":"${{ gitea.repository }}/action/build","status":"${{ steps.build.conclusion }}"}' \ No newline at end of file diff --git a/README.md b/README.md index 561d32a..3bc73f8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Tests](https://barrelsofdata.com/api/v1/git/action/status/fetch/barrelsofdata/spark-boilerplate/Tests)](https://git.barrelsofdata.com/barrelsofdata/spark-boilerplate/actions?workflow=tests.yaml) -[![Build](https://barrelsofdata.com/api/v1/git/action/status/fetch/barrelsofdata/spark-boilerplate/Build)](https://git.barrelsofdata.com/barrelsofdata/spark-boilerplate/actions?workflow=build.yaml) +[![Tests](https://barrelsofdata.com/api/v1/git/action/status/fetch/barrelsofdata/spark-boilerplate/tests)](https://git.barrelsofdata.com/barrelsofdata/spark-boilerplate/actions?workflow=workflow.yaml) +[![Build](https://barrelsofdata.com/api/v1/git/action/status/fetch/barrelsofdata/spark-boilerplate/build)](https://git.barrelsofdata.com/barrelsofdata/spark-boilerplate/actions?workflow=workflow.yaml) # Spark Boilerplate This is a boilerplate project for Apache Spark. The related blog post can be found at [https://www.barrelsofdata.com/spark-boilerplate-using-scala](https://www.barrelsofdata.com/spark-boilerplate-using-scala)