Skip to content

Commit

Permalink
Update to kb_sdk_patch
Browse files Browse the repository at this point in the history
Regular kb_sdk's Docker version is so old tests won't pass on GHA
  • Loading branch information
MrCreosote committed Oct 4, 2024
1 parent 393ea7e commit 34f622b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/kb_sdk_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
12 changes: 12 additions & 0 deletions GHA_scripts/kb-sdk
Original file line number Diff line number Diff line change
@@ -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 $@
16 changes: 16 additions & 0 deletions GHA_scripts/make_testdir
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 34f622b

Please sign in to comment.