Skip to content

Commit

Permalink
fix: website publish
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 committed Nov 15, 2024
1 parent a32aea0 commit 76086d9
Show file tree
Hide file tree
Showing 23 changed files with 11,330 additions and 8,912 deletions.
2 changes: 1 addition & 1 deletion .github/lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

LUA_VERSION="5.4.6"
LUA_VERSION="5.4.7"
# https://www.lua.org/ftp/#
pushd /tmp
curl -L -R -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz
Expand Down
11 changes: 5 additions & 6 deletions .github/odin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

set -euo pipefail

VERSION=dev-2024-01
FILE_NAME=odin-ubuntu-amd64-$VERSION.zip
VERSION=dev-2024-11
FILE_NAME=odin-linux-amd64-$VERSION.zip
sudo apt-get install -y aria2
mkdir /tmp/odin
mkdir /tmp/odin || true
cd /tmp/odin
aria2c -c -o $FILE_NAME https://github.com/odin-lang/Odin/releases/download/$VERSION/$FILE_NAME
if test -d ubuntu_artifacts; then sudo rm -rf ubuntu_artifacts; fi
unzip -o $FILE_NAME
if test -d ubuntu_artifacts; then ODIN_BIN_PATH=$PWD/ubuntu_artifacts/odin; else ODIN_BIN_PATH=$PWD/odin; fi
sudo chmod +x $ODIN_BIN_PATH
tar -xvf dist.tar.gz
ODIN_BIN_PATH=$(pwd)/$(find */odin)
sudo ln -sf $ODIN_BIN_PATH /usr/bin/odin
odin version
6 changes: 5 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,17 @@ jobs:
- name: Install
run: |
ls -al bench/build/_results/
- run: corepack enable && corepack prepare pnpm@9 --activate
- run: pnpm --version
- name: Site Update Content
run: |
pushd website
pnpm i
pnpm content
pnpm build
pnpm archive-dist
- name: Site Publish
if: github.ref == 'refs/heads/main'
env:
VERCEL_PUBLISH_TOKEN: ${{ secrets.VERCEL_PUBLISH_TOKEN }}
run: vercel website --prod --confirm -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'
run: vercel website --prod --yes -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'
2 changes: 2 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ jobs:
- uses: pnpm/action-setup@v2
with:
version: 8
- run: corepack enable && corepack prepare pnpm@9 --activate
- run: pnpm --version
- run: vercel --version
- name: Build
run: |
cd website
pnpm i
pnpm build
pnpm archive-dist
92 changes: 46 additions & 46 deletions bench/algorithm/binarytrees/1.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@
package main

import "core:fmt"
import "core:strconv"
import "core:os"
import "core:math"
import "core:mem"
import "core:os"
import "core:strconv"

MIN_DEPTH :: 4
main :: proc() {
n := strconv.parse_int(os.args[1]) or_else 10
max_depth := math.max(MIN_DEPTH+2,n)
{
stretch_depth := max_depth + 1
stretch_tree := makeTree(stretch_depth)
defer { delete_tree(stretch_tree) }
fmt.printf("stretch tree of depth %d\t check: %d\n", stretch_depth, check(stretch_tree) );
}
long_lived_tree := makeTree(max_depth)
defer delete_tree(long_lived_tree)
depth:int= MIN_DEPTH;
for ;depth <= max_depth; depth += 2 {
iterations := 1 << u8(max_depth - depth + MIN_DEPTH)
sum: u64 = 0
for _ in 0..<iterations {
tree := makeTree(depth)
defer { delete_tree(tree) }
sum += u64(check(tree))
}
fmt.printf("%d\t trees of depth %d\t check: %d\n", iterations, depth, sum )
}
#no_bounds_check n := strconv.parse_int(os.args[1]) or_else 10
max_depth := math.max(MIN_DEPTH + 2, n)
{
stretch_depth := max_depth + 1
stretch_tree := makeTree(stretch_depth)
defer {delete_tree(stretch_tree)}
fmt.printf("stretch tree of depth %d\t check: %d\n", stretch_depth, check(stretch_tree))
}
long_lived_tree := makeTree(max_depth)
defer delete_tree(long_lived_tree)
depth: int = MIN_DEPTH
for ; depth <= max_depth; depth += 2 {
iterations := 1 << u8(max_depth - depth + MIN_DEPTH)
sum: u64 = 0
for _ in 0 ..< iterations {
tree := makeTree(depth)
defer {delete_tree(tree)}
sum += u64(check(tree))
}
fmt.printf("%d\t trees of depth %d\t check: %d\n", iterations, depth, sum)
}

fmt.printf("long lived tree of depth %d\t check: %d\n", max_depth, check(long_lived_tree))
fmt.printf("long lived tree of depth %d\t check: %d\n", max_depth, check(long_lived_tree))
}

Node :: struct {
left,right:^Node,
left, right: ^Node,
}

makeTree::proc(depth:int)->^Node {
node := new(Node)
if node == nil {
fmt.println("alloc error")
return node
}
if depth > 0 {
node.left = makeTree(depth-1)
node.right = makeTree(depth-1)
}
return node
makeTree :: proc(depth: int) -> ^Node {
node := new(Node)
if node == nil {
fmt.println("alloc error")
return node
}
if depth > 0 {
node.left = makeTree(depth - 1)
node.right = makeTree(depth - 1)
}
return node
}
delete_tree::proc(t:^Node){
if t.left != nil {delete_tree(t.left)}
if t.right != nil {delete_tree(t.right)}
free(t)
delete_tree :: proc(t: ^Node) {
if t.left != nil {delete_tree(t.left)}
if t.right != nil {delete_tree(t.right)}
free(t)
}
check::proc(tree:^Node)->int {
sum : int = 1
if tree == nil { return 0 }
sum += check(tree.left)
sum += check(tree.right)
return sum
check :: proc(tree: ^Node) -> int {
sum: int = 1
if tree == nil {return 0}
sum += check(tree.left)
sum += check(tree.right)
return sum
}
6 changes: 3 additions & 3 deletions bench/algorithm/helloworld/1.odin
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import "base:runtime"
import "core:fmt"
import "core:runtime"

main :: proc() {
args := runtime.args__
name := len(args) > 1 ? args[1] : ""
args := runtime.args__
name := len(args) > 1 ? args[1] : ""
fmt.printf("Hello world %s!\n", name)
}
Loading

0 comments on commit 76086d9

Please sign in to comment.