Skip to content

Commit ae93955

Browse files
authored
Merge pull request #3 from neurostuff/test
Test
2 parents 1c0cfad + 9982fe4 commit ae93955

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

.github/workflows/update_sdk.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ jobs:
2121
with:
2222
repository: neurostuff/${{ matrix.sdk[0] }}
2323
path: ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
24+
# - name: Setup tmate session
25+
# uses: mxschmitt/action-tmate@v3
26+
# timeout-minutes: 45
2427
- name: Checkout reciprical branch
2528
run: |
2629
cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
27-
git checkout ${{ github.base_ref }} 2>/dev/null || git checkout -b ${{ github.base_ref }}
30+
git fetch
31+
git ls-remote --exit-code --heads origin ${{ github.ref_name }} || git branch ${{ github.ref_name }}
32+
git checkout ${{ github.ref_name }}
2833
- name: Generate SDK
2934
run: |
3035
./generate.sh ${{ matrix.sdk[0] }}
@@ -33,11 +38,16 @@ jobs:
3338
cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
3439
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
3540
git config --local user.name "github-actions[bot]"
36-
37-
# check to see if there were any changes to the repository.
41+
git config --local --unset-all "http.https://github.com/.extraheader"
42+
# check to see if there were any changes to the repository and no branches made
3843
if [ -z $(git ls-files --other --exclude-standard --directory) ]; then
3944
echo "No files to be committed!"
45+
if [ -z $(git ls-remote --heads origin ${{ github.ref_name }}) ]; then
46+
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
47+
else
48+
echo "branch already exists and is up to date"
49+
fi
4050
else
4151
git commit -m "${{ github.sha }}" -a
42-
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.base_ref }}
52+
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
4353
fi

generate.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
generate=$1
44

5-
if [ -z ${generate} ] || [ ${generate} == "python-neurostore" || [ ${generate} == "neurostore-python-sdk" ]; then
5+
if [ -z ${generate} ] || [ ${generate} == "python-neurostore" ] || [ ${generate} == "neurostore-python-sdk" ]; then
66

77
echo "generating python-neurostore-sdk..."
88
docker run --rm --user $(id -u):$(id -g) \
@@ -13,7 +13,7 @@ if [ -z ${generate} ] || [ ${generate} == "python-neurostore" || [ ${generate} =
1313
-o /local/python/neurostore-sdk
1414
fi
1515

16-
if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ] || [ ${generate} == "neurostore-typescript-sdk "]; then
16+
if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ] || [ ${generate} == "neurostore-typescript-sdk" ]; then
1717

1818
echo "generating typescript-neurostore-sdk..."
1919
docker run --rm --user $(id -u):$(id -g) \
@@ -23,7 +23,7 @@ if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ] || [ ${gener
2323
-o /local/typescript/neurostore-sdk
2424
fi
2525

26-
if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-python-sdk "]; then
26+
if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-python-sdk" ]; then
2727

2828
echo "generating python-neurosynth-compose-sdk..."
2929
docker run --rm --user $(id -u):$(id -g) \
@@ -34,7 +34,7 @@ if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ] || [ ${g
3434
-o /local/python/neurosynth-compose-sdk
3535
fi
3636

37-
if [ -z ${generate} ] || [ ${generate} == "typescript-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-typescript-sdk "]; then
37+
if [ -z ${generate} ] || [ ${generate} == "typescript-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-typescript-sdk" ]; then
3838

3939
echo "generating typescript-neurosynth-compose-sdk..."
4040
docker run --rm --user $(id -u):$(id -g) \
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test {{{packageName}}}
2+
on: [push, pull_request]
3+
jobs:
4+
pytest:
5+
runs-on: {{=<% %>=}}${{ matrix.os }}<%={{ }}=%>
6+
strategy:
7+
matrix:
8+
os: [ubuntu-20.04]
9+
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
10+
steps:
11+
- name: Check out repository code
12+
uses: actions/checkout@v3
13+
- name: Install python {{=<% %>=}}${{ matrix.python }}<%={{ }}=%>
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: {{=<% %>=}}${{ matrix.python }}<%={{ }}=%>
17+
- name: Install dependencies
18+
run: |
19+
pip install -r requirements.txt
20+
pip install -r test-requirements.txt
21+
- name: Run pytest
22+
run: |
23+
pytest --cov={{{packageName}}}

0 commit comments

Comments
 (0)