From 924991182f3f3dda6fddc144091faa93972beeaa Mon Sep 17 00:00:00 2001 From: nvta1209 <162694616+nvta1209@users.noreply.github.com> Date: Tue, 2 Apr 2024 12:33:42 -0700 Subject: [PATCH] feat(IPVC-2299): Run tests in a github action (#17) --- .github/workflows/test.yml | 25 +++++++++++++++++++++++++ Dockerfile | 5 +++-- README.md | 3 +-- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..409225a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Continuous Integration + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + types: + - checks_requested + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build image + run: docker build --target uta-test -t uta-test . + - name: Run tests + run: docker run --rm uta-test python -m unittest diff --git a/Dockerfile b/Dockerfile index ec6d67d..e58df99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,5 +27,6 @@ FROM uta as uta-test RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install postgresql COPY tests ./tests RUN pip install -e .[test] -RUN useradd postgres-testing -USER postgres-testing +RUN useradd uta-tester +RUN chown -R uta-tester . +USER uta-tester diff --git a/README.md b/README.md index 8b95314..78da019 100644 --- a/README.md +++ b/README.md @@ -289,8 +289,7 @@ To develop UTA, follow these steps. 4. Testing $ docker build --target uta-test -t uta-test . - $ docker run -it --rm -v $(pwd):/opt/repos/uta uta-test bash - $ python -m unittest + $ docker run -it --rm uta-test python -m unittest ## UTA update procedure