Skip to content

Commit

Permalink
ci(release): add auto deployments for all components with each merge …
Browse files Browse the repository at this point in the history
…to main (#186)
  • Loading branch information
abalias committed Nov 30, 2022
1 parent 2d43f97 commit 7a10054
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 349 deletions.
63 changes: 14 additions & 49 deletions .github/workflows/castor.yml
Expand Up @@ -6,65 +6,30 @@ concurrency:
group: ${{ github.head_ref }}${{ github.ref }}-castor
cancel-in-progress: true

# Default shell is `sh`
# which is old, use bourne-again version instead
defaults:
run:
shell: bash
working-directory: castor/lib

on:
# Run with every push to `main` branch
# Run with each PR opened vs Castor
push:
branches:
- main
- "main"
paths:
- ".github/workflows/castor.yml"
- ".github/workflows/scala-unit-tests.yml"
- "castor/**"
pull_request:
paths:
- ".github/workflows/castor.yml"
- ".github/workflows/scala-unit-tests.yml"
- "castor/**"

# Global environment variables for all jobs
env:
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}

jobs:
build-and-test-castor:
name: "Build and test Castor"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11

- name: Cache sbt
uses: coursier/cache-action@v6.3

- name: Run Scala formatter
run: sbt scalafmtCheckAll

- name: Build and test Castor
run: sbt test

- name: Aggregate test reports
if: always()
uses: ./.github/actions/aggregate-test-reports
with:
tests-dir: "castor/lib"

- name: Publish test results
# Publish even if the previous test step fails
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "castor/lib/target/test-reports/**/TEST-*.xml"
comment_title: "Castor Test Results"
check_name: "Castor Test Results"
uses: ./.github/workflows/scala-unit-tests.yml
with:
component-name: "Castor"
component-dir: "castor/lib"
secrets: inherit
release:
if: github.event_name == 'push'
uses: ./.github/workflows/release.yml
with:
release-component: "castor/lib""
secrets: inherit
67 changes: 17 additions & 50 deletions .github/workflows/iris-client.yml
Expand Up @@ -7,62 +7,29 @@ concurrency:
cancel-in-progress: true

on:
# Run with every push to `main` branch
# Run with each PR opened vs Mercury
pull_request:
paths:
- ".github/workflows/iris-client.yml"
- "iris/client/**"
push:
branches:
- "main"
paths:
- ".github/workflows/iris-client.yml"
- ".github/workflows/scala-unit-tests.yml"
- "iris/client/**"
pull_request:
paths:
- ".github/workflows/iris-client.yml"
- ".github/workflows/scala-unit-tests.yml"
- "iris/client/**"

env:
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}

defaults:
run:
shell: bash
working-directory: "iris/client/scala-client"

jobs:
build-and-test-iris-client:
name: "Build and test Iris client"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11

- name: Cache sbt
uses: coursier/cache-action@v6.3

- name: Run Scala formatter
run: |
sbt scalafmtCheckAll
- name: Build and test Iris client
run: sbt test

- name: Aggregate test reports
if: always()
uses: ./.github/actions/aggregate-test-reports
with:
tests-dir: "iris/client/scala-client"

- name: Publish test results
# Publish even if the test step fails
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "iris/client/scala-client/target/test-reports/**/TEST-*.xml"
comment_title: "Iris Client Test Results"
check_name: "Iris Client Test Results"
uses: ./.github/workflows/scala-unit-tests.yml
with:
component-name: "Iris Client"
component-dir: "iris/client/scala-client"
secrets: inherit
release:
if: github.event_name == 'push'
uses: ./.github/workflows/release.yml
with:
release-component: "iris/client/scala-client"
secrets: inherit
67 changes: 17 additions & 50 deletions .github/workflows/iris-service.yml
Expand Up @@ -7,62 +7,29 @@ concurrency:
cancel-in-progress: true

on:
# Run with every push to `main` branch
# Run with each PR opened vs Iris service
pull_request:
paths:
- ".github/workflows/iris-service.yml"
- "iris/service/**"
push:
branches:
- "main"
paths:
- ".github/workflows/iris-service.yml"
- ".github/workflows/scala-unit-tests.yml"
- "iris/service/**"
pull_request:
paths:
- ".github/workflows/iris-service.yml"
- ".github/workflows/scala-unit-tests.yml"
- "iris/service/**"

env:
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}

defaults:
run:
shell: bash
working-directory: "iris/service"

jobs:
build-and-test-iris-service:
name: "Build and test Iris service"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11

- name: Cache sbt
uses: coursier/cache-action@v6.3

- name: Run Scala formatter
run: |
sbt scalafmtCheckAll
- name: Build and test Iris service
run: sbt test

- name: Aggregate test reports
if: always()
uses: ./.github/actions/aggregate-test-reports
with:
tests-dir: "iris/service"

- name: Publish test results
# Publish even if the test step fails
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "iris/service/target/test-reports/**/TEST-*.xml"
comment_title: "Iris Service Test Results"
check_name: "Iris Service Test Results"
uses: ./.github/workflows/scala-unit-tests.yml
with:
component-name: "Iris Service"
component-dir: "iris/service"
secrets: inherit
release:
if: github.event_name == 'push'
uses: ./.github/workflows/release.yml
with:
release-component: "iris/service"
secrets: inherit
84 changes: 17 additions & 67 deletions .github/workflows/mercury.yml
Expand Up @@ -7,79 +7,29 @@ concurrency:
cancel-in-progress: true

on:
# Run with every push to `main` branch
# Run with each PR opened vs Mercury
pull_request:
paths:
- ".github/workflows/mercury.yml"
- "mercury/**"
push:
branches:
- "main"
paths:
- ".github/workflows/mercury.yml"
- ".github/workflows/scala-unit-tests.yml"
- "mercury/**"
pull_request:
paths:
- ".github/workflows/mercury.yml"
- ".github/workflows/scala-unit-tests.yml"
- "mercury/**"

env:
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
SBT_PACKAGER: "enable" #just to test it loads
SBT_SCOVERAGE: "enable"

defaults:
run:
shell: bash
working-directory: "mercury/mercury-library"

jobs:
build-and-test-mercury:
name: "Build and test Mercury"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11

- name: Cache sbt
uses: coursier/cache-action@v6.3

- name: Run Scala formatter
run: |
sbt scalafmtCheckAll
- name: Build and test Mercury
run: SBT_SCOVERAGE=enable sbt clean coverage test coverageAggregate

- name: Aggregate test reports
if: always()
uses: ./.github/actions/aggregate-test-reports
with:
tests-dir: "mercury/mercury-library"

- name: Code coverage report
if: always()
uses: 5monkeys/cobertura-action@master
with:
path: "mercury/mercury-library/target/coverage/coverage-report/cobertura.xml"
report_name: "Mercury Code Coverage"
minimum_coverage: 10
fail_below_threshold: false

- name: Artifact coverage HTML
uses: actions/upload-artifact@v2
if: always()
with:
name: code-coverage-report-mercury
path: "mercury/mercury-library/target/coverage/scoverage-report"

- name: Publish test results
# Publish even if the test step fails
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "mercury/mercury-library/target/test-reports/**/TEST-*.xml"
comment_title: "Mercury Test Results"
check_name: "Mercury Test Results"
uses: ./.github/workflows/scala-unit-tests.yml
with:
component-name: "Mercury Lib"
component-dir: "mercury/mercury-library"
secrets: inherit
release:
if: github.event_name == 'push'
uses: ./.github/workflows/release.yml
with:
release-component: "mercury/mercury-library"
secrets: inherit

0 comments on commit 7a10054

Please sign in to comment.