Skip to content
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
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
branches:
- main
- test
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies and set path
run: |
sudo apt-get update
sudo apt-get install -y ninja-build libcunit1-dev python3-pip
# Install meson as root so we can install to the system below.
sudo pip install meson
- name: Build tarball and changelogs
run: |
git rm -rf c/tests/meson-subproject
git config --global user.email "CI@CI.com"
git config --global user.name "Mr Robot"
git add -A
git commit -m "dummy commit to make meson not add in the symlinked directory"
meson c build-gcc
meson dist -C build-gcc
python docs/convert_changelog.py c/CHANGELOG.rst > C-CHANGELOG.txt
python docs/convert_changelog.py python/CHANGELOG.rst > PYTHON-CHANGELOG.txt
- name: Get the version
id: get_version
run:
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: C Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && contains(github.event.ref, 'C_')
with:
name: C API ${{ steps.get_version.outputs.VERSION }}
body_path: C-CHANGELOG.txt
draft: True
fail_on_unmatched_files: True
files: build-gcc/meson-dist/*
- name: Python Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && !contains(github.event.ref, 'C_')
with:
name: Python ${{ steps.get_version.outputs.VERSION }}
body_path: PYTHON-CHANGELOG.txt
draft: True
fail_on_unmatched_files: True
1 change: 1 addition & 0 deletions c/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.99.15
10 changes: 8 additions & 2 deletions c/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
project('tskit', ['c', 'cpp'], default_options: ['c_std=c99', 'cpp_std=c++11'])
project('tskit', ['c', 'cpp'],
version: files('VERSION'),
default_options: ['c_std=c99', 'cpp_std=c++11']
)

kastore_proj = subproject('kastore')
kastore_dep = kastore_proj.get_variable('kastore_dep')
Expand Down Expand Up @@ -43,7 +46,10 @@ if not meson.is_subproject()

test_core = executable('test_core',
sources: ['tests/test_core.c'],
link_with: [tskit_lib, test_lib], c_args: extra_c_args, dependencies: kastore_dep)
link_with: [tskit_lib, test_lib],
c_args: extra_c_args+['-DMESON_PROJECT_VERSION="@0@"'.format(meson.project_version())],
dependencies: kastore_dep,
)
test('core', test_core)

test_tables = executable('test_tables',
Expand Down
12 changes: 12 additions & 0 deletions c/tests/test_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,17 @@ test_avl_random(void)
validate_avl(sizeof(keys) / sizeof(*keys), keys);
}

static void
test_meson_version(void)
{
char version[100];

sprintf(
version, "%d.%d.%d", TSK_VERSION_MAJOR, TSK_VERSION_MINOR, TSK_VERSION_PATCH);
/* the MESON_PROJECT_VERSION define is passed in by meson when compiling */
CU_ASSERT_STRING_EQUAL(version, MESON_PROJECT_VERSION);
}

int
main(int argc, char **argv)
{
Expand All @@ -543,6 +554,7 @@ main(int argc, char **argv)
{ "test_avl_sequential", test_avl_sequential },
{ "test_avl_interleaved", test_avl_interleaved },
{ "test_avl_random", test_avl_random },
{ "test_meson_version", test_meson_version },
{ NULL, NULL },
};

Expand Down
15 changes: 3 additions & 12 deletions docs/convert_changelog.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import re
from pathlib import Path
import sys

SUBS = [
(r":user:`([A-Za-z0-9-]*)`", r"[@\1](https://github.com/\1)"),
(r":pr:`([0-9]*)`", r"[#\1](https://github.com/tskit-dev/tskit/issues/\1)"),
(r":issue:`([0-9]*)`", r"[#\1](https://github.com/tskit-dev/tskit/issues/\1)"),
]

FILES = [
Path(__file__).parent.parent / "c" / "CHANGELOG.rst",
Path(__file__).parent.parent / "python" / "CHANGELOG.rst",
]


def process_log(log):
delimiters_seen = 0
Expand All @@ -27,9 +22,5 @@ def process_log(log):
yield line


for file in FILES:
with open(file) as f:
print("-------------")
print(file)
print("-------------")
print("".join(process_log(f.readlines())))
with open(sys.argv[1]) as f:
print("".join(process_log(f.readlines())))
11 changes: 6 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,9 @@ git tag -a C_MAJOR.MINOR.PATCH -m "C API version C_MAJOR.MINOR.PATCH"
git push upstream --tags
```

Then prepare a release for the tag on GitHub, copying across the changelog.
Running `python docs/convert_changelog.py` will format the changelog for GitHub.
After a couple of minutes a github action will make a draft release with the changelog
at the [releases page](https://github.com/tskit-dev/tskit/releases). Check it looks
right and publish the release (Click on the little pencil).
After release, start a section in the changelog for new developments and close the
GitHub issue milestone of the release.

Expand All @@ -1123,9 +1124,9 @@ git push upstream --tags
This will trigger a build of the distribution artifacts for Python
on [Github Actions](https://github.com/tskit-dev/tskit/actions). and deploy
them to the [test PyPI](https://test.pypi.org/project/tskit/). Check
the release looks good there, then create a release on Github based on the tag you
pushed. Copy the changelog into the release. Running `python docs/convert_changelog.py`
will format the changelog for GitHub. Publishing this release will cause the github
the release looks good there, then publish the draft release on the
[releases page](https://github.com/tskit-dev/tskit/releases) (Click on the little pencil).
Publishing this release will cause the github
action to deploy to the [production PyPI](https://pypi.org/project/tskit/).
After release, start a section in the changelog for new developments and close the
GitHub issue milestone of the release.
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3507,6 +3507,11 @@ def test_tskit_version(self):
version = _tskit.get_tskit_version()
assert version == (0, 99, 15)

def test_tskit_version_file(self):
maj, min_, patch = _tskit.get_tskit_version()
with open(f"{tskit.__path__[0]}/../../c/VERSION") as f:
assert f.read() == f"{maj}.{min_}.{patch}"


def test_uninitialised():
# These methods work from an instance that has a NULL ref so don't check
Expand Down