@@ -2,22 +2,26 @@ name: Test and deploy dictionaries
2
2
3
3
# OVERVIEW
4
4
#
5
- # The `dictionaryutils` package is used for dumping the schemas from the parent dictionary repo.
5
+ # The `dictionaryutils` package is used for dumping the schemas from the
6
+ # parent dictionary repo.
6
7
# Dependencies on both `gen3dictionary` and `gdcdictionary`
7
8
# cause conflict in importing the correct `SCHEMA_DIR` used for dumping schemas.
8
9
#
9
- # There are two steps to ensure setting the correct source:
10
- # - Re-install the dictionary in the parent repo as `gdcdictionary` after the install of `dictionaryutils`
11
- # - uninstall `gen3dictionary` as part of the `run_test.sh` script .
10
+ # The purpose of this workflow is to set up a virtual environment where dumped
11
+ # schemas are from the parent dictionary repo and are not from those
12
+ # installed by dictionaryutils .
12
13
#
13
- # In order to ensure the correct virtual env usage and
14
- # compatibility with both pyproject.yaml and setup.py for the dictionary repos, we
15
- # conditionally select `poetry` or `pip` when installing the dictionary as `gdcdictionary`,
14
+ # There are two steps to ensure setting the correct source:
15
+ # - uninstall `gen3dictionary` and `gdcdictionary` after the dictionaryutils install.
16
+ # - Re-install the dictionary in the parent repo as `gdcdictionary`
16
17
#
17
18
# Then the `run_tests.sh` script will:
18
- # - uninstall `gen3dictionary`
19
- # - run the dictionary tests from dictionaryutils which expects `gdcdictionary` library as the unit to test
20
- # - run the dump schemas to move it to the /artifacts folder
19
+ # - run the dictionary tests from dictionaryutils which expects `gdcdictionary`
20
+ # library as the unit to test
21
+ # - run the dump schemas to move it to the /artifacts folder
22
+ #
23
+ # All commands should be run under `poetry run` to ensure that changes take
24
+ # place in the poetry virtual env.
21
25
22
26
on :
23
27
workflow_call :
@@ -65,31 +69,40 @@ jobs:
65
69
git clone https://github.com/uc-cdis/dictionaryutils
66
70
cd dictionaryutils
67
71
poetry install -vv --all-extras --no-interaction
68
- echo "Removing 'gdcdictionary' and re-installing in following step"
69
- poetry remove gdcdictionary
70
- - name : Attempt poetry or pip re-install of dictionary as `gdcdictionary`
71
- # install via pip or poetry conditionally
72
+ - name : Uninstall gdcdictionary
73
+ # remove gdcdictionary or gen3dictionary conditionally
72
74
run : |
73
- echo "installing the dictionary as 'gdcdictionary'"
74
- if [ -f setup.py ]; then
75
- echo "Install via pip"
76
- pip install .
77
- fi
78
75
if [ -f pyproject.toml ]; then
79
- echo "Install via poetry"
80
- poetry install -vv --all-extras --no-interaction || true
76
+ cd dictionaryutils
77
+ echo "Removing 'gen3dictionary' via pip"
78
+ poetry run pip uninstall -y gen3dictionary
79
+ poetry run pip uninstall -y gdcdictionary
80
+ elif [ -f setup.py ]; then
81
+ cd dictionaryutils
82
+ echo "Removing 'gdcdictionary' via poetry"
83
+ poetry remove gdcdictionary
84
+ poetry run pip uninstall -y gen3dictionary
81
85
fi
86
+ - name : Attempt re-install of dictionary as `gdcdictionary`
87
+ run : |
88
+ echo "Re-installing the dictionary as 'gdcdictionary'"
89
+ cd dictionaryutils
90
+ poetry run pip install ..
82
91
- name : Run dictionary tests, dump schema, and move to S3
83
92
run : |
84
93
cd dictionaryutils
85
94
echo "dependencies before run_test"
86
95
poetry show
96
+ echo "Schema dir for artifact"
97
+ poetry run python -c "from gdcdictionary import SCHEMA_DIR; print(SCHEMA_DIR)"
98
+ echo "Schemas"
99
+ ls `poetry run python -c "from gdcdictionary import SCHEMA_DIR; print(SCHEMA_DIR)"`
100
+ echo "Run tests under poetry"
87
101
poetry run ./run_tests.sh
88
- echo "dependencies after run_test "
89
- poetry show
102
+ echo "Number of schemas in artifact "
103
+ grep -o ".yaml\"" artifacts/schema.json | wc -l
90
104
aws s3 cp artifacts/schema.json s3://${{ inputs.BUCKET }}/${{ inputs.DIRECTORY }}/$GITHUB_REF_NAME/schema.json --region ${{ inputs.REGION }}
91
- echo "Schema dir for artifact: "
92
- python -c "from gdcdictionary import SCHEMA_DIR; print(SCHEMA_DIR)"
105
+
93
106
env :
94
107
AWS_ACCESS_KEY_ID : ${{ secrets.DICT_AWS_ACCESS_KEY_ID }}
95
108
AWS_SECRET_ACCESS_KEY : ${{ secrets.DICT_AWS_SECRET_ACCESS_KEY }}
0 commit comments