Skip to content

Commit bbcfad2

Browse files
committed
feat(github): tests;
- New tests with codecov.
1 parent dbe3ae2 commit bbcfad2

File tree

4 files changed

+72
-143
lines changed

4 files changed

+72
-143
lines changed

.circleci/config.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

.github/workflows/flake8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Lint
2-
on: [pull_request]
2+
on: [workflow_call, workflow_dispatch]
33

44
permissions:
55
contents: read

.github/workflows/pyright.yml

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,88 @@
11
name: Check types
2-
on: [pull_request]
2+
on: [workflow_call, workflow_dispatch]
33
env:
44
NODE_VERSION: '18'
5-
PYTHON_VERSION: '3.9'
65

76
permissions:
87
contents: read
98

109
jobs:
1110
typecheck:
1211
runs-on: ubuntu-latest
12+
container:
13+
image: opendatacanada/ckan-pytest # primary executor
1314
steps:
14-
- uses: actions/checkout@v2
15-
id: gitcheckout
16-
- uses: actions/setup-python@v2
17-
with:
18-
python-version: ${{ env.PYTHON_VERSION }}
19-
- uses: actions/setup-node@v3
15+
- name: Install Node
16+
run: |
17+
apk add nodejs npm
18+
- uses: actions/setup-node@v4
2019
with:
2120
node-version: ${{ env.NODE_VERSION }}
22-
- name: Install python deps
23-
id: pydepends
24-
if: steps.gitcheckout.outcome == 'success'
21+
- name: Check Source Dependency Versions
2522
run: |
26-
python3 -m venv /home/runner/work/app
27-
mkdir -p /home/runner/work/app/src/ckanext-recombinant
28-
cp -R . /home/runner/work/app/src/ckanext-recombinant
29-
source /home/runner/work/app/bin/activate
30-
pip install --upgrade setuptools==70.0.0
31-
pip install --upgrade pip==23.2.1
32-
pip install -e 'git+https://github.com/open-data/ckan@canada-v2.10#egg=ckan' -r 'https://raw.githubusercontent.com/open-data/ckan/canada-v2.10/requirement-setuptools.txt' -r 'https://raw.githubusercontent.com/open-data/ckan/canada-v2.10/requirements.txt' -r 'https://raw.githubusercontent.com/open-data/ckan/canada-v2.10/dev-requirements.txt'
33-
pip install -e 'git+https://github.com/ckan/ckanapi.git#egg=ckanapi' -r 'https://raw.githubusercontent.com/ckan/ckanapi/master/requirements.txt'
34-
pip install -e /home/runner/work/app/src/ckanext-recombinant/. -r /home/runner/work/app/src/ckanext-recombinant/requirements.txt -r /home/runner/work/app/src/ckanext-recombinant/test-requirements.txt
35-
pip install -e 'git+https://github.com/ckan/ckantoolkit.git#egg=ckantoolkit' -r 'https://raw.githubusercontent.com/ckan/ckantoolkit/master/requirements.txt'
36-
find /home/runner/work/app -name '*.pyc' -delete
37-
- name: Install node deps
38-
if: steps.pydepends.outcome == 'success'
23+
source /srv/app/venv/bin/activate
24+
for dir in /srv/app/src/*; do
25+
srcName=$(echo "$dir" | awk -F'/' '{print $NF}');
26+
if [[ -d "$dir/.git" ]]; then
27+
printf "${srcName}: Checking for updates..."
28+
cd $dir;
29+
current_branch=$(git rev-parse --abbrev-ref HEAD);
30+
if [[ "$srcName" == "ckan" ]]; then
31+
git fetch canada;
32+
reslog=$(git log HEAD..canada/$current_branch --oneline);
33+
else
34+
git fetch origin;
35+
reslog=$(git log HEAD..origin/$current_branch --oneline);
36+
fi;
37+
if [[ "${reslog}" == "" ]]; then
38+
printf "${srcName}: Up to date. Skipping..."
39+
else
40+
git pull || true;
41+
printf "${Green}${srcName}: Pulled updated code. Re-initializing in python environment..."
42+
cd /srv/app;
43+
if [[ -f "$dir/requirements.txt" ]]; then
44+
pip install -r $dir/requirements.txt || true;
45+
fi;
46+
if [[ -f "$dir/dev-requirements.txt" ]]; then
47+
pip install -r $dir/dev-requirements.txt || true;
48+
fi;
49+
if [[ -f "$dir/test-requirements.txt" ]]; then
50+
pip install -r $dir/test-requirements.txt || true;
51+
fi;
52+
if [[ -f "$dir/setup.py" ]]; then
53+
python $dir/setup.py develop || true;
54+
fi;
55+
fi;
56+
else
57+
printf "${srcName}: Not a source repository. Skipping..."
58+
fi;
59+
done;
60+
cd /srv/app;
61+
- name: Checkout Repository (${{ github.head_ref || github.ref_name }})
62+
id: gitcheckout
63+
run: |
64+
cd /srv/app/src/ckanext-recombinant
65+
git fetch origin
66+
if [[ "${{ github.head_ref || github.ref_name }}" != "master" ]]; then
67+
git checkout -b ${{ github.head_ref || github.ref_name }} origin/${{ github.head_ref || github.ref_name }}
68+
fi;
69+
git fetch
70+
git pull
71+
source /srv/app/venv/bin/activate
72+
pip install -e .
73+
pip install -r requirements.txt
74+
pip install -r test-requirements.txt
75+
python3 setup.py develop
76+
cd /srv/app
77+
- name: Install Node Dependencies
78+
if: steps.gitcheckout.outcome == 'success'
3979
run: |
40-
cd /home/runner/work/app/src/ckanext-recombinant
80+
cd /srv/app/src/ckanext-recombinant
4181
npm ci
42-
- name: Check types
43-
if: steps.pydepends.outcome == 'success'
82+
- name: Check Types
83+
if: steps.gitcheckout.outcome == 'success'
4484
run: |
45-
cd /home/runner/work/app/src/ckanext-recombinant
85+
export PYTHONPATH="${PYTHONPATH}:/srv/app/lib/python3.9/site-packages:/srv/app/src/ckanext-citeproc"
86+
source /srv/app/venv/bin/activate
87+
cd /srv/app/src/ckanext-recombinant
4688
npx pyright

changes/151.changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Heavily improved the automated pytests and GitHub workflows.

0 commit comments

Comments
 (0)