diff --git a/.github/workflows/kb_sdk_test.yaml b/.github/workflows/kb_sdk_test.yaml index 2f985601..e1ae205c 100644 --- a/.github/workflows/kb_sdk_test.yaml +++ b/.github/workflows/kb_sdk_test.yaml @@ -16,26 +16,13 @@ jobs: if: "!contains(github.event.head_commit.message, 'skip ci')" uses: actions/checkout@v2 - - name: Check out Actions CI files - if: "!contains(github.event.head_commit.message, 'skip ci')" - uses: actions/checkout@v2 - with: - repository: 'kbaseapps/kb_sdk_actions' - path: 'kb_sdk_actions' - - - name: Set up test environment if: "!contains(github.event.head_commit.message, 'skip ci')" shell: bash env: KBASE_TEST_TOKEN: ${{ secrets.KBASE_CI_TOKEN }} run: | - # Verify kb_sdk_actions clone worked - test -f "$HOME/kb_sdk_actions/bin/kb-sdk" && echo "CI files cloned" - # Pull kb-sdk & create startup script - docker pull kbase/kb-sdk - - sh $GITHUB_WORKSPACE/kb_sdk_actions/bin/make_testdir && echo "Created test_local" + sh scripts/GHA/make_testdir && echo "Created test_local" test -f "test_local/test.cfg" && echo "Confirmed config exists" - name: Configure authentication @@ -55,10 +42,8 @@ jobs: - name: Run tests if: "!contains(github.event.head_commit.message, 'skip ci')" shell: bash - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - sh $GITHUB_WORKSPACE/kb_sdk_actions/bin/kb-sdk test + sh scripts/GHA/kb-sdk test --verbose - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/scripts/GHA/kb-sdk b/scripts/GHA/kb-sdk new file mode 100644 index 00000000..07972231 --- /dev/null +++ b/scripts/GHA/kb-sdk @@ -0,0 +1,12 @@ +#!/bin/sh + +# TODO may want to make the image an env var or argument + +# See https://github.com/kbaseapps/kb_sdk_actions/blob/master/bin/kb-sdk for source + +# Cache the group for the docker file +if [ ! -e $HOME/.kbsdk.cache ] ; then + docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4-rc-1 -l /var/run/docker.sock|awk '{print $4}' > $HOME/.kbsdk.cache +fi + +exec docker run -i --rm -v $HOME:$HOME -w $(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DSHELL=$SHELL --group-add $(cat $HOME/.kbsdk.cache) ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4-rc-1 $@ diff --git a/scripts/GHA/make_testdir b/scripts/GHA/make_testdir new file mode 100644 index 00000000..83a0709d --- /dev/null +++ b/scripts/GHA/make_testdir @@ -0,0 +1,16 @@ +#!/bin/sh + +# TODO may want to make the image an env var or argument + +# See https://github.com/kbaseapps/kb_sdk_actions/blob/master/bin/make_testdir for source + +# Disable the default `return 1` when creating `test_local` +set +e + +# Cache the group for the docker file +if [ ! -e $HOME/.kbsdk.cache ] ; then + docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4-rc-1 -l /var/run/docker.sock|awk '{print $4}' > $HOME/.kbsdk.cache +fi + +exec docker run -i --rm -v $HOME:$HOME -u $(id -u) -w $(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DUSER=$USER -e DSHELL=$SHELL --group-add $(cat $HOME/.kbsdk.cache) ghcr.io/kbase/kb_sdk_patch-develop:br-0.0.4-rc-1 test +exit