Skip to content

Commit

Permalink
Merge pull request #114 from evan-buss/development
Browse files Browse the repository at this point in the history
release: v4.5.0
  • Loading branch information
evan-buss authored Jan 8, 2023
2 parents 91bb21a + 2c5e202 commit 045410c
Show file tree
Hide file tree
Showing 36 changed files with 636 additions and 155 deletions.
12 changes: 0 additions & 12 deletions .devcontainer/Dockerfile

This file was deleted.

53 changes: 14 additions & 39 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/ubuntu
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "jammy"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": false,
"transform": "snakecase",
"template": ""
},
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go"
},
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"eamodio.gitlens",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"GitHub.copilot"
],
"image": "mcr.microsoft.com/devcontainers/base:0-jammy",

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"postCreateCommand": "bash .devcontainer/setup.sh",

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root",
"features": {
"docker-in-docker": "latest",
"git": "latest",
"sshd": "latest",
"node": "lts",
"golang": "latest"
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},
"customizations": {
"vscode": {
"extensions": ["golang.go", "heybourn.headwind", "esbenp.prettier-vscode", "bradlc.vscode-tailwindcss", "ms-vscode.makefile-tools", "redhat.vscode-yaml"]
}
}
}
9 changes: 9 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

go install github.com/go-task/task/v3/cmd/task@latest

sudo apt update
sudo apt install -y python3.10-venv

# Mkdocs Social Cards Native Dependencies
sudo apt install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
28 changes: 23 additions & 5 deletions .github/workflows/docker_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ on:
branches:
- master
- development
paths-ignore:
- "docs/**"
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
Expand All @@ -20,6 +22,14 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set Docker Platforms For Branch
run: |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
echo "DOCKER_PLATFORMS=linux/amd64,linux/arm64,linux/arm" >> "$GITHUB_ENV"
else
echo "DOCKER_PLATFORMS=linux/amd64" >> "$GITHUB_ENV"
fi
- name: Set Docker Metadata
id: meta
Expand All @@ -28,6 +38,7 @@ jobs:
# list of Docker images to use as base name for tags
images: |
evanbuss/openbooks
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
# 'latest' when push to master with tag
# 'edge' when push to development
Expand All @@ -37,7 +48,7 @@ jobs:
tags: |
type=semver,pattern={{version}}
type=edge,branch=development
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand All @@ -51,14 +62,21 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm
platforms: ${{ env.DOCKER_PLATFORMS }}
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
workflow_dispatch:
# Runs on pushes targeting the default branch
push:
paths:
- "docs/**"

defaults:
run:
shell: bash
working-directory: docs

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build MkDocs Site
run: |
pip install -r requirements.txt
mkdocs build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "docs/site/"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "^1.17.0"
go-version: "^1.19.2"
- run: go version

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- name: Install Task
uses: arduino/setup-task@v1

- name: Build
run: ./build.sh
run: task release:build

- name: Create Release
uses: softprops/action-gh-release@v1
Expand All @@ -38,4 +41,4 @@ jobs:
fail_on_unmatched_files: true
name: Release ${{ github.ref }}
files: |
./build/*
./build/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ openbooks
!openbooks/
*.DS_Store
**/dist
.task/
docs/venv/
docs/site/
# end persist


Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yaml.schemas": {
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
}
}
58 changes: 58 additions & 0 deletions Taskfile.Development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://taskfile.dev

version: "3"

tasks:
go-update:
desc: Update Golang dependencies.
cmds:
- go get -u ./..
- go mod tidy

npm-update:
desc: Update Node.JS client side dependencies.
dir: server/app
cmds:
- npx npm-check-updates -i
interactive: true

npm-install:
desc: Install Node.JS client side dependencies.
dir: server/app
cmds:
- npm install
sources:
- package.json
- package-lock.json

mock:
desc: Start Mock Server for Development
dir: cmd/mock_server
cmds:
- go run .

cli:
desc: Run OpenBooks in CLI Mode.
dir: cmd/openbooks
cmds:
- go build
- ./openbooks cli --tls=false --server localhost:6667

server:
desc: Run OpenBooks in Server Mode.
dir: cmd/openbooks
cmds:
- go build
- ./openbooks server --tls=false --server localhost:6667

client:
desc: Run OpenBooks React Client Application in Development Mode.
dir: server/app
cmds:
- npm run dev

desktop:
desc: Run OpenBooks in the experimental desktop mode with a WebView GUI.
dir: cmd/openbooks
cmds:
- go run -tags webview
15 changes: 15 additions & 0 deletions Taskfile.Documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://taskfile.dev

version: "3"

tasks:
init:
dir: docs
cmds:
- python3 -m venv venv
- venv/bin/python3 -m pip install -r requirements.txt

serve:
dir: docs
cmds:
- venv/bin/mkdocs serve
30 changes: 30 additions & 0 deletions Taskfile.Release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://taskfile.dev

version: "3"

tasks:
npm-build:
internal: true
dir: server/app
cmds:
- npm ci
- npm run build

build:
desc: Build OpenBooks binaries for all supported platforms.
deps:
- npm-build
dir: cmd/openbooks
cmds:
- go get
- env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./../../build/openbooks.exe
- env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./../../build/openbooks_mac
- env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./../../build/openbooks_mac_arm
- env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./../../build/openbooks_linux
- env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ./../../build/openbooks_linux_arm

build-desktop:
desc: Build OpenBooks in the experimental desktop mode with a WebView GUI.
dir: cmd/openbooks
cmds:
- go build -tags webviews
8 changes: 8 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://taskfile.dev

version: "3"

includes:
dev: Taskfile.Development.yaml
docs: Taskfile.Documentation.yaml
release: Taskfile.Release.yaml
3 changes: 1 addition & 2 deletions cmd/openbooks/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"errors"
"fmt"
"log"
"os"
"strings"
Expand Down Expand Up @@ -31,7 +30,7 @@ var cliCmd = &cobra.Command{
Use: "cli",
Short: "Run openbooks from the terminal in interactive CLI mode.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
cliConfig.Version = fmt.Sprintf("OpenBooks CLI %s", ircVersion)
cliConfig.Version = globalFlags.UserAgent
cliConfig.UserName = globalFlags.UserName
cliConfig.Server = globalFlags.Server
cliConfig.Log = globalFlags.Log
Expand Down
Loading

0 comments on commit 045410c

Please sign in to comment.