adding logic for group generation for Continuous replication (#2883) #284
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
# Starter workflow to use github-actions ci. This checks out repository, builds and runs unit tests. | |
# Reference: https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle | |
name: Github Actions CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Ambry | |
uses: actions/checkout@v2 | |
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Set up MySQL | |
run: | | |
sudo systemctl start mysql.service | |
mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot | |
mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot | |
- name: Add custom MySQL user | |
# Temporary settings to use same username and password as travis ci | |
run: | | |
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
- name: Install and run Azurite | |
run: | | |
killall azurite || true | |
npm install -g azurite | |
azurite --silent & | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Run unit tests excluding ambry-store | |
with: | |
job-id: jdk11 | |
arguments: --scan -x :ambry-store:test build codeCoverageReport | |
gradle-version: wrapper | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
timeout-minutes: 2 | |
store-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Ambry | |
uses: actions/checkout@v2 | |
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Run unit tests for ambry-store | |
with: | |
job-id: jdk11 | |
arguments: --scan :ambry-store:test codeCoverageReport | |
gradle-version: wrapper | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
timeout-minutes: 2 | |
int-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Ambry | |
uses: actions/checkout@v2 | |
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Set up MySQL | |
run: | | |
sudo systemctl start mysql.service | |
mysql -e 'CREATE DATABASE AccountMetadata;' -uroot -proot | |
mysql -e 'USE AccountMetadata; SOURCE ./ambry-account/src/main/resources/AccountSchema.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot -proot | |
mysql -e 'USE ambry_container_storage_stats; SOURCE ./ambry-mysql/src/main/resources/AmbryContainerStorageStats.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot -proot | |
mysql -e 'USE AmbryNamedBlobs; SOURCE ./ambry-named-mysql/src/main/resources/NamedBlobsSchema.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot | |
mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot | |
- name: Add custom MySQL user | |
# Temporary settings to use same username and password as travis ci | |
run: | | |
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Run integration tests excluding server integration test | |
with: | |
job-id: jdk11 | |
arguments: --scan intTest -x :ambry-server:intTest codeCoverageReport | |
gradle-version: wrapper | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
timeout-minutes: 2 | |
server-int-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Ambry | |
uses: actions/checkout@v2 | |
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Set up MySQL | |
run: | | |
sudo systemctl start mysql.service | |
mysql -e 'CREATE DATABASE AccountMetadata;' -uroot -proot | |
mysql -e 'USE AccountMetadata; SOURCE ./ambry-account/src/main/resources/AccountSchema.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot -proot | |
mysql -e 'USE ambry_container_storage_stats; SOURCE ./ambry-mysql/src/main/resources/AmbryContainerStorageStats.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot -proot | |
mysql -e 'USE AmbryNamedBlobs; SOURCE ./ambry-named-mysql/src/main/resources/NamedBlobsSchema.ddl;' -uroot -proot | |
mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot | |
mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot | |
- name: Add custom MySQL user | |
# Temporary settings to use same username and password as travis ci | |
run: | | |
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Run integration tests | |
with: | |
job-id: jdk11 | |
arguments: --scan :ambry-server:intTest codeCoverageReport | |
gradle-version: wrapper | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
timeout-minutes: 2 | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ unit-test, store-test, int-test, server-int-test ] | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
env: | |
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} | |
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
steps: | |
- name: Checkout Ambry | |
uses: actions/checkout@v2 | |
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Build artifacts and create pom files | |
with: | |
job-id: jdk11 | |
arguments: --scan assemble publishToMavenLocal | |
gradle-version: wrapper | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Test publication by uploading in dry run mode | |
with: | |
job-id: jdk11 | |
arguments: -i --scan artifactoryPublishAll -Partifactory.dryRun | |
gradle-version: wrapper | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Tag and upload to JFrog Artifactory | |
with: | |
job-id: jdk11 | |
arguments: -i --scan ciPerformRelease | |
gradle-version: wrapper |