chore: Add release-please (#14)

* Add CI

* Ignore some shelllints rules

* Cleanup
This commit is contained in:
Anatolios Laskaris 2023-03-14 17:01:39 +02:00 committed by GitHub
parent c1fa069dcb
commit 7d81ee9d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 194 additions and 30 deletions

3
.github/actionlint.yaml vendored Normal file
View File

@ -0,0 +1,3 @@
self-hosted-runner:
labels:
- builder

5
.github/misc/module.yaml vendored Normal file
View File

@ -0,0 +1,5 @@
version: 0
type: compiled
name: sqlite3
volumes:
sites: ./tmp

12
.github/release-please/config.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"bootstrap-sha": "c1fa069dcbadb1bf4bb076408ad4ddbd77c7ede0",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"package-name": "sqlite-wasm",
"component": "sqlite-wasm"
}
}
}

3
.github/release-please/manifest.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
".": "0.18.0"
}

37
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Build sqlite artifact
on:
workflow_call:
jobs:
build:
name: "Build sqlite.wasm"
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup wasi-sdk
run: |
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sdk-15.0-linux.tar.gz | tar xz -C ./
mv wasi-sdk-* wasi-sdk
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Marine
uses: baptiste0928/cargo-install@v1.3.1
with:
crate: marine
- name: Build sqlite-wasm
run: make
- name: Upload sqlite-wasm
uses: actions/upload-artifact@v3
with:
name: sqlite-wasm
path: sqlite3.wasm
if-no-files-found: error

18
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: "e2e"
on:
pull_request:
paths-ignore:
- "!**.md"
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
name: "sqlite"
uses: ./.github/workflows/build.yml

35
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: lint
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint actions
uses: reviewdog/action-actionlint@v1
env:
SHELLCHECK_OPTS: "-e SC2086 -e SC2207 -e SC2128 -e SC2035"
with:
reporter: github-pr-check
fail_on_error: true

75
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: "release"
on:
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release-created: ${{ steps.release.outputs['release_created'] }}
tag-name: ${{ steps.release.outputs['tag_name'] }}
version: ${{ steps.release.outputs['version'] }}
pr: ${{ steps.release.outputs['pr'] }}
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
build:
if: needs.release-please.outputs.release-created
needs: release-please
uses: ./.github/workflows/build.yml
publish:
runs-on: ubuntu-latest
needs:
- release-please
- build
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download sqlite-wasm
uses: actions/download-artifact@v3
with:
name: sqlite-wasm
path: artifacts/
- name: Create archive
run: tar caf artifacts/sqlite3.tar.gz -C ./artifacts/ sqlite3.wasm -C ../.github/misc/ module.yaml
- name: Generate checksums
id: sum
run: |
sha256sum * | tee > sqlite3_SHA256_SUMS
working-directory: artifacts
- name: Upload binaries
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*
tag_name: ${{ needs.release-please.outputs.tag-name }}

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
wasi-sdk
# IntelliJ # IntelliJ
.idea .idea

View File

@ -1,18 +0,0 @@
FROM ubuntu:20.04
RUN apt update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata \
&& apt install -y ca-certificates \
curl \
git \
make \
pkg-config \
libtinfo6 \
cargo
RUN cargo install marine --version 0.12.7
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sdk-15.0-linux.tar.gz | tar xz -C /
VOLUME /code
WORKDIR /code
CMD make

View File

@ -1,6 +1,6 @@
TARGET = sqlite3 TARGET = sqlite3
CC = /wasi-sdk-15.0/bin/clang CC = ./wasi-sdk/bin/clang
SYSROOT = /wasi-sdk-15.0/share/wasi-sysroot SYSROOT = ./wasi-sdk/share/wasi-sysroot
TARGET_TRIPLE = wasm32-wasi TARGET_TRIPLE = wasm32-wasi
CFLAGS = -fvisibility=hidden CFLAGS = -fvisibility=hidden
SDK = sdk/logger.h SDK = sdk/logger.h
@ -164,8 +164,8 @@ all: default
$(TARGET): $(SQLITE_SRC) $(WRAPPER_SRC) $(TARGET): $(SQLITE_SRC) $(WRAPPER_SRC)
$(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) $(SQLITE_FLAGS) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm $(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) $(SQLITE_FLAGS) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm
/root/.cargo/bin/marine set version -i ./sqlite3.wasm -v 0.7.0 marine set version -i ./sqlite3.wasm -v $(shell cat version.txt)
/root/.cargo/bin/marine set it -i ./sqlite3.wasm -w sqlite3.wit marine set it -i ./sqlite3.wasm -w sqlite3.wit
.PRECIOUS: $(TARGET) .PRECIOUS: $(TARGET)

View File

@ -1,8 +0,0 @@
version: '3'
services:
sqlite3:
build:
context: .
container_name: sqlite3_builder
volumes:
- .:/code

1
version.txt Normal file
View File

@ -0,0 +1 @@
0.18.0