Skip to content

Commit

Permalink
feat!: port to Go
Browse files Browse the repository at this point in the history
Change `-d`/`--dump` to append to the file like `-o`/`--output`.

v0.7.0
  • Loading branch information
dbohdan committed Nov 23, 2024
1 parent 496f6a7 commit 3fb2b28
Show file tree
Hide file tree
Showing 22 changed files with 1,303 additions and 1,169 deletions.
82 changes: 65 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,72 @@
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
bsd:
runs-on: ${{ matrix.os.host }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
os:
- name: freebsd
architecture: x86-64
version: '14.1'
host: ubuntu-latest

- name: openbsd
architecture: x86-64
version: '7.5'
host: ubuntu-latest
steps:
- name: 'Disable `autocrlf` in Git'
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Checkout
uses: actions/checkout@v4

- name: Run CI script on ${{ matrix.os.name }}
uses: cross-platform-actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install poetry tox
- name: Test with tox
run: |
tox run
operating_system: ${{ matrix.os.name }}
architecture: ${{ matrix.os.architecture }}
version: ${{ matrix.os.version }}
shell: bash
run: |
sudo .github/workflows/install-deps.sh
make test
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo .github/workflows/install-deps.sh
- name: Test
run: |
make test
mac:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
.github/workflows/install-deps.sh
- name: Build and test
run: |
make test
windows:
runs-on: windows-latest
steps:
- name: 'Disable `autocrlf` in Git'
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Test
run: |
.\test.ps1
27 changes: 27 additions & 0 deletions .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/sh
set -e

if [ "$(uname)" = Darwin ]; then
brew install go
fi

if [ "$(uname)" = Linux ]; then
:
fi

if [ "$(uname)" = FreeBSD ]; then
pkg install -y go
fi

if [ "$(uname)" = NetBSD ]; then
pkgin -y install go

for bin in /usr/pkg/bin/go1*; do
src=$bin
done
ln -s "$src" /usr/pkg/bin/go
fi

if [ "$(uname)" = OpenBSD ]; then
pkg_add -I go
fi
19 changes: 0 additions & 19 deletions .github/workflows/lint-and-type.yml

This file was deleted.

13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/*.build
/*.dist
/attic/
/dist/

*.bak
*.exe
*.log
__pycache__
*.swp
/.tox

/help
/memsparkline
/test/sleep
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
TEST_BINARIES := test/sleep

.PHONY: all
all: memsparkline

.PHONY: clean
clean:
-rm memsparkline $(TEST_BINARIES)

memsparkline: main.go
CGO_ENABLED=0 go build

.PHONY: release
release:
go run script/release.go

.PHONY: test
test: memsparkline $(TEST_BINARIES)
go test

test/sleep: test/sleep.go
go build -o $@ test/sleep.go
Loading

0 comments on commit 3fb2b28

Please sign in to comment.