Skip to content

Commit

Permalink
Merge branch 'zigzap:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
joeypas authored Jun 22, 2024
2 parents 06641b1 + 3f9c7d0 commit 53774be
Show file tree
Hide file tree
Showing 45 changed files with 775 additions and 428 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Works with Zig 0.11.0
name: Works with Zig 0.12.0
on:
push:
branches:
Expand All @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
version: 0.12.0
- name: Check zig version
run: zig version
- name: Build all examples
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/mastercheck-localhost.yml

This file was deleted.

65 changes: 52 additions & 13 deletions .github/workflows/mastercheck.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: Works with Zig master
on:
# push:
# branches:
# - master
# pull_request:
# branches:
# - master
# schedule:
# - cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- zig-0.13.0
pull_request:
branches:
- zig-0.13.0
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
ci:
strategy:
matrix:
# platform: [ubuntu-latest, windows-latest, macos-latest]
platform: [ubuntu-latest]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
Expand All @@ -26,5 +25,45 @@ jobs:
run: zig version
- name: Build all examples
run: zig build all
- name: Run all tests
run: zig build test
# Run tests separately so we can see more clearly which one fails
- name: Run mustache tests
run: zig build test-mustache
- name: Run httpparams tests
run: zig build test-httpparams
- name: Run sendfile tests
run: zig build test-sendfile
- name: Run authentication tests
run: zig build test-authentication
- name: Report end of tests
run: echo "tests finished"

update-readme:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
with:
version: master

- name: Build announceybot
run: zig build announceybot

- name: Run script to update README
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ steps.tag.outputs.version }}
run: |
zig-out/bin/announceybot update-readme "zig-0.13.0"
- name: Commit and push if it has changed
run: |
git diff
git checkout zig-0.13.0
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update README"
git push origin zig-0.13.0
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ wrk/csharp/obj/
wrk/csharp/out/
scratch
**/.mypy_cache/*
docs/
.DS_Store
.vs/
**/*.perflog
Expand Down
67 changes: 24 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# ⚡zap⚡ - blazingly fast backends in zig

![](https://github.com/zigzap/zap/actions/workflows/build-zig-11.yml/badge.svg) ![](https://github.com/zigzap/zap/actions/workflows/mastercheck.yml/badge.svg) [![Discord](https://img.shields.io/discord/1107835896356675706?label=chat&logo=discord&style=plastic)](https://discord.gg/jQAAN6Ubyj)
Expand All @@ -26,18 +24,18 @@ that it proved to be:

Exactly the goals I set out to achieve!


## Most FAQ:

### Zap uses the latest stable zig release (0.11.0) for a reason. So you don't have to keep up with frequent breaking changes. It's an "LTS feature". If you want to use zig master, use the `zig-0.12.0` branch but be aware that I don't provide `build.zig.zon` snippets or tagged releases for it for the time being. If you know what you are doing, that shouldn't stop you from using it with zig master though.
### Zap uses the latest stable zig release (0.1@.0) for a reason. So you don't have to keep up with frequent breaking changes. It's an "LTS feature". If you want to use zig master, use the `zig-master` branch (coming soon) but be aware that I don't provide `build.zig.zon` snippets or tagged releases for it for the time being. If you know what you are doing, that shouldn't stop you from using it with zig master though.

- Q: **Where is the API documentation?**
- A: Docs are a work in progress. You can check them out [here](https://zigzap.org/zap). The docs are based on the `zig-0.12.0` branch but apply to the current release (zig 0.11.0), too.
- A: Docs are a work in progress. You can check them out [here](https://zigzap.org/zap).
- A: Run `zig build run-docserver` to serve them locally.
- Q: **Zap doesn't build with Zig master?**
- A: See the 0.12.0 branch. An example of how to use it is
[here](https://github.com/zigzap/hello-0.12.0). Please note that the 0.12.0
branch is not the official master branch of ZAP. Yet. Until zig 0.12.0 is
released.
- A: See the zig-master branch (soon). An example of how to use it is
[here](https://github.com/zigzap/hello-0.13.0). Please note that the
zig-master branch is not the official master branch of ZAP. Yet. Until zig
0.13.0 is released.
- Q: **Does ZAP work on Windows?**
- A: No. This is due to the underlying facil.io C library. Future versions of
facil.io might support Windows but there is no timeline yet. Your best options
Expand All @@ -57,6 +55,10 @@ I recommend checking out **Endpoint-based examples for more realistic
use cases**. Most of the examples are super stripped down to only include
what's necessary to show a feature.

**NOTE: To see API docs, run `zig build run-docserver`.** To specify a custom
port and docs dir: `zig build docserver && zig-out/bin/docserver --port=8989
--docs=path/to/docs`.

- **Super easy build process**: Zap's `build.zig` now uses the new Zig package
manager for its C-dependencies, no git submodules anymore.
- _tested on Linux and macOS (arm, M1)_
Expand Down Expand Up @@ -222,7 +224,7 @@ code leaks memory.

## Getting started

Make sure you have **the latest zig release (0.11.0)** installed. Fetch it from
Make sure you have zig 0.12.0 installed. Fetch it from
[here](https://ziglang.org/download).

```shell
Expand All @@ -236,7 +238,7 @@ $ # open http://localhost:3000 in your browser

## Using ⚡zap⚡ in your own projects

Make sure you have **the latest zig release (0.11.0)** installed. Fetch it from
Make sure you have **the latest zig release (0.12.0)** installed. Fetch it from
[here](https://ziglang.org/download).

If you don't have an existing zig project, create one like this:
Expand All @@ -250,7 +252,7 @@ $ git init ## (optional)
`nix develop` to get a development shell providing zig and all
dependencies to build and run the GO, python, and rust examples for the
`wrk` performance tests. For the mere building of zap projects,
`nix develop .#build` will only fetch zig 0.11.0.
`nix develop .#build` will only fetch zig 0.11.0. TODO: upgrade to zig 0.12.

With an existing Zig project, adding Zap to it is easy:

Expand All @@ -266,12 +268,15 @@ To add zap to `build.zig.zon`:
.version = "0.0.1",
.dependencies = .{
// zap v0.6.0
// zap v0.7.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.6.0.tar.gz",
.hash = "1220a5a1e6b18fa384d8a98e5d5a25720ddadbcfed01da2e4ca55c7cfb3dc1caa62a",
}
}
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.7.0.tar.gz",
.hash = "12203126ff24e8018655eb7444c91f0d527d1213af16fcf2a578281abc994d01cc46",
},
},
.paths = .{
"",
},
}
```
<!-- INSERT_DEP_END -->
Expand All @@ -285,8 +290,8 @@ Then, in your `build.zig`'s `build` function, add the following before
.optimize = optimize,
.openssl = false, // set to true to enable TLS support
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
exe.root_module.addImport("zap", zap.module("zap"));
```

From then on, you can use the Zap package in your project. Check out the
Expand Down Expand Up @@ -405,27 +410,3 @@ pub fn main() !void {
}
```

























Loading

0 comments on commit 53774be

Please sign in to comment.