Skip to content

Commit

Permalink
Release/0.0.1 (#5)
Browse files Browse the repository at this point in the history
THIS IS NOT PRODUCTION READY.
  • Loading branch information
hironichu authored Sep 25, 2023
1 parent f0f93d6 commit 6b5ed6a
Show file tree
Hide file tree
Showing 54 changed files with 3,414 additions and 1,171 deletions.
15 changes: 15 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Security Policy

## Supported Versions

The following version of the project are currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 0.1.x | :white_check_mark: |


## Reporting a Vulnerability

To report a vulnerability, please open an issue with the label "security".

206 changes: 206 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
on:
pull_request:
types: [review_requested, opened]
branches:
- 'releases/**'
push:
branches:
- 'main'
- 'releases/**'
- 'testing/**'
- 'feat/**'
- 'fix/**'
- 'dev/**'
concurrency:
group: ${{ github.workflow }}-${{ !contains(github.event.pull_request.labels.*.name, 'test-flaky-ci') && github.head_ref || github.run_id }}
cancel-in-progress: true

name: Webtransport CI
jobs:
build:
if: |
github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'hironichu:')
strategy:
matrix:
os: [ 'ubuntu-latest', 'self-hosted', "macos-latest", "windows-latest"]
job: [build]
profile: [debug, release]
include:
- os: 'ubuntu-latest'
job: lint
profile: debug

