Skip to content

Commit af8e753

Browse files
committed
Added wrokflow
Checkout repo using ssh Added docker push
1 parent 5ce0888 commit af8e753

File tree

6 files changed

+193
-1
lines changed

6 files changed

+193
-1
lines changed

.github/workflows/release.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: release
2+
3+
on:
4+
schedule:
5+
- cron: '*/10 * * * *' # schedule nightly build daily at midnight UTC
6+
# The "create tags" trigger is specifically focused on the creation of new tags, while the "push tags" trigger is activated when tags are pushed, including both new tag creations and updates to existing tags.
7+
create:
8+
tags:
9+
- "v*.*.*" # normal release
10+
- "nightly" # the only one mutable tag
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Ensure workspace ownership
17+
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
18+
19+
# https://github.com/actions/checkout/blob/v3/README.md
20+
- name: Check out code
21+
uses: actions/checkout@v3
22+
with:
23+
ssh-key: ${{ secrets.MY_DEPLOY_KEY }}
24+
25+
- name: Prepare release body
26+
run: |
27+
if [[ $GITHUB_EVENT_NAME == 'create' ]]; then
28+
RELEASE_TAG=${GITHUB_REF#refs/tags/}
29+
if [[ $RELEASE_TAG == 'nightly' ]]; then
30+
PRERELEASE=true
31+
else
32+
PRERELEASE=false
33+
fi
34+
echo "Workflow triggered by create tag: $RELEASE_TAG"
35+
else
36+
RELEASE_TAG=nightly
37+
PRERELEASE=true
38+
echo "Workflow triggered by schedule"
39+
fi
40+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
41+
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
42+
RELEASE_DATETIME=$(date --rfc-3339=seconds)
43+
cat <<EOF > release_template.md
44+
Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME
45+
EOF
46+
envsubst < release_template.md > release_body.md
47+
48+
- name: Move the existing mutable tag
49+
# https://github.com/softprops/action-gh-release/issues/171
50+
run: |
51+
if [[ $GITHUB_EVENT_NAME == 'schedule' ]]; then
52+
# Determine if a given tag exists and matches a specific Git commit.
53+
# actions/checkout@v3 fetch-tags doesn't work when triggered by schedule
54+
git fetch --tags
55+
if [ "$(git rev-parse -q --verify "refs/tags/$RELEASE_TAG")" = "$GITHUB_SHA" ]; then
56+
echo "mutalbe tag $RELEASE_TAG exists and matchs $GITHUB_SHA"
57+
else
58+
git tag -f $RELEASE_TAG $GITHUB_SHA
59+
git push -f origin $RELEASE_TAG:refs/tags/$RELEASE_TAG
60+
echo "created/moved mutalbe tag $RELEASE_TAG to $GITHUB_SHA"
61+
fi
62+
fi
63+
64+
# https://github.com/actions/setup-go
65+
- name: Setup go
66+
uses: actions/setup-go@v4
67+
with:
68+
go-version: '^1.21.5' # The Go version to download (if necessary) and use.
69+
70+
- name: Build test binary
71+
run: go test -c .
72+
73+
- name: Create or overwrite a release
74+
# https://github.com/actions/upload-release-asset has been replaced by https://github.com/softprops/action-gh-release
75+
uses: softprops/action-gh-release@v1
76+
with:
77+
token: ${{ secrets.MY_GITHUB_TOKEN }} # Use the secret as an environment variable
78+
prerelease: ${{ env.PRERELEASE }}
79+
draft: false
80+
tag_name: ${{ env.RELEASE_TAG }}
81+
# The body field does not support environment variable substitution directly.
82+
body_path: release_body.md
83+
files: |
84+
bkdtree.test
85+
86+
- name: Set up QEMU
87+
uses: docker/setup-qemu-action@v3
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
92+
# https://github.com/marketplace/actions/docker-login
93+
- name: Login to Docker Hub
94+
uses: docker/login-action@v3
95+
with:
96+
username: yuzhichang
97+
password: ${{ secrets.DOCKERHUB_TOKEN }}
98+
99+
# https://github.com/marketplace/actions/build-and-push-docker-images
100+
- name: Build and push
101+
uses: docker/build-push-action@v5
102+
with:
103+
context: .
104+
tags: yuzhichang/bkdtree:${{ env.RELEASE_TAG }}
105+
file: Dockerfile
106+
push: true

.github/workflows/tests.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
types: [ opened, synchronize, reopened, edited ]
8+
9+
jobs:
10+
tests:
11+
name: tests
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Ensure workspace ownership
15+
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
16+
17+
- name: Check out code
18+
uses: actions/checkout@v3
19+
with:
20+
ssh-key: ${{ secrets.MY_DEPLOY_KEY }}

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM debian:stable-slim
2+
3+
COPY bkdtree.test /usr/bin
4+
5+
ENTRYPOINT [ "/usr/bin/bkdtree.test" ]

ROADMAP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roadmap
22

3-
This document defines the roadmap for BKD tree development.
3+
This document describes the roadmap for BKD tree development.
44

55
#### KD tree (memory)
66
- [D] build - Kdtree in mem

go.mod

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module github.com/deepfabric/bkdtree
2+
3+
go 1.21.5
4+
5+
require (
6+
github.com/deepfabric/go-datastructures v0.0.0-20170927014437-f6355768d70e
7+
github.com/juju/testing v1.1.0
8+
github.com/keegancsmith/nth v0.0.0-20160926112203-ee21de2f07b8
9+
github.com/pkg/errors v0.9.1
10+
)
11+
12+
require (
13+
github.com/juju/loggo v1.0.0 // indirect
14+
github.com/kr/pretty v0.3.1 // indirect
15+
github.com/kr/text v0.2.0 // indirect
16+
github.com/rogpeppe/go-internal v1.9.0 // indirect
17+
github.com/stretchr/testify v1.8.4 // indirect
18+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
19+
gopkg.in/yaml.v2 v2.4.0 // indirect
20+
)

go.sum

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/deepfabric/go-datastructures v0.0.0-20170927014437-f6355768d70e h1:znsjfbR2/zGoKYztUmGElpU1jTCf4GB+ibRdBEAeCeE=
5+
github.com/deepfabric/go-datastructures v0.0.0-20170927014437-f6355768d70e/go.mod h1:XzfNeeU3SD84cKQARZs5MODWAzwO3v5SbNrVAVpN2pY=
6+
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
7+
github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM=
8+
github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8=
9+
github.com/juju/loggo v1.0.0 h1:Y6ZMQOGR9Aj3BGkiWx7HBbIx6zNwNkxhVNOHU2i1bl0=
10+
github.com/juju/loggo v1.0.0/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg=
11+
github.com/juju/testing v1.1.0 h1:+WWez0vCu6dtnpLIzfuuo3bN3x62LBIyMDCfvMYP+Qg=
12+
github.com/juju/testing v1.1.0/go.mod h1:1XQGptw6JWFvRWb3ewilUdTBG0oGcoI2kdX9Z1VEzhU=
13+
github.com/keegancsmith/nth v0.0.0-20160926112203-ee21de2f07b8 h1:QCdRsV8WNLoLAUwAm6G4FZF3OpCkRtU0QDjGkp5/1r4=
14+
github.com/keegancsmith/nth v0.0.0-20160926112203-ee21de2f07b8/go.mod h1:GGie0rcBbRSciSNcfYjdzMR0jL66DbnsHDOhwIJ4L7g=
15+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
16+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
17+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
18+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
19+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
20+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
21+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
22+
github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
23+
github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
24+
github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
25+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
26+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
27+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
28+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
29+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30+
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
31+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
32+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
33+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
34+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
35+
gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
36+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
37+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
38+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
39+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
40+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
41+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)