-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from research-software-reactor/14-add-continuo…
…us-integration-test-with-github-actions 14 add continuous integration test with GitHub actions
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
name: Run tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test people.json is valid JSON | ||
run: | | ||
python3 -c 'import json; json.load(open("people.json"))' | ||
- name: Test image builds | ||
run: | | ||
docker compose -f compose.yml build | ||
- name: Test container can start and is healthy | ||
run: | | ||
# Launch the project from docker-compose.yml and wait up to | ||
# 30s for its built-in health check to return "healthy" | ||
if ! docker compose -f compose.yml up --wait --wait-timeout 30; then | ||
docker compose logs | ||
docker inspect --format='{{json .State.Health}}' rse-skills-graph-web-1 | jq | ||
exit 1 | ||
fi | ||
docker compose -f compose.yml down | ||
# - name: Run Pytest tests | ||
# run: | | ||
# docker compose -f compose.yml run --entrypoint "" web pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ FROM ubuntu:18.04 | |
MAINTAINER "Ian Hinder <[email protected]>" | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y python3 python3-pip python3-requests graphviz libgraphviz-dev && \ | ||
apt-get install -y python3 python3-pip python3-requests graphviz libgraphviz-dev curl && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./requirements.txt /app/requirements.txt | ||
|
@@ -21,3 +21,8 @@ ENV LAST_UPDATE=$last_update | |
ENTRYPOINT [ "python3" ] | ||
|
||
CMD [ "application.py" ] | ||
|
||
# TODO: in docker 25 and later, we should use --start-interval and | ||
# --start-period to perform more frequent checks on startup to speed | ||
# up tests | ||
HEALTHCHECK --interval=10s CMD curl --fail http://localhost:5000 || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
web: | ||
build: . | ||
ports: | ||
- "5000:5000" |