Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: switch to GitHub Actions #323

Merged
merged 3 commits into from
Aug 13, 2024
Merged

ci: switch to GitHub Actions #323

merged 3 commits into from
Aug 13, 2024

Conversation

kyleam
Copy link
Collaborator

@kyleam kyleam commented Aug 9, 2024

The Drone tests for the latest push failed to launch. Given that we have been planning to switch to GitHub Actions, it's not worth it to troubleshoot what's going on. So, this PR does the switch. As discussed offline a few times, the strategy is to go with the GitHub-hosted runners and run all the tests that don't require NONMEM, leaving it to us to execute the full test suite outside of CI (which, at the very least, we'll be doing as part of validation anyway).

There are two prep commits:

  • The first fixes an issue flagged by the new golang-lint workflow. (We executed that before, but not with the minimum version of Go specified in go.mod.)
  • The second splits the integration tests into two packages so that we can more easily test the things that do not require NONMEM (e.g., summary tests).

Confirmation that integration/nonmem tests are passing

script
#!/bin/sh

set -eu

test -n "${METWORX_VERSION-}" || {
    printf >&2 'Metworx is required to run integration tests\n'
    exit 1
}

root=${BBI_TEST_ROOT-/data/bbi-tests}
mkdir -p "$root"
tdir=$(mktemp -d "$root"/run-XXXXX)
trap 'rm -rf "$tdir"' 0

BBI_GRID_NAME_PREFIX=$(basename "$tdir")
export BBI_GRID_NAME_PREFIX
export LOCAL=true
export MPIEXEC_PATH=/usr/bin/mpiexec
export NMQUAL=false
export NMVERSION=nm75
export NMVERSION_NMQUAL=nm74gf
export NONMEMROOT=/opt/NONMEM
export POST_EXECUTION=true
export ROOT_EXECUTION_DIR="$tdir"
export SGE=true
export SGE_ARCH=lx-amd64
export SGE_CELL=default
export SGE_CLUSTER_NAME=p6444
export SGE_EXECD_PORT=6445
export SGE_QMASTER_PORT=6444
export SGE_ROOT=/opt/sge

bin=$tdir/bin
mkdir "$bin"

version=$(git describe --always --dirty)

# shellcheck disable=SC2086
go build \
   -ldflags "-X github.com/metrumresearchgroup/bbi/cmd.VERSION=$version" \
   -o "$bin/bbi" cmd/bbi/main.go

export PATH="$bin:$PATH"

printf >&2 'bbi path: %s\nbbi version: %s\ntree: %s\n' \
       "$(command -v bbi)" "$(bbi version)" "$(git rev-parse 'HEAD^{tree}')"

cd integration
bbi init --dir /opt/NONMEM --threads 2

go test -count 1 "$@" ./postrun ./nonmem
$ ./t.sh
bbi path: /data/bbi-tests/run-zIsYL/bin/bbi
bbi version: v3.3.0-3-g97dca5c
tree: ee97656114c965f16c7f17fd7f375994f0db143b
ok  	github.com/metrumresearchgroup/bbi/integration/postrun	0.469s
ok  	github.com/metrumresearchgroup/bbi/integration/nonmem	455.006s

kyleam added 3 commits August 9, 2024 11:21
The tests started using os.WriteFile in e09a001 (init: make compatible
with Windows, 2023-02-02), but it isn't available until 1.16.  We're
due for an update of the minimum Go version, but for now just increase
to 1.16.

As of Go 1.16, ioutil.{ReadFile,WriteFile,ReadFile} are deprecated and
just relay functions in io or os.  Use the new functions directly.

This issue was flagged by the upcoming lint GitHub Actions that runs
with the minimum Go version specified in go.mod.
A subset of the integration tests don't require NONMEM.  It's
convenient to put them so that they can be more easily executed on
machines that don't have NONMEM.

The upcoming GitHub Actions workflow will execute the
integration/postrun tests.
For bbi testing with Drone, we relied on a self-hosted server with
NONMEM in order to run the full test suite.  At least for now, the
plan isn't to mimic that setup with GitHub Actions.  Instead set up
GitHub Actions to run all the tests that don't require NONMEM, and
rely on the full test suite being executed outside of CI.
@kyleam kyleam requested a review from seth127 August 9, 2024 16:10
run: |
bbi version
go test ./integration/postrun
release:
Copy link
Collaborator Author

@kyleam kyleam Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This release job hasn't been tested. My thinking is that we can do a prerelease after the validation rework lands, and I can adjust as needed then.

shell: bash
run: |
command -v golangci-lint
golangci-lint run --out-format=github-actions
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an example of how this will fail when it flags an issue: https://github.com/metrumresearchgroup/bbi/actions/runs/10321533479

Copy link
Collaborator

@seth127 seth127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me. I agree with the approach of getting this running and then testing the release step later (with a pre-release).

run all the tests that don't require NONMEM, leaving it to us to execute the full test suite outside of CI (which, at the very least, we'll be doing as part of validation anyway)

Yes, we discussed this and I still think this is the right path forward. Tagging @shairozan here, because this came up in a conversation that we had earlier this week.

@kyleam kyleam merged commit 5e1f919 into main Aug 13, 2024
4 checks passed
@kyleam kyleam deleted the gh-actions branch August 13, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants