-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 11ac70b
Showing
23 changed files
with
5,871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- run: npm install | ||
- run: npm run build | ||
- run: npm run typecheck | ||
- run: npm run lint | ||
- run: npm run format -- --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy Worker | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: CI | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build & Deploy Worker | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
.wrangler/ | ||
.dev.vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
A Cloudflare Worker for managing ZLS build artifacts. | ||
|
||
# API | ||
|
||
The API Endpoint is `releases.zigtools.org`. | ||
|
||
## /v1/select-zls-version?zig_version=${VERSION} | ||
|
||
> [!IMPORTANT] | ||
> If you are developing a tool that automatically installs ZLS then you came to the right place! | ||
Will respond with metadata about a ZLS build that is compatible with the given Zig version. | ||
The response body is similar to Zig's [index.json](https://ziglang.org/download/index.json). | ||
|
||
### Example | ||
|
||
```bash | ||
curl "https://releases.zigtools.org/v1/select-zls-version?zig_version=0.12.0" | ||
>>> TODO | ||
``` | ||
|
||
```bash | ||
curl "https://releases.zigtools.org/v1/select-zls-version?zig_version=0.13.0-dev.7%2B73c6c13a" # 0.13.0-dev.7+73c6c13a | ||
>>> TODO | ||
``` | ||
|
||
```bash | ||
curl "https://releases.zigtools.org/v1/select-zls-version?zig_version=1.0.0" | ||
>>> null | ||
``` | ||
|
||
## /v1/select-zls-version (TODO) | ||
|
||
> [!WARNING] | ||
> This has not been implemented yet | ||
The response body imitates Zig's [index.json](https://ziglang.org/download/index.json) except that there is no field for `master`. Development builds of ZLS should be queried by supplying the Zig version that is being used. | ||
|
||
### Example | ||
|
||
```bash | ||
curl "https://releases.zigtools.org/v1/select-zls-version" | ||
>>> TODO | ||
``` | ||
|
||
## /v1/publish | ||
|
||
> [!IMPORTANT] | ||
> This request is only intended to be used by ZLS's GitHub CI. | ||
The body is a `multipart/form-data` with the following key value pairs: | ||
|
||
- `zls-version`: The ZLS version which must be semantic version | ||
- `zig-version`: The Zig version which must be semantic version | ||
- `minimum-build-zig-version`: The minimum Zig version that is required to compile and test ZLS: | ||
- `minimum-runtime-zig-version`: The minimum Zig version that is required to run ZLS: | ||
|
||
All other fields are interpreted as release artifacts. The key must have the following format: | ||
|
||
`zls-${ARCH}-${OS}-${ZLS_VERSION}.(tar.xz|zip)` (Example: `zls-x86_64-linux-0.1.0.tar.xz`) | ||
|
||
> [!WARNING] | ||
> Minisign support has not been implemented yet. | ||
Release artifacts can also be signed with [minisign](https://jedisct1.github.io/minisign/) by publishing an additional `.minisign` file for every artifact. (Example: `zls-x86_64-linux-0.1.0.tar.xz.minisign`) | ||
|
||
## Development | ||
|
||
```bash | ||
# start a local worker | ||
git clone https://github.com/zigtools/release-worker | ||
cd release-worker | ||
npm install | ||
npx wrangler d1 execute production-db-backend --local --file=./migrations/0000_initial.sql | ||
npm run dev | ||
``` | ||
|
||
```bash | ||
# Publish a ZLS release (Requires `tar` and `7z`) | ||
git clone https://github.com/zigtools/zls | ||
cd zls | ||
ZLS_WORKER_ENDPOINT=http://localhost:8787 zig build release -Drelease-publish=success --summary all | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import eslint from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
import prettierConfig from "eslint-config-prettier"; | ||
|
||
export default tseslint.config( | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
eslint.configs.recommended, | ||
...tseslint.configs.stylisticTypeChecked, | ||
...tseslint.configs.strictTypeChecked, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
prettierConfig, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
project: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DROP TABLE IF EXISTS ZLSReleases; | ||
CREATE TABLE ZLSReleases ( | ||
ZLSVersion TEXT NOT NULL PRIMARY KEY, | ||
ZLSVersionMajor INTEGER NOT NULL, | ||
ZLSVersionMinor INTEGER NOT NULL, | ||
ZLSVersionPatch INTEGER NOT NULL, | ||
ZLSVersionBuildID INTEGER, | ||
IsRelease BOOLEAN NOT NULL, | ||
JsonData TEXT NOT NULL | ||
); | ||
CREATE INDEX IF NOT EXISTS idx_zls_releases_zls_version ON ZLSReleases(ZLSVersion); | ||
CREATE INDEX IF NOT EXISTS idx_zls_releases_is_release_major_minor_patch ON ZLSReleases(IsRelease, ZLSVersionMajor, ZLSVersionMinor, ZLSVersionPatch); |
Oops, something went wrong.