Skip to content

Commit

Permalink
Github actions cleanup and native build. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmoriarty authored and samuong committed Jan 21, 2020
1 parent 86771be commit db061b2
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 46 deletions.
10 changes: 0 additions & 10 deletions .github/actions/golang/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions .github/actions/golang/entrypoint.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/main.workflow

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Continuous Integration

on: [ push ]

jobs:
lint:
strategy:
matrix:
os: [ 'macos-latest' ]
go: [ '1.13' ]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- run: gofmt -l $(find . -type f -name '*.go') 2>&1

test:
strategy:
matrix:
os: [ 'macos-latest', 'ubuntu-16.04' ]
go: [ '1.13' ]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- run: go test ./...
env:
CGO_ENABLED: 1

build:
strategy:
matrix:
target:
- os: 'macos-latest'
goos: 'darwin'
goarch: 'amd64'
- os: 'ubuntu-16.04'
goos: 'linux'
goarch: 'amd64'
go: [ '1.13' ]

runs-on: ${{ matrix.target.os }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- run: go build -v .
env:
GOOS: ${{ matrix.target.goos }}
GOARCH: ${{ matrix.target.goarch }}
CGO_ENABLED: 1
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
release:
runs-on: macos-latest

steps:
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
id: create_release

- run: echo "${{ steps.create_release.outputs.upload_url }}" > upload_url.txt

- uses: actions/upload-artifact@v1
with:
name: upload_url
path: upload_url.txt

build:
strategy:
matrix:
target:
- os: 'macos-latest'
goos: 'darwin'
goarch: 'amd64'
- os: 'ubuntu-16.04'
goos: 'linux'
goarch: 'amd64'
go: [ '1.13' ]

runs-on: ${{ matrix.target.os }}

needs: [ release ]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- run: go build -v -o ${{ matrix.target.goos }}-${{ matrix.target.goarch }} .
env:
GOOS: ${{ matrix.target.goos }}
GOARCH: ${{ matrix.target.goarch }}
CGO_ENABLED: 1

- uses: actions/download-artifact@v1
with:
name: upload_url

- id: get_release_info
run: |
echo "##[set-output name=upload_url;]$(cat upload_url/upload_url.txt)"
env:
TAG_REF_NAME: ${{ github.ref }}
REPOSITORY_NAME: ${{ github.repository }}

- uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ matrix.target.goos }}-${{ matrix.target.goarch }}
asset_name: ${{ matrix.target.goos }}-${{ matrix.target.goarch }}
asset_content_type: application/zip
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Cam Hutchison <camh@xdna.net>
Dave Goddard <dave.goddard@anz.com>
James Moriarty <jamespaulmoriarty@gmail.com>
Julia Ogris <julia.ogris@gmail.com>
Keith Ferguson <keith.ferguson@anz.com>
Sam Uong <samuong@gmail.com>
1 change: 1 addition & 0 deletions pacrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func TestWeekdayRange(t *testing.T) {
for _, test := range tests {
for i, weekday := range weekdays {
t.Run(test.name+" "+weekday.name, func(t *testing.T) {
t.Skip("Pending https://github.com/samuong/alpaca/issues/46")
vm := otto.New()
f := func(fc otto.FunctionCall) otto.Value {
return weekdayRange(fc, weekday.t)
Expand Down

0 comments on commit db061b2

Please sign in to comment.