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

Test draft #1239

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
606caf7
Test draft
TheChymera Aug 19, 2022
34b36c6
debug
TheChymera Aug 19, 2022
616748c
triggering on tag
TheChymera Aug 19, 2022
759b28f
debug
TheChymera Aug 19, 2022
c383b32
debug
TheChymera Aug 19, 2022
c56b9ac
debug
TheChymera Aug 19, 2022
7cfec33
debug
TheChymera Aug 19, 2022
954c5de
debug
TheChymera Aug 19, 2022
ffc8bf7
debug
TheChymera Aug 19, 2022
767d848
debug
TheChymera Aug 19, 2022
7aa92f6
debug
TheChymera Aug 19, 2022
c04c4eb
debug
TheChymera Aug 19, 2022
63f2829
debug
TheChymera Aug 19, 2022
6a010e4
debug
TheChymera Aug 19, 2022
89c8389
debug
TheChymera Aug 19, 2022
52ec5b3
debug
TheChymera Aug 19, 2022
f04ca81
debug
TheChymera Aug 19, 2022
de9830f
debug
TheChymera Aug 19, 2022
3b92582
debug
TheChymera Aug 19, 2022
2186dda
debug
TheChymera Aug 19, 2022
bcc29e5
debug
TheChymera Aug 19, 2022
6687f25
debug
TheChymera Aug 19, 2022
4ab4b4a
debug
TheChymera Aug 19, 2022
5a6ac86
debug
TheChymera Aug 19, 2022
a809b2f
debug
TheChymera Aug 19, 2022
c6793d2
debug
TheChymera Aug 19, 2022
0514d38
debug
TheChymera Aug 19, 2022
372d40b
debug
TheChymera Aug 19, 2022
e31bae4
debug
TheChymera Aug 19, 2022
2a61c02
debug
TheChymera Aug 19, 2022
90a9820
debug
TheChymera Aug 19, 2022
da28e01
debug
TheChymera Aug 19, 2022
8fc5370
debug
TheChymera Aug 19, 2022
0151b45
debug
TheChymera Aug 19, 2022
73aaa66
debug
TheChymera Aug 19, 2022
bc7c190
debug
TheChymera Aug 19, 2022
8b1ce12
debug
TheChymera Aug 19, 2022
22ff170
debug
TheChymera Aug 19, 2022
18c592b
debug
TheChymera Aug 19, 2022
88b39fc
Test upload to test.pypi before doing the real thing
TheChymera Aug 19, 2022
d1922e3
debug
TheChymera Aug 19, 2022
895a225
debug
TheChymera Aug 19, 2022
70b7596
utility script for testing tag hooks
TheChymera Aug 19, 2022
9ca58c6
Generating testdata inside repo as opposed to in separate archive
TheChymera Aug 19, 2022
d485c0b
overwrite version file
TheChymera Aug 19, 2022
7eb7347
Preserve version
TheChymera Aug 19, 2022
8ab913d
Fixing broken version file
TheChymera Aug 19, 2022
17e7f9f
Including testdata if present
TheChymera Aug 19, 2022
d4b036a
debug
TheChymera Aug 19, 2022
45287f4
Including testdata in sdist if existent
TheChymera Aug 19, 2022
7ea9e50
debug
TheChymera Aug 19, 2022
a2eb144
debug
TheChymera Aug 24, 2022
cfef730
debug
TheChymera Aug 24, 2022
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
52 changes: 52 additions & 0 deletions .github/workflows/schemacode_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ on:
push:
branches:
- "master"
- "autodata"
paths:
- "tools/schemacode/**"
- "src/schema/**"
tags:
- "schema-*"
pull_request:
branches:
- "*"
Expand Down Expand Up @@ -54,6 +57,35 @@ jobs:
shell: bash {0}
run: python -c "import sys; print(sys.version)"

- name: "DO WITH tags!!!"
shell: bash {0}
run: |
echo ${{ github.GITHUB_REF }}
echo ${{ github.CI }}
echo ${{ github.workspace.GITHUB_REF }}
echo ${{ github.workspace.CI }}
echo ${{ env.GITHUB_REF }}
echo ${{ env.CI }}
echo $GITHUB_REF
echo $CI
echo "$GITHUB_REF"
echo "$CI"
echo ${GITHUB_REF}
echo ${CI}
pwd
ls -lah
cat .git/COMMIT_EDITMSG
tree .git
which git
git ls-remote --tags
git describe --tags
git describe --tags
git describe --tags
MY_TAG="$(git describe --tags)"
if [ "${MY_TAG:0:7}" = "schema-" ]; then
echo "BIDSSCHEMATOOLS_RELEASE=1" >> $GITHUB_ENV
fi

