|
| 1 | +name: (perf) Cockroach DB v21 Support Test |
| 2 | +on: |
| 3 | + # ------------------------------------------------------------------------------------------------------------------------------- |
| 4 | + # Disabling perf test to ensure build time is < 4m |
| 5 | + # The "perf" branch is a placeholder (it does not exists now) |
| 6 | + # see: https://github.com/picoded/JavaCommons-dstack/blob/7f321d8bed9ea8445018ba5315084475dc81c786/notes/perf-test-notes.md |
| 7 | + # ------------------------------------------------------------------------------------------------------------------------------- |
| 8 | + # push: |
| 9 | + # branches: [ master, eugene/* ] |
| 10 | + # pull_request: |
| 11 | + # branches: [ master ] |
| 12 | + push: |
| 13 | + branches: [ perf ] |
| 14 | + # pull_request: |
| 15 | + # branches: [ perf ] |
| 16 | +jobs: |
| 17 | + unit_test: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + # Because github services, does not allow overwriting "CMD" / "ENTRYPOINT" commands |
| 21 | + # so we are gonna to run the docker containers via the bash commandline |
| 22 | + # services: |
| 23 | + # postgres: |
| 24 | + # image: cockroachdb/cockroach:v21.1.12 |
| 25 | + # env: |
| 26 | + # POSTGRES_DATABASE: javacommons |
| 27 | + # POSTGRES_USER: javacommons |
| 28 | + # POSTGRES_PASSWORD: javacommons |
| 29 | + # ports: |
| 30 | + # - 26257:26257 |
| 31 | + # options: --health-cmd="curl http://localhost:8080/health?ready=1" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v1 |
| 35 | + - name: Init submodules |
| 36 | + run: ./git-init-submodules.sh |
| 37 | + - name: Set up JDK 1.8 |
| 38 | + uses: actions/setup-java@v1 |
| 39 | + with: |
| 40 | + java-version: 1.8 |
| 41 | + - name: Cache Gradle packages |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }} |
| 45 | + path: | |
| 46 | + ~/.gradle/caches |
| 47 | + ~/.gradle/wrapper |
| 48 | + - name: Setup cockroachDB |
| 49 | + run: | |
| 50 | + sudo docker run -d --name=roach1 --hostname=roach1 -p 26257:26257 -p 8080:8080 cockroachdb/cockroach:v21.2.0 start-single-node --insecure && \ |
| 51 | + sleep 5s |
| 52 | + - name: Setup initial cockroach DB |
| 53 | + run: | |
| 54 | + sudo docker exec roach1 cockroach sql --insecure -e "CREATE DATABASE IF NOT EXISTS javacommons" && \ |
| 55 | + sudo docker exec roach1 cockroach sql --insecure -e "CREATE USER IF NOT EXISTS javacommons" && \ |
| 56 | + sudo docker exec roach1 cockroach sql --insecure -e "GRANT ALL ON DATABASE javacommons TO javacommons" |
| 57 | + - name: Test basic cockroach DB connection |
| 58 | + run: | |
| 59 | + sudo apt-get update && \ |
| 60 | + sudo apt-get install postgresql-client && \ |
| 61 | + psql -p 26257 -h 127.0.0.1 --username=javacommons --no-password -c "SHOW DATABASES" |
| 62 | + - name: Setup gradle binaries |
| 63 | + run: ./gradlew |
| 64 | + - name: Pull dependencies libs, and perform initial compile |
| 65 | + run: ./gradlew src |
| 66 | + # Running the various perf tests |
| 67 | + - name: Run perf unit tests |
| 68 | + run: | |
| 69 | + ./gradle-test-classpath.sh picoded.dstack.jsql.postgres.JSql_DataObjectMap_Postgres_perf |
| 70 | + - name: Run jacocoTestReport |
| 71 | + run: ./gradlew jacocoTestReport |
| 72 | + - name: Archive code coverage results |
| 73 | + uses: actions/upload-artifact@v2 |
| 74 | + if: always() |
| 75 | + with: |
| 76 | + name: test-result-report |
| 77 | + path: | |
| 78 | + build/reports/**/* |
| 79 | + build/test-results/**/* |
| 80 | + build/jacoco/**/* |
| 81 | + - name: Upload code coverage to codecov |
| 82 | + uses: codecov/codecov-action@v2 |
| 83 | + if: always() |
| 84 | + with: |
| 85 | + # flags: gradle-build # optional |
| 86 | + # directory: build/jacoco/ |
| 87 | + verbose: true # optional (default = false) |
| 88 | + fail_ci_if_error: false |
0 commit comments