Skip to content

Commit 44bef94

Browse files
authored
Release 0.0.5
1 parent d3bbc22 commit 44bef94

File tree

8 files changed

+303
-11
lines changed

8 files changed

+303
-11
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ name: CI-main
44

55
# Controls when the action will run.
66
on:
7-
8-
pull_request:
9-
branches:
10-
- '**'
11-
127
push:
138
branches:
149
- main
@@ -32,17 +27,21 @@ jobs:
3227
- uses: actions/checkout@v2
3328

3429
- name: Build aperturedb
35-
run: |
36-
mkdir /tmp/aperturedb-client
37-
cp -r * /tmp/aperturedb-client/
38-
cd docker/test
39-
mv /tmp/aperturedb-client .
40-
docker build -t aperturedb-client-testing .
30+
run: './ci.sh'
31+
shell: bash
4132

4233
- name: Run tests
4334
run: |
4435
docker run aperturedb-client-testing
4536
37+
- name: Tag
38+
run: './tag.sh'
39+
shell: bash
40+
41+
- name: GitHub Release
42+
run: 'TOKEN=${{ secrets.GITHUBPAT }} ./github_release.sh'
43+
shell: bash
44+
4645
trailing-spaces:
4746

4847
# The type of runner that the job will run on Ubuntu 18.04 (latest)

.github/workflows/pr.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This is a basic workflow to run tests on commit/PRs on develop
2+
3+
name: CI-pr
4+
5+
# Controls when the action will run.
6+
on:
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs
15+
# that can run sequentially or in parallel
16+
jobs:
17+
# This workflow contains a single job called "build-test"
18+
build_and_test:
19+
# The type of runner that the job will run on Ubuntu 18.04 (latest)
20+
runs-on: ubuntu-latest
21+
22+
# Steps represent a sequence of tasks that will be
23+
# executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE,
26+
# so your job can access it
27+
- uses: actions/checkout@v2
28+
29+
- name: Build aperturedb
30+
run: './ci.sh'
31+
shell: bash
32+
33+
- name: Run tests
34+
run: |
35+
docker run aperturedb-client-testing
36+
37+
trailing-spaces:
38+
39+
# The type of runner that the job will run on Ubuntu 18.04 (latest)
40+
runs-on: ubuntu-latest
41+
42+
# Steps represent a sequence of tasks that will be
43+
# executed as part of the job
44+
steps:
45+
# Checks-out your repository under $GITHUB_WORKSPACE,
46+
# so your job can access it
47+
- uses: actions/checkout@v2
48+
- uses: luisremis/find-trailing-whitespace@master

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This is a basic workflow to run tests on commit/PRs on develop
2+
3+
name: CI-release
4+
5+
# Controls when the action will run.
6+
on:
7+
push:
8+
branches:
9+
- release-*
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs
15+
# that can run sequentially or in parallel
16+
jobs:
17+
# This workflow contains a single job called "build-test"
18+
build_and_test:
19+
# The type of runner that the job will run on Ubuntu 18.04 (latest)
20+
runs-on: ubuntu-latest
21+
22+
# Steps represent a sequence of tasks that will be
23+
# executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE,
26+
# so your job can access it
27+
- uses: actions/checkout@v2
28+
29+
- name: Build aperturedb
30+
run: './ci.sh'
31+
shell: bash
32+
33+
- name: Run tests
34+
run: |
35+
docker run aperturedb-client-testing
36+
37+
trailing-spaces:
38+
39+
# The type of runner that the job will run on Ubuntu 18.04 (latest)
40+
runs-on: ubuntu-latest
41+
42+
# Steps represent a sequence of tasks that will be
43+
# executed as part of the job
44+
steps:
45+
# Checks-out your repository under $GITHUB_WORKSPACE,
46+
# so your job can access it
47+
- uses: actions/checkout@v2
48+
- uses: luisremis/find-trailing-whitespace@master