- name: "Install the schemacode package"
shell: bash {0}
run: |
Expand All @@ -65,6 +97,26 @@ jobs:
run: |
python -m pytest --pyargs bidsschematools -m "not validate_schema" --cov-append --cov-report=xml --cov=bidsschematools

- name: "Test upload"
shell: bash {0}
id: testpypi_upload
run: |
if [ -z "$BIDSSCHEMATOOLS_RELEASE" ]; then
echo "BIDSSCHEMATOOLS_RELEASE is set to '$BIDSSCHEMATOOLS_RELEASE'"
ls /tmp/bidsschematools* -lah
python -m build
twine upload -u __token__ -p ${{secrets.BIDS_TOKEN_TEST}} --repository testpypi dist/*
fi

- name: "Real upload"
shell: bash {0}
if: ${{ success(testpypi_upload) }}
run: |
if [ -z "$BIDSSCHEMATOOLS_RELEASE" ]; then
echo "BIDSSCHEMATOOLS_RELEASE is set to '$BIDSSCHEMATOOLS_RELEASE'"
twine upload -u __token__ -p ${{secrets.BIDS_TOKEN_TEST}} --repository dist/*
fi

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
17 changes: 17 additions & 0 deletions scripts/test_tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

VERSION_FILE="src/schema/SCHEMA_VERSION"

pushd ..
export MY_BIDS_DATE="$(date +%s)"
REAL_VERSION=$(cat "${VERSION_FILE}")
DUMMY_VERSION="0.0.${MY_BIDS_DATE}-dev"
echo "${DUMMY_VERSION}" > "${VERSION_FILE}"
git commit -a -m "debug"
git tag -a "schema-$DUMMY_VERSION" -m "debug"
git push origin
git push origin "schema-$DUMMY_VERSION"
echo "${REAL_VERSION}" > "${VERSION_FILE}"
popd
unset MY_BIDS_DATE

2 changes: 1 addition & 1 deletion src/schema/SCHEMA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0-dev
0.0.1661358808-dev
11 changes: 6 additions & 5 deletions tools/schemacode/bidsschematools/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ def get_gitrepo_fixture(url, whitelist):
@pytest.fixture(scope="session")
def fixture():
archive_name = url.rsplit("/", 1)[-1]
testdata_archive = os.path.join(os.getcwd(), "testdata", archive_name)
if os.path.isdir(testdata_archive):
testdata_dir = os.path.join(os.path.dirname(__file__),"data","bundled",archive_name)
testdata_dir = os.path.abspath(testdata_dir)
if os.path.isdir(testdata_dir):
lgr.info(
"Found static testdata archive under `%s`. "
"Not downloading latest data from version control.",
testdata_archive,
testdata_dir,
)
yield testdata_archive
yield testdata_dir
else:
lgr.info(
"No static testdata available under `%s`. "
"Attempting to fetch live data from version control.",
testdata_archive,
testdata_dir,
)
with tempfile.TemporaryDirectory() as path:
assert os.path.exists(path)
Expand Down
17 changes: 12 additions & 5 deletions tools/schemacode/bidsschematools/tests/test_make_testdata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import tarfile
import shutil

import pytest

Expand Down Expand Up @@ -30,9 +31,15 @@ def test_make_archive(bids_examples, bids_error_examples):
* Archives will be generated under `/tmp/bidsschematools-testdata-SCHEMA_VERSION.tar.gz`
"""

archive_name = f"bidsschematools-testdata-{__version__}"
archive_path = f"/tmp/{archive_name}.tar.gz"
target_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),"data","bundled"))
os.makedirs(target_dir, exist_ok = True)
shutil.copytree(bids_examples, f"{target_dir}/bids-examples")
shutil.copytree(bids_error_examples, f"{target_dir}/bids-error-examples")

with tarfile.open(archive_path, "w:gz") as tar:
tar.add(bids_examples, arcname=f"{archive_name}/bids-examples")
tar.add(bids_error_examples, arcname=f"{archive_name}/bids-error-examples")
# Keeping this for now, it would be really nice to have a separate archive someday.
# archive_name = f"bidsschematools-testdata-{__version__}"
# archive_path = f"/tmp/{archive_name}.tar.gz"

# with tarfile.open(archive_path, "w:gz") as tar:
# tar.add(bids_examples, arcname=f"{archive_name}/bids-examples")
# tar.add(bids_error_examples, arcname=f"{archive_name}/bids-error-examples")
2 changes: 1 addition & 1 deletion tools/schemacode/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bidsschematools =
data/schema/BIDS_VERSION
data/schema/SCHEMA_VERSION
data/schema/**/*.yaml
tests/data/*
tests/data/**/*

[options.entry_points]
console_scripts =
Expand Down