Skip to content

Commit

Permalink
Merge pull request #32 from skx/31-github-actions
Browse files Browse the repository at this point in the history
31 GitHub actions
  • Loading branch information
skx committed Aug 24, 2019
2 parents 82cd69f + 976b25b commit a9cb318
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 44 deletions.
38 changes: 0 additions & 38 deletions .github/main.workflow

This file was deleted.

16 changes: 15 additions & 1 deletion .github/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/bin/sh

# Install the lint-tool, and the shadow-tool

# 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.
t=$(mktemp)
staticcheck -checks all ./... | grep -v "a package comment" > $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
Expand Down
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: Test
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: Test
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
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: math-compiler-*
4 changes: 2 additions & 2 deletions compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *Compiler) tokenize() error {

// If error then abort.
if tok.Type == token.ERROR {
return (fmt.Errorf("Error parsing input; token.ERROR returned from the lexer: %s", tok.Literal))
return (fmt.Errorf("error parsing input; token.ERROR returned from the lexer: %s", tok.Literal))
}

//
Expand All @@ -159,7 +159,7 @@ func (c *Compiler) tokenize() error {
// If the program is empty that's an error.
//
if len(c.tokens) < 1 {
return (fmt.Errorf("The input expression was empty"))
return (fmt.Errorf("the input expression was empty"))
}

//
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {
//
// If we're running we're also compiling
//
if *run == true {
if *run {
*compile = true
}

Expand Down Expand Up @@ -63,7 +63,7 @@ func main() {
// If we're not compiling the assembly language text which was
// produced then we just write the program to STDOUT, and terminate.
//
if *compile == false {
if !*compile {
fmt.Printf("%s", out)
return
}
Expand Down Expand Up @@ -95,7 +95,7 @@ func main() {
//
// Running the binary too?
//
if *run == true {
if *run {
exe := exec.Command(*program)
exe.Stdout = os.Stdout
exe.Stderr = os.Stderr
Expand Down

0 comments on commit a9cb318

Please sign in to comment.