ci.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source $(dirname "$0")/version.sh
6+
7+
# Check and updates version based on release branch name
8+
update_version() {
9+
echo "Checking versions"
10+
if [[ $BRANCH_NAME != "release"* ]]; then
11+
echo "Not release branch - skipping version update"
12+
return
13+
fi
14+
IFS=. read MAJOR_V MINOR_V MICRO_V <<<"${BRANCH_NAME##release-}"
15+
if [ -z "$MAJOR_V" ]; then
16+
echo "Missing major version"
17+
exit 1
18+
fi
19+
if [ -z "$MINOR_V" ]; then
20+
echo "Missing minor version"
21+
exit 1
22+
fi
23+
if [ -z "$MICRO_V" ]; then
24+
echo "Missing micro version"
25+
exit 1
26+
fi
27+
VERSION_BUMP=$MAJOR_V.$MINOR_V.$MICRO_V
28+
if [ $BUILD_VERSION == $VERSION_BUMP ]; then
29+
echo "Versions match - skipping update"
30+
return
31+
fi
32+
echo "Updating version $BUILD_VERSION to $VERSION_BUMP"
33+
# Replace version in __init__.py
34+
sed -i "/#define VDMS_VERSION .*/c\#define VDMS_VERSION \"${UPDATED_APP_VERSION}\"" ./src/aperturedb/version.h
35+
sed -i "/#define VDMS_VERSION_MAJOR .*/c\#define VDMS_VERSION_MAJOR ${MAJOR_V}" ./src/aperturedb/version.h
36+
sed -i "/#define VDMS_VERSION_MINOR .*/c\#define VDMS_VERSION_MINOR ${MINOR_V}" ./src/aperturedb/version.h
37+
sed -i "/#define VDMS_VERSION_MICRO .*/c\#define VDMS_VERSION_MICRO ${MICRO_V}" ./src/aperturedb/version.h
38+
39+
# Commit and push version bump
40+
git config --local user.name "github-actions[bot]"
41+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+
git add ./src/aperturedb/version.h
43+
git commit -m "Version bump: ${BUILD_VERSION} to ${VERSION_BUMP}"
44+
git push --set-upstream origin $BRANCH_NAME
45+
BUILD_VERSION=$VERSION_BUMP
46+
}
47+
48+
build_apperturedb() {
49+
mkdir /tmp/aperturedb-client
50+
cp -r * /tmp/aperturedb-client/
51+
cd docker/test
52+
mv /tmp/aperturedb-client .
53+
docker build -t aperturedb-client-testing .
54+
}
55+
56+
# Fetch branch
57+
if [ -z ${BRANCH_NAME+x} ]
58+
then
59+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
60+
fi
61+
62+
echo "Branch: $BRANCH_NAME"
63+
64+
# Set default version to develop
65+
BUILD_VERSION=develop
66+
67+
# Trigger read version
68+
read_version
69+
echo "Build version: $BUILD_VERSION"
70+
71+
# Trigger update version
72+
update_version
73+
74+
build_apperturedb

github_release.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#! /bin/bash
2+
3+
source $(dirname "$0")/version.sh
4+
5+
# Set default version to develop
6+
BUILD_VERSION=develop
7+
8+
# Trigger read version
9+
read_version
10+
echo "Build version: $BUILD_VERSION"
11+
12+
create_release() {
13+
user="aperture-data"
14+
repo="aperturedb-cpp"
15+
token=$TOKEN
16+
tag="v$BUILD_VERSION"
17+
18+
command="curl -s -o release.json -w '%{http_code}' \
19+
--request POST \
20+
--header 'Accept: application/vnd.github.v3+json' \
21+
--header 'Authorization: token ${token}' \
22+
--header 'content-type: application/json' \
23+
--data '{\"tag_name\": \"${tag}\", \"name\": \"${tag}\", \"body\":\"Release ${tag}\"}' \
24+
https://api.github.com/repos/$user/$repo/releases"
25+
http_code=`eval $command`
26+
if [ $http_code == "201" ]; then
27+
echo "created release:"
28+
cat release.json
29+
else
30+
echo "create release failed with code '$http_code':"
31+
cat release.json
32+
echo "command:"
33+
echo $command
34+
return 1
35+
fi
36+
}
37+
38+
upload_custom_release_file() {
39+
mkdir /tmp/aperturedb-cpp
40+
mkdir -p /tmp/aperturedb-cpp/lib
41+
mkdir -p /tmp/aperturedb-cpp/include
42+
43+
docker create -ti --name aperturedb aperturedb-client-testing bash
44+
docker start aperturedb
45+
docker exec aperturedb bash -c "mkdir -p /x64; cp /usr/local/lib/libprotobuf.so.* /x64"
46+
docker exec aperturedb bash -c "cp /aperturedb-client/lib/* /x64"
47+
docker exec aperturedb bash -c "mkdir -p /comm; cp /aperturedb-client/include/comm/* /comm"
48+
docker cp aperturedb:/x64/ /tmp/aperturedb-cpp/lib/
49+
docker cp aperturedb:/comm/ /tmp/aperturedb-cpp/include/
50+
51+
tar -cvzf libs_64.tgz -C /tmp aperturedb-cpp
52+
docker stop aperturedb
53+
docker rm -f aperturedb
54+
55+
token=$TOKEN
56+
file="libs_64.tgz"
57+
name="libs_64.tgz"
58+
59+
url=`jq -r .upload_url release.json | cut -d{ -f'1'`
60+
command="\
61+
curl -s -o upload.json -w '%{http_code}' \
62+
--request POST \
63+
--header 'Accept: application/vnd.github.v3+json' \
64+
--header 'Authorization: token ${token}' \
65+
--header 'Content-Type: application/octet-stream' \
66+
--data-binary @\"${file}\"
67+
${url}?name=${name}"
68+
http_code=`eval $command`
69+
if [ $http_code == "201" ]; then
70+
echo "asset $name uploaded:"
71+
jq -r .browser_download_url upload.json
72+
else
73+
echo "upload failed with code '$http_code':"
74+
cat upload.json
75+
echo "command:"
76+
echo $command
77+
return 1
78+
fi
79+
}
80+
81+
82+
create_release
83+
upload_custom_release_file

src/aperturedb/version.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
*
3+
* @copyright Copyright (c) 2019 ApertureData Inc.
4+
*
5+
*/
6+
7+
#pragma once
8+
9+
// Versioning
10+
11+
12+
// This is the version for comparison
13+
#define VDMS_VERSION_MAJOR 0
14+
#define VDMS_VERSION_MINOR 0
15+
#define VDMS_VERSION_MICRO 5

tag.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source $(dirname "$0")/version.sh
6+
7+
# Trigger read version
8+
read_version
9+
echo "Build version: $BUILD_VERSION"
10+
11+
git config --local user.name "github-actions[bot]"
12+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
13+
git tag "v$BUILD_VERSION" $TAG_BASE
14+
git push origin "v$BUILD_VERSION"

version.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Read version
2+
read_version() {
3+
MAJOR_V=$(awk '/VDMS_VERSION_MAJOR/{print $NF}' src/aperturedb/version.h)
4+
MINOR_V=$(awk '/VDMS_VERSION_MINOR/{print $NF}' src/aperturedb/version.h)
5+
MICRO_V=$(awk '/VDMS_VERSION_MICRO/{print $NF}' src/aperturedb/version.h)
6+
# Verify all the fields in version are set
7+
if [ $MAJOR_V != '' ] && [ $MINOR_V != '' ] && [ $MICRO_V != '' ]
8+
then
9+
BUILD_VERSION="$MAJOR_V.$MINOR_V.$MICRO_V"
10+
fi
11+
}

0 commit comments

Comments
 (0)