name: ${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Create source tarballs (release, linux)
if: |
startsWith(matrix.os, 'ubuntu') &&
matrix.profile == 'release' &&
matrix.job == 'build' &&
github.repository == 'hironichu/webtransport' &&
startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p target/release
tar --exclude=".git*" --exclude=target --exclude=third_party/prebuilt \
-czvf target/release/webtransport.tar.gz -C .. webtransport
- name: Setting Up Rust
uses: dtolnay/rust-toolchain@master
if: |
matrix.job != 'lint'
with:
toolchain: stable
- name: Install Deno from .land
if: matrix.os != 'self-hosted'
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install Deno from source
if: matrix.os == 'self-hosted'
run: |
echo "Check if Deno is already installed"
if ! type deno > /dev/null; then
echo "Deno is not installed, installing..."
curl -s https://gist.githubusercontent.com/LukeChannings/09d53f5c364391042186518c8598b85e/raw/ac8cd8c675b985edd4b3e16df63ffef14d1f0e24/deno_install.sh | sh
else
echo "Deno is already installed"
fi
- name: Error on warning
run: echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV

- name: Deno Format
if: matrix.job == 'lint'
run: deno task util:fmt

- name: Deno lint
if: matrix.job == 'lint'
run: deno task util:lint

- name: Build Debug
if: |
(matrix.job == 'build' && matrix.profile == 'debug')
run: deno task build:${{matrix.profile}}

- name: Build release
if: |
(matrix.job == 'build' && matrix.profile == 'release') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
run: deno task build:${{matrix.profile}}

- name: Move arm file (release)
if: startsWith(matrix.os, 'self-hosted') && matrix.job == 'build' && matrix.profile == 'release' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
run: |
mv target/${{matrix.profile}}/libwebtransport.so target/${{matrix.profile}}/libwebtransport_aarch64.so
- name: Move arm file (debug)
if: startsWith(matrix.os, 'self-hosted') && matrix.job == 'build' && matrix.profile == 'debug'
run: |
mv target/${{matrix.profile}}/libwebtransport.so target/${{matrix.profile}}/libwebtransport_aarch64.so
- name: Upload artifact (release)
uses: actions/upload-artifact@master
if: |
(matrix.job == 'build' && matrix.profile == 'release') &&
((github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')))
with:
name: release
path: |
target/${{matrix.profile}}/webtransport.dll
target/${{matrix.profile}}/libwebtransport.so
target/${{matrix.profile}}/libwebtransport_aarch64.so
target/${{matrix.profile}}/libwebtransport.dylib
- name: Upload artifact (debug)
uses: actions/upload-artifact@master
if: |
matrix.job == 'build' && matrix.profile == 'debug' && !startsWith(github.ref, 'refs/tags/')
with:
name: debug
path: |
target/${{matrix.profile}}/webtransport.dll
target/${{matrix.profile}}/libwebtransport.so
target/${{matrix.profile}}/libwebtransport_aarch64.so
target/${{matrix.profile}}/libwebtransport.dylib
- name: Upload release to GitHub
uses: softprops/action-gh-release@59c3b4891632ff9a897f99a91d7bc557467a3a22
if: |
(matrix.job == 'build' && matrix.profile == 'release') &&
github.repository == 'hironichu/webtransport' &&
github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/${{matrix.profile}}/webtransport.dll
target/${{matrix.profile}}/libwebtransport.so
target/${{matrix.profile}}/libwebtransport_aarch64.so
target/${{matrix.profile}}/libwebtransport.dylib
draft: true
test:
needs: build
if: |
github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'hironichu:')
strategy:
matrix:
os: ['ubuntu-latest', 'self-hosted', "macos-latest", "windows-latest"]
job: [test]
profile: [debug, release]
name: ${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5

steps:
- uses: actions/checkout@master
- name: Creating target structure
run: |
mkdir -p target
- name: Download artifact
uses: actions/download-artifact@master
with:
path: target

- name: Display structure of downloaded files
run: ls -R
- name: Install Deno from .land
if: matrix.os != 'self-hosted'
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install Deno from source
if: matrix.os == 'self-hosted'
run: |
echo "Check if Deno is already installed"
if ! type deno > /dev/null; then
echo "Deno is not installed, installing..."
curl -s https://gist.githubusercontent.com/LukeChannings/09d53f5c364391042186518c8598b85e/raw/ac8cd8c675b985edd4b3e16df63ffef14d1f0e24/deno_install.sh | sh
else
echo "Deno is already installed"
fi
- name: Run deno test (debug)
if: |
matrix.job == 'test' && matrix.profile == 'debug' && !startsWith(github.ref, 'refs/tags/')
env:
BUILD_TARGET: debug
CI_BUILD: true
run: |
deno task test
- name: Run deno test (release)
if: |
(matrix.job == 'test' && matrix.profile == 'release') &&
((github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')))
env:
BUILD_TARGET: release
CI_BUILD: true
run: |
deno task test
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# will have compiled files and executables
debug/
target/

certs/
dist/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

*.lock
# These are backup files generated by rustfmt
**/*.rs.bk

Expand All @@ -18,3 +19,9 @@ Cargo.lock

/target
/Cargo.lock


.env
*.env

.VSCodeCounter/
38 changes: 38 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"request": "launch",
"name": "server-uni-recv",
"type": "node",
"program": "${workspaceFolder}/examples/deno/wt_server_uni_recv.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "C:\\Users\\zenze\\.deno\\bin\\deno.EXE",
"runtimeArgs": [
"run",
"--unstable",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
},
{
"request": "launch",
"name": "client-uni-send",
"type": "node",
"program": "${workspaceFolder}/examples/deno/wt_client_uni_send.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "C:\\Users\\zenze\\.deno\\bin\\deno.EXE",
"runtimeArgs": [
"run",
"--unstable",
"--inspect-wait",
"--allow-all"
],
"attachSimplePort": 9229
}
]
}
12 changes: 8 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true
}
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"editor.formatOnSave": true,
"rust-analyzer.linkedProjects": [
".\\Cargo.toml"
]
}
55 changes: 45 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
[package]
name = "FTL-2"
name = "Webtransport"
description = "Deno WebTransport FFI library for Deno"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "ftlt"
name = "webtransport"
crate-type = ["cdylib"]
test = false
bench = false

[profile.release]
strip = true
opt-level = 3
debug = false
debug-assertions = false
overflow-checks = true
lto = "fat"
panic = "unwind"
incremental = false
codegen-units = 16
rpath = false

[profile.dev]
opt-level = 0
lto = false
debug = true
debug-assertions = true
overflow-checks = true
panic = "abort"
incremental = true
codegen-units = 1

[dependencies]
flume = "0.11.0"
futures-util = "0.3.28"
num_cpus = "1.16.0"
once_cell = "1.18.0"
smol = "1.3.0"
tokio = { version = "1.28.1", features = ["rt", "rt-multi-thread", "macros"] }
wtransport = "0.1.4"
serde = { version = "1", features = ["derive"] }
once_cell = "=1.18.0"
tokio = { version = "=1.32.0", default-features = false, features = [
"rt",
"rt-multi-thread",
"macros",
] }
# wtransport = "0.1.4" # TODO: Replace this once the fix for arm is merged.
wtransport = { git = "https://github.com/hironichu/wtransport", branch = "master", features = [
"dangerous-configuration",
"quinn",
] }
wtransport-proto = { git = "https://github.com/hironichu/wtransport", branch = "master" }
rcgen = "=0.11.2"
ring = "=0.16.20"
time = "=0.3.29"
anyhow = "=1.0.75"
serde = { version = "=1.0", features = ["derive"] }
serde_json = "1.0.107"
Loading

0 comments on commit 6b5ed6a

Please sign in to comment.