Skip to content

Commit

Permalink
Initial commit with only README and static files
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanwahab committed Sep 26, 2024
0 parents commit 71f4878
Show file tree
Hide file tree
Showing 1,526 changed files with 349,175 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/actions/auth_tailscale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Setup Tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
51 changes: 51 additions & 0 deletions .github/actions/deploy-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy blog to hydrogen
if: github.ref == 'refs/heads/main'
env:
MACHINE: hydrogen
steps:
- name: Setup Go 1.17
id: go
uses: actions/setup-go@v2
with:
go-version: "^1.17"
- name: Setup Tailscale
id: tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: 1.7.359
- name: Add SSH key
id: ssh
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
run: |
mkdir -p ~/.ssh
MACHINE_IP="$(tailscale ip -6 $MACHINE)"
ssh-keyscan $MACHINE_IP >> ~/.ssh/known_hosts
printf "%s" "$SSH_KEY" > ~/.ssh/key
chmod 600 ~/.ssh/key
- name: Fetch code
id: fetch
uses: actions/checkout@v1

- name: Compile blog binary
id: compile
run: go build -o prose .

- name: Build tarball and ship it
id: tarball
run: |
TIME=$(date +%Y%m%d-%H%M%S)
FILENAME=prose-${TIME}.tar.gz
mkdir -p static/css
tar -czf $FILENAME prose static/ styles/ templates/ posts/
MACHINE_IP="$(tailscale ip -6 $MACHINE)"
echo $FILENAME "github@[$MACHINE_IP]:/home/github/"
scp -i ~/.ssh/key $FILENAME "github@[$MACHINE_IP]:/home/github/"
ssh -i ~/.ssh/key "github@$MACHINE_IP" "tar -C /var/www/blog -xzf ~/$FILENAME"
ssh -i ~/.ssh/key "github@$MACHINE_IP" "sudo systemctl restart prose"
79 changes: 79 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
on: [push, pull_request]
name: Test
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]

target: [
aarch64-linux-gnu,
aarch64-linux-musl,
x86_64-linux-gnu,
x86_64-linux-musl,
aarch64-macos,
x86_64-macos,
wasm32-wasi

# Broken but not in any obvious way:
# x86-linux-gnu,
# x86-linux-musl,

# Not yet supported:
# i386-windows,
# x86_64-windows-gnu,
]
runs-on: ${{ matrix.os }}
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable

# Run our checks to catch quick issues
- run: nix flake check

# Run our go tests within the context of the dev shell from the flake. This
# will ensure we have all our dependencies.
- name: test
run: nix develop -c zig build -fsummary -Dtarget=${{ matrix.target }}

test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable

# Run our checks to catch quick issues
- run: nix flake check

# Run our go tests within the context of the dev shell from the flake. This
# will ensure we have all our dependencies.
- name: test
run: nix develop -c zig build test -fsummary
- name: test wasi
run: nix develop -c zig build test -Dtarget=wasm32-wasi -fwasmtime -fsummary

- name: build all benchmarks and examples
run: nix develop -c zig build -Dexample -Dbench -fsummary

# Run a full build to ensure that works
- run: nix build
33 changes: 33 additions & 0 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Nix Flake actions

on:
pull_request:
push:
branches:
- master
- main

jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- run: nix build -L ".#${{ matrix.attr }}"
Loading

0 comments on commit 71f4878

Please sign in to comment.