Skip to content

Commit

Permalink
Merge pull request #9 from skx/ci
Browse files Browse the repository at this point in the history
Ci
  • Loading branch information
skx committed Jun 15, 2020
2 parents a0cdc30 + a927893 commit b41e180
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: skx
custom: https://steve.fi/donate/
44 changes: 44 additions & 0 deletions .github/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# The basename of our binary
BASE="bfcc"

#
# We build on multiple platforms/archs
#
BUILD_PLATFORMS="linux darwin freebsd"
BUILD_ARCHS="amd64 386"

# For each platform
for OS in ${BUILD_PLATFORMS[@]}; do

# For each arch
for ARCH in ${BUILD_ARCHS[@]}; do

# Setup a suffix for the binary
SUFFIX="${OS}"

# i386 is better than 386
if [ "$ARCH" = "386" ]; then
SUFFIX="${SUFFIX}-i386"
else
SUFFIX="${SUFFIX}-${ARCH}"
fi

# Windows binaries should end in .EXE
if [ "$OS" = "windows" ]; then
SUFFIX="${SUFFIX}.exe"
fi

echo "Building for ${OS} [${ARCH}] -> ${BASE}-${SUFFIX}"

# Run the build
export GOARCH=${ARCH}
export GOOS=${OS}
export CGO_ENABLED=0

# Build the main-binary
go build -ldflags "-X main.version=$(git describe --tags 2>/dev/null || echo 'master')" -o "${BASE}-${SUFFIX}"

done
done
33 changes: 33 additions & 0 deletions .github/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Install tools to test our code-quality.
go get -u golang.org/x/lint/golint
go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
go get -u honnef.co/go/tools/cmd/staticcheck

# Run the static-check tool - we ignore errors in goserver/static.go
t=$(mktemp)
staticcheck -checks all ./... > $t
if [ -s $t ]; then
echo "Found errors via 'staticcheck'"
cat $t
rm $t
exit 1
fi
rm $t

# At this point failures cause aborts
set -e

# Run the linter
echo "Launching linter .."
golint -set_exit_status ./...
echo "Completed linter .."

# Run the shadow-checker
echo "Launching shadowed-variable check .."
go vet -vettool=$(which shadow) ./...
echo "Completed shadowed-variable check .."

# Run golang tests
go test ./...
10 changes: 10 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on: pull_request
name: Pull Request
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Test
uses: skx/github-action-tester@master
13 changes: 13 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
push:
branches:
- master
name: Push Event
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Test
uses: skx/github-action-tester@master
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on: release
name: Handle Release
jobs:
upload:
name: Upload release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Upload
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: bfcc*-*
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/skx/bfcc)](https://goreportcard.com/report/github.com/skx/bfcc)
[![license](https://img.shields.io/github/license/skx/bfcc.svg)](https://github.com/skx/bfcc/blob/master/LICENSE)
[![Release](https://img.shields.io/github/release/skx/bfcc.svg)](https://github.com/skx/bfcc/releases/latest)

Table of Contents
=================
Expand All @@ -12,16 +13,17 @@ Table of Contents
* [Test Programs](#test-programs)
* [Future Plans?](#future-plans)
* [Bug Reports?](#bug-reports)
* [Github Setup](#github-setup)



# BrainFuck Compiler Challenge

The aim of this repository was to contain a BrainFuck compiler, written in Golang, and completed in less than a day.
I challenged myself to write a BrainFuck compiler, in less than a day. This repository contains the result. I had an initial sprint of 3-4 hours, which lead to a working system, and then spent a little longer tidying and cleaning it up.

[Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) is an esoteric programming language created in 1993 by Urban Müller, and is notable for its extreme minimalism. It supports only a few instructions, and is practically unreadable.

That said brainfuck, despite the name, has a good history in the programming world as being something simple and well-defined to play with.
Brainfuck, despite the name, has a good history in the programming world as being something simple and fun to play with.



Expand Down Expand Up @@ -171,5 +173,18 @@ More backends might be nice, but I guess the two existing ones are the most obvi
Please [file an issue](https://github.com/skx/bfcc/issues)




# Github Setup

This repository is configured to run tests upon every commit, and when
pull-requests are created/updated. The testing is carried out via
[.github/run-tests.sh](.github/run-tests.sh) which is used by the
[github-action-tester](https://github.com/skx/github-action-tester) action.

Releases are automated in a similar fashion via [.github/build](.github/build),
and the [github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) action.


Steve
--

0 comments on commit b41e180

Please sign in to comment.