Skip to content

Update jvm.sh to make shellcheck happier #83

Update jvm.sh to make shellcheck happier

Update jvm.sh to make shellcheck happier #83

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install shfmt
run: sudo apt-get install shfmt
- name: Run shfmt (excluding vendor directory)
run: |
set -euo pipefail
shfmt -f . | grep -v "/vendor/" | xargs shfmt -i 2 -d
- name: Run ShellCheck
run: |
set -euo pipefail
shellcheck bin/* lib/jvm.sh etc/* opt/* test/*.sh
hatchet:
name: "Hatchet (${{ matrix.stack }}, ${{ matrix.assets-base-url == 0 && 'production bucket' || 'staging bucket' }})"
runs-on: ubuntu-22.04
needs: lint
strategy:
fail-fast: false
matrix:
stack: ["heroku-20", "heroku-22"]
assets-base-url: ["", "https://lang-jvm-staging2.s3.us-east-1.amazonaws.com/"]
env:
HATCHET_APP_LIMIT: 100
PARALLEL_SPLIT_TEST_PROCESSES: 8
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
HEROKU_DISABLE_AUTOUPDATE: 1
# We use the Java buildpack for all Hatchet tests and instruct it to use the code of the current branch as the
# source for the JVM common buildpack with the 'DEFAULT_APP_CONFIG_JVM_COMMON_BUILDPACK' environment
# variable.
HATCHET_BUILDPACK_BASE: https://github.com/heroku/heroku-buildpack-java
HATCHET_BUILDPACK_BRANCH: main
# Default stack for all Heroku apps created by Hatchet
DEFAULT_APP_STACK: ${{ matrix.stack }}
# Default config variables for all Heroku apps created by Hatchet, prefixed with 'DEFAULT_APP_CONFIG_'
DEFAULT_APP_CONFIG_JVM_COMMON_BUILDPACK: https://api.github.com/repos/heroku/heroku-buildpack-jvm-common/tarball/${{ github.head_ref || github.ref_name }}
DEFAULT_APP_CONFIG_JVM_BUILDPACK_ASSETS_BASE_URL: ${{ matrix.assets-base-url }}
steps:
- uses: actions/checkout@v3
- name: Install Ruby and dependencies
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "2.7"
- name: Hatchet setup
run: bundle exec hatchet ci:setup
- name: Run Hatchet integration tests
run: bundle exec parallel_split_test test/spec/
buildpack-testrunner:
runs-on: ubuntu-22.04
needs: lint
env:
SHUNIT_HOME: /tmp/shunit2-2.1.6
# Note the missing STACK environment variable here. This works since there is a default value in the buildpack
# source. I ported this as-is from the Travis config. Given we're trying to get rid of testrunner entirely,
# it will stay like this. If we, for some reason, decide to keep testrunner, we should look into a fixed STACK env var.
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 8
- name: Download and unpack shunit 2.1.6
run: curl -sSf --retry 3 --retry-connrefused --connect-timeout 5 https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz | tar xz -C /tmp/
- name: Clone heroku-buildpack-testrunner
run: git clone https://github.com/heroku/heroku-buildpack-testrunner.git /tmp/testrunner
- name: Apply heroku-buildpack-testrunner patches to enforce bash shell
run: |
cd /tmp/testrunner
git apply <<'EOF'
diff --git a/bin/run b/bin/run
index 0d5b790..a0ff25c 100755
--- a/bin/run
+++ b/bin/run
@@ -101,7 +101,7 @@ for bp in ${@}; do
suite_start_time="$(date +%s)"
echo " TEST SUITE: $(basename ${f})"
- ${SHUNIT_HOME?"'SHUNIT_HOME' environment variable must be set"}/src/shunit2 ${f} | indent
+ /bin/bash ${SHUNIT_HOME?"'SHUNIT_HOME' environment variable must be set"}/src/shunit2 ${f} | indent
exit_code=$(max ${exit_code} ${PIPESTATUS[0]})
suite_end_time="$(date +%s)"
EOF
- name: Execute buildpack-testrunner
run: /tmp/testrunner/bin/run .
unit-tests:
name: "Unit Tests (${{ matrix.stack }})"
runs-on: ubuntu-22.04
needs: lint
container:
image: "${{ fromJson('{ \"heroku-20\": \"heroku/heroku:20\", \"heroku-22\": \"heroku/heroku:22\" }')[matrix.stack] }}"
env:
STACK: ${{ matrix.stack }}
strategy:
matrix:
stack: ["heroku-20", "heroku-22"]
steps:
- uses: actions/checkout@v3
- run: |
set -euo pipefail
test/v2
- run: |
set -euo pipefail
test/jdbc.sh