Skip to content

Commit 98b0b2b

Browse files
committed
Merge remote-tracking branch 'sqld/main'
2 parents cef416b + e2aeecd commit 98b0b2b

File tree

167 files changed

+38549
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+38549
-0
lines changed

libsql-server/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
./target
2+
./end-to-end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
17+
version-resolver:
18+
major:
19+
labels:
20+
- 'major'
21+
minor:
22+
labels:
23+
- 'minor'
24+
patch:
25+
labels:
26+
- 'patch'
27+
default: patch
28+
template: |
29+
## Changes
30+
31+
$CHANGES
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Create and publish sqld binaried and Docker image
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}-devel
10+
11+
jobs:
12+
# docker image build and upload to ghcr
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
with:
23+
submodules: recursive
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}-${{ github.event.pull_request.head.sha }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
cache-from: type=gha
49+
cache-to: type=gha,mode=max
50+
51+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Create and publish sqld binaried and Docker image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
tags:
7+
- v*.*.*
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
# docker image build and upload to ghcr
15+
build-and-push-image:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
with:
25+
submodules: recursive
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
45+
with:
46+
context: .
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- main
8+
# pull_request event is required only for autolabeler
9+
pull_request:
10+
# Only following types are handled by the action, but one can default to all as well
11+
types: [opened, reopened, synchronize]
12+
# pull_request_target event is required for autolabeler to support PRs from forks
13+
# pull_request_target:
14+
# types: [opened, reopened, synchronize]
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
update_release_draft:
21+
permissions:
22+
# write permission is required to create a github release
23+
contents: write
24+
# write permission is required for autolabeler
25+
# otherwise, read permission is required at least
26+
pull-requests: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
# (Optional) GitHub Enterprise requires GHE_HOST variable set
30+
#- name: Set GHE_HOST
31+
# run: |
32+
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
33+
34+
# Drafts your next Release notes as Pull Requests are merged into "master"
35+
- uses: release-drafter/release-drafter@v5
36+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
37+
# with:
38+
# config-name: my-config.yml
39+
# disable-autolabeler: true
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Copyright 2022-2023, axodotdev
2+
# SPDX-License-Identifier: MIT or Apache-2.0
3+
#
4+
# CI that:
5+
#
6+
# * checks for a Git Tag that looks like a release
7+
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
8+
# * uploads those artifacts to the Github Release™
9+
# * undrafts the Github Release™ on success
10+
#
11+
# Note that a Github Release™ with this tag is assumed to exist as a draft
12+
# with the appropriate title/body, and will be undrafted for you.
13+
name: Release
14+
15+
permissions:
16+
contents: write
17+
18+
# This task will run whenever you push a git tag that looks like a version
19+
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
20+
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
21+
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
22+
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
23+
#
24+
# If PACKAGE_NAME is specified, then the release will be for that
25+
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
26+
#
27+
# If PACKAGE_NAME isn't specified, then the release will be for all
28+
# (cargo-dist-able) packages in the workspace with that version (this mode is
29+
# intended for workspaces with only one dist-able package, or with all dist-able
30+
# packages versioned/released in lockstep).
31+
#
32+
# If you push multiple tags at once, separate instances of this workflow will
33+
# spin up, creating an independent Github Release™ for each one. However Github
34+
# will hard limit this to 3 tags per commit, as it will assume more tags is a
35+
# mistake.
36+
#
37+
# If there's a prerelease-style suffix to the version, then the Github Release™
38+
# will be marked as a prerelease.
39+
on:
40+
push:
41+
tags:
42+
- '**[0-9]+.[0-9]+.[0-9]+*'
43+
44+
jobs:
45+
# Run 'cargo dist plan' to determine what tasks we need to do
46+
plan:
47+
runs-on: ubuntu-latest
48+
outputs:
49+
has-releases: ${{ steps.plan.outputs.has-releases }}
50+
releases: ${{ steps.plan.outputs.releases }}
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
steps:
54+
- uses: actions/checkout@v3
55+
with:
56+
submodules: recursive
57+
- name: Install cargo-dist
58+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0-prerelease.6/cargo-dist-installer.sh | sh"
59+
- id: plan
60+
run: |
61+
cargo dist plan --tag=${{ github.ref_name }} --output-format=json > dist-manifest.json
62+
echo "dist plan ran successfully"
63+
cat dist-manifest.json
64+
65+
# We're assuming a draft Github Release™ with the desired title/tag/body already exists
66+
67+
# Upload the manifest to the Github Release™
68+
gh release upload ${{ github.ref_name }} dist-manifest.json
69+
echo "uploaded manifest!"
70+
71+
# Disable all the upload-artifacts tasks if we have no actual releases
72+
HAS_RELEASES=$(jq --raw-output ".releases != null" dist-manifest.json)
73+
echo "has-releases=$HAS_RELEASES" >> "$GITHUB_OUTPUT"
74+
echo "releases=$(jq --compact-output ".releases" dist-manifest.json)" >> "$GITHUB_OUTPUT"
75+
76+
# Build and packages all the platform-specific things
77+
upload-local-artifacts:
78+
# Let the initial task tell us to not run (currently very blunt)
79+
needs: plan
80+
if: ${{ needs.plan.outputs.has-releases == 'true' }}
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
# For these target platforms
85+
include:
86+
- os: "macos-11"
87+
dist-args: "--artifacts=local --target=aarch64-apple-darwin"
88+
install-dist: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0-prerelease.6/cargo-dist-installer.sh | sh"
89+
- os: "macos-11"
90+
dist-args: "--artifacts=local --target=x86_64-apple-darwin"
91+
install-dist: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0-prerelease.6/cargo-dist-installer.sh | sh"
92+
- os: "ubuntu-20.04"
93+
dist-args: "--artifacts=local --target=x86_64-unknown-linux-gnu"
94+
install-dist: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0-prerelease.6/cargo-dist-installer.sh | sh"
95+
runs-on: ${{ matrix.os }}
96+
env:
97+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
steps:
99+
- uses: actions/checkout@v3
100+
with:
101+
submodules: recursive
102+
- name: Install cargo-dist
103+
run: ${{ matrix.install-dist }}
104+
- name: Run cargo-dist
105+
# This logic is a bit janky because it's trying to be a polyglot between
106+
# powershell and bash since this will run on windows, macos, and linux!
107+
# The two platforms don't agree on how to talk about env vars but they
108+
# do agree on 'cat' and '$()' so we use that to marshal values between commands.
109+
run: |
110+
# Actually do builds and make zips and whatnot
111+
cargo dist build --tag=${{ github.ref_name }} --output-format=json ${{ matrix.dist-args }} > dist-manifest.json
112+
echo "dist ran successfully"
113+
cat dist-manifest.json
114+
115+
# Parse out what we just built and upload it to the Github Release™
116+
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json > uploads.txt
117+
echo "uploading..."
118+
cat uploads.txt
119+
gh release upload ${{ github.ref_name }} $(cat uploads.txt)
120+
echo "uploaded!"
121+
122+
# Build and package all the platform-agnostic(ish) things
123+
upload-global-artifacts:
124+
needs: upload-local-artifacts
125+
runs-on: "ubuntu-20.04"
126+
env:
127+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
steps:
129+
- uses: actions/checkout@v3
130+
with:
131+
submodules: recursive
132+
- name: Install cargo-dist
133+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0-prerelease.6/cargo-dist-installer.sh | sh"
134+
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
135+
- name: Fetch local artifacts
136+
run: |
137+
gh release download ${{ github.ref_name }} --dir target/distrib/
138+
- name: Run cargo-dist
139+
run: |
140+
cargo dist build --tag=${{ github.ref_name }} --output-format=json "--artifacts=global" > dist-manifest.json
141+
echo "dist ran successfully"
142+
cat dist-manifest.json
143+
144+
# Parse out what we just built and upload it to the Github Release™
145+
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json > uploads.txt
146+
echo "uploading..."
147+
cat uploads.txt
148+
gh release upload ${{ github.ref_name }} $(cat uploads.txt)
149+
echo "uploaded!"
150+
151+
upload-homebrew-formula:
152+
needs: [plan, upload-global-artifacts]
153+
runs-on: "ubuntu-20.04"
154+
env:
155+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
RELEASES: ${{ needs.plan.outputs.releases }}
157+
GITHUB_USER: "axo bot"
158+
GITHUB_EMAIL: "[email protected]"
159+
steps:
160+
- uses: actions/checkout@v3
161+
with:
162+
repository: "libsql/homebrew-sqld"
163+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
164+
# So we have access to the formula
165+
- name: Fetch local artifacts
166+
run: |
167+
gh release download ${{ github.ref_name }} --dir Formula --repo ${GITHUB_REPOSITORY} --clobber
168+
- name: Commit formula files
169+
run: |
170+
git config --global user.name "${GITHUB_USER}"
171+
git config --global user.email "${GITHUB_EMAIL}"
172+
173+
for release in $(echo "$RELEASES" | jq --compact-output '.[]'); do
174+
name=$(echo "$release" | jq .app_name --raw-output)
175+
version=$(echo "$release" | jq .app_version --raw-output)
176+
177+
git add Formula/${name}.rb
178+
git commit -m "${name} ${version}"
179+
done
180+
git push
181+
182+
# Mark the Github Release™ as a non-draft now that everything has succeeded!
183+
publish-release:
184+
# Only run after all the other tasks, but it's ok if upload-artifacts was skipped
185+
needs: [plan, upload-local-artifacts, upload-global-artifacts]
186+
if: ${{ always() && needs.plan.result == 'success' && (needs.upload-local-artifacts.result == 'skipped' || needs.upload-local-artifacts.result == 'success') && (needs.upload-global-artifacts.result == 'skipped' || needs.upload-global-artifacts.result == 'success') }}
187+
runs-on: ubuntu-latest
188+
env:
189+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190+
steps:
191+
- uses: actions/checkout@v3
192+
with:
193+
submodules: recursive
194+
- name: mark release as non-draft
195+
run: |
196+
gh release edit ${{ github.ref_name }} --draft=false

0 commit comments

Comments
 (0)