From 81b0c942c9faa9ad14f3c60f28f911b447a46734 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 13 Aug 2024 17:11:15 -0400 Subject: [PATCH] Migrate admin-tests to GitHub Actions This is pretty straightforward, we just need to swap the CircleCI environment variable for one supported by GitHub Actions. --- .github/workflows/ci.yml | 8 ++++++++ admin/bin/dev-shell | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b85ba33ad..059410a743 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,3 +62,11 @@ jobs: cd journalist_gui source .venv/bin/activate QT_QPA_PLATFORM=offscreen python3 test_gui.py -v + + admin-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run tests + run: | + make -C admin test diff --git a/admin/bin/dev-shell b/admin/bin/dev-shell index 88b36f08b1..17e22b5ae6 100755 --- a/admin/bin/dev-shell +++ b/admin/bin/dev-shell @@ -9,6 +9,13 @@ set -euo pipefail TOPLEVEL=$(git rev-parse --show-toplevel) source "${BASH_SOURCE%/*}/../../devops/scripts/ticker" +DOCKER_RUN_ARGUMENTS="${DOCKER_RUN_ARGUMENTS:-}" + +# Pass -it if we're a tty +if test -t 0; then + DOCKER_RUN_ARGUMENTS="${DOCKER_RUN_ARGUMENTS} -it" +fi + function docker_image() { local out out="$(mktemp)" @@ -26,16 +33,16 @@ function docker_image() { } function docker_run() { - if [ -z "${CIRCLECI-}" ] + if [ -z "${CI-}" ] then docker run \ --rm \ --user "${USER:-root}" \ --volume "${TOPLEVEL}:/sd-root:Z" \ --workdir "/sd-root/admin" \ - -ti ${DOCKER_RUN_ARGUMENTS:-} securedrop-admin "$@" + ${DOCKER_RUN_ARGUMENTS} securedrop-admin "$@" else - docker run --rm -ti ${DOCKER_RUN_ARGUMENTS:-} securedrop-admin "$@" + docker run --rm ${DOCKER_RUN_ARGUMENTS} securedrop-admin "$@" fi }