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

Upgrade to Ruby 3.2.7 + bundler 2.4.19 + conservative upgrade of gems + add CI #2

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:

jobs:
build:
if: github.repository == 'incendilabs/plan-executor'

runs-on: ubuntu-24.04
steps:
-
name: Checkout repo
uses: actions/checkout@v4
-
name: Build docker image
run: docker build -t incendi/plan_executor:latest .
-
name: Run tests
run: |
mkdir -p logs html_summaries json_results
docker compose up -d spark
docker compose run --rm --no-deps plan_executor ./execute_all.sh 'http://spark:8080/fhir' r4 'html|json|stdout'
docker compose logs spark > logs/backend.log
-
name: Combine test results
if: ${{ always() }}
run: ./combine-test-results.sh json_results annotations.json
-
name: Attach test results
if: github.event_name != 'pull_request'
uses: yuzutech/annotations-action@v0.5.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
input: annotations.json
-
name: Archive logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs-r4-${{ github.sha }}
path: logs/*.log*
-
name: Archive test reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: html_summaries-r4-${{ github.sha }}
path: html_summaries/**/*.html
-
name: Archive JSON results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: json_results-r4-${{ github.sha }}
path: json_results/**/*.json
-
name: Archive annotations file
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: annotations-r4-${{ github.sha }}
path: annotations.json
-
name: Cleanup
if: ${{ always() }}
run: docker compose down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ruby:3.0.7
FROM ruby:3.2.7

WORKDIR /app
COPY . ./
RUN gem install bundler -v 2.5.13
RUN gem install bundler -v 2.4.19
RUN bundle install

ENTRYPOINT []
ENTRYPOINT []
29 changes: 15 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GEM
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
awesome_print (1.8.0)
awesome_print (1.9.2)
bcp47 (0.3.3)
i18n
coderay (1.1.3)
Expand Down Expand Up @@ -94,16 +94,15 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mini_portile2 (2.4.0)
mini_portile2 (2.8.8)
minitest (5.14.4)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
netrc (0.11.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.10-x64-mingw32)
mini_portile2 (~> 2.4.0)
nokogiri (1.18.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri-diff (0.2.0)
nokogiri (~> 1.5)
tdiff (~> 0.3, >= 0.3.2)
Expand All @@ -114,14 +113,16 @@ GEM
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
power_assert (1.2.0)
pry (0.13.1)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-coolline (0.2.5)
pry-coolline (0.2.6)
coolline (~> 0.5)
pry (~> 0.13)
public_suffix (4.0.6)
racc (1.8.1)
rack (2.2.3)
rake (13.0.1)
rake (13.2.1)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
Expand All @@ -134,17 +135,17 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
ruby2_keywords (0.0.2)
simplecov (0.20.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
tdiff (0.3.4)
test-unit (3.3.7)
test-unit (3.6.7)
power_assert
thread_safe (0.3.6)
tilt (2.0.10)
tilt (2.6.0)
tzinfo (1.2.8)
thread_safe (~> 0.1)
tzinfo-data (1.2020.4)
Expand All @@ -154,7 +155,7 @@ GEM
unf_ext (0.0.7.7)
unf_ext (0.0.7.7-x64-mingw32)
unicode_utils (1.4.0)
webmock (3.10.0)
webmock (3.13.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -180,4 +181,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.2.17
2.4.19
58 changes: 58 additions & 0 deletions combine-test-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e

JSON_PATH=$1
ANNOTATIONS_FILE=$2

function usage() {
me=`basename "$0"`
if [ ! -z "$1" ]; then
echo $1
fi
echo "Usage: ./${me} path/to/input/json_results path/to/output/annotations.json"
exit 1
}

[ $# -eq 2 ] || usage

[ ! -z "${JSON_PATH}" ] || usage

[ -d "${JSON_PATH}" ] || usage "${JSON_PATH} must be a directory"

touch $ANNOTATIONS_FILE || "$ANNOTATIONS_FILE is not writable"

DIR=$(pwd)

cd ${JSON_PATH}

# Output summary to stdout

ls _summary*.json | xargs jq -r '. | "PASS: \(.pass // 0)
FAIL: \(.fail // 0)
ERROR: \(.error // 0)
SKIP: \(.skip // 0)"
'

# Have to use warning annotation level, notice isn't working anymore (but could be in future).

SUMMARY=$(ls _summary*.json | xargs jq '[ .
| { "file": ".github/workflow/integration_tests.yml", "line": 1, "message": ("PASS: \(.pass // 0)\nFAIL: \(.fail // 0)\nERROR: \(.error // 0)\nSKIP: \(.skip // 0)"), "annotation_level": "warning" }
]')

FAILURES=$(ls -I '_summary*.json' | xargs -I '{}' jq '[ .[]
| select(((.status == "skip") and (.message | contains("TODO") | not))
or .status == "fail"
or .status == "error")
| .id as $id
| .status as $status
| .message as $message
| .description as $description
| .test_method as $method
| input_filename as $file
| { "file": ".github/workflow/integration_tests.yml", "line": 1, "message": ($id + ": " + $message), "annotation_level": "failure" }
]' '{}')

cd $DIR

jq 'reduce inputs as $i (.; . += $i)' <(echo "${SUMMARY}") <(echo "${FAILURES}") > ${ANNOTATIONS_FILE}
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
services:
spark:
container_name: spark
restart: always
image: sparkfhir/spark:r4-latest
environment:
- StoreSettings__ConnectionString=mongodb://root:secret@mongodb:27017/spark?authSource=admin
- SparkSettings__Endpoint=http://spark:8080/fhir
- ASPNETCORE_URLS=http://+:8080
- ASPNETCORE_HTTP_PORT=8080
ports:
- "8000:8080"
- "8001:8081"
depends_on:
- mongodb
mongodb:
container_name: mongodb
image: sparkfhir/mongo:r4-latest
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: secret
ports:
- "17017:27017"
plan_executor:
container_name: plan_executor
image: incendi/plan_executor:latest
depends_on:
- spark
volumes:
- ./logs:/app/logs:rw
- ./html_summaries:/app/html_summaries:rw
- ./json_results:/app/json_results:rw
2 changes: 1 addition & 1 deletion lib/data/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def load_fixture(path, extension)

# FIXME: Determine a better way to share fixture data with Crucible
def fixture_path
if File.exists?(FIXTURE_DIR)
if File.exist?(FIXTURE_DIR)
FIXTURE_DIR
else
File.join(Rails.root, 'test', 'fixtures')
Expand Down