diff --git a/.github/workflows/kb_sdk_test.yaml b/.github/workflows/kb_sdk_test.yaml index a31e626..dead1ae 100644 --- a/.github/workflows/kb_sdk_test.yaml +++ b/.github/workflows/kb_sdk_test.yaml @@ -14,33 +14,20 @@ on: jobs: sdk_tests: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Check out GitHub repo 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_TEST_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 GHA_scripts/make_testdir && echo "Created test_local" test -f "test_local/test.cfg" && echo "Confirmed config exists" - name: Configure authentication @@ -55,8 +42,11 @@ 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 - bash <(curl -s https://codecov.io/bash) + sh GHA_scripts/kb-sdk test --verbose + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true diff --git a/GHA_scripts/kb-sdk b/GHA_scripts/kb-sdk new file mode 100644 index 0000000..bcb89a5 --- /dev/null +++ b/GHA_scripts/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 -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 $@ diff --git a/GHA_scripts/make_testdir b/GHA_scripts/make_testdir new file mode 100644 index 0000000..b7626c8 --- /dev/null +++ b/GHA_scripts/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 -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 test +exit