Skip to content

Commit

Permalink
devel-release and release via github actions (#297)
Browse files Browse the repository at this point in the history
* devel-release and release via github actions

* junk paths during packaging

* 1.17.6

* diff naming

* clean up tests

* cleanup consolidated test

* store pointer to AppPool

* remove test that was erroneously trying to boot puma under the hood
  • Loading branch information
nonrational authored Feb 1, 2022
1 parent ff4e254 commit 3643bbb
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 94 deletions.
42 changes: 37 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, macos-11.0, ubuntu-latest]
go-version: [1.17.2]
ruby-version: [3.1]
go-version: [1.17.6]

name: ${{ matrix.os }} / go-${{ matrix.go-version }}
steps:
Expand All @@ -19,12 +18,12 @@ jobs:

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

- uses: actions/checkout@v2
ruby-version: 3

- run: gem install puma

- uses: actions/checkout@v2

- if: contains(matrix.os, 'macos')
run: |
sw_vers
Expand All @@ -35,3 +34,36 @@ jobs:
- run: go mod download

- run: go test -v -race -coverprofile=coverage.out -covermode=atomic -timeout=300s ./...

devel-release:
runs-on: macos-latest
needs: test

steps:
- uses: actions/setup-go@v1
with:
go-version: 1.17.6

- run: go install github.com/mitchellh/[email protected]
- run: echo $(go env GOPATH)/bin >> $GITHUB_PATH

- uses: actions/checkout@v2

- run: make release
env:
RELEASE: ${{ env.GITHUB_SHA }}

- uses: actions/upload-artifact@v2
with:
name: puma-dev-${{ env.GITHUB_RUN_NUMBER }}-linux-amd64
path: rel/linux_amd64/puma-dev

- uses: actions/upload-artifact@v2
with:
name: puma-dev-${{ env.GITHUB_RUN_NUMBER }}-darwin-amd64
path: rel/darwin_amd64/puma-dev

- uses: actions/upload-artifact@v2
with:
name: puma-dev-${{ env.GITHUB_RUN_NUMBER }}-darwin-arm64
path: rel/darwin_arm64/puma-dev
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: macos-latest

steps:
- uses: actions/setup-go@v1
with:
go-version: 1.17.6

- run: go install github.com/mitchellh/[email protected]
- run: echo $(go env GOPATH)/bin >> $GITHUB_PATH

- name: get release version
id: get_version
run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/tags/v}

- uses: actions/checkout@v2

- run: make release
env:
RELEASE: ${{ steps.get_version.outputs.RELEASE_VERSION }}

- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "pkg/*"
allowUpdates: true
omitBody: true
prerelease: true
removeArtifacts: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/bin/
/pkg/
/rel/
/vendor/pkg/
/tmp
/coverage*.out
Expand Down
28 changes: 16 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,28 @@ install:
lint:
golangci-lint run


release:
rm -rf ./rel
mkdir ./rel

rm -rf ./pkg
mkdir -p ./pkg
mkdir ./pkg

SDKROOT=$$(xcrun --sdk macosx --show-sdk-path) gox -cgo -os="darwin" -arch="amd64 arm64" -ldflags "-X main.Version=$$RELEASE" ./cmd/puma-dev
gox -os="linux" -arch="amd64" -ldflags "-X main.Version=$$RELEASE" ./cmd/puma-dev

# linux
for arch in amd64; do \
mv -v "puma-dev_linux_$$arch" puma-dev; \
tar czvf "pkg/puma-dev-$$RELEASE-linux-$$arch.tar.gz" puma-dev; \
done

# macOS
for arch in amd64 arm64; do \
mv -v "puma-dev_darwin_$$arch" puma-dev; \
zip -v "pkg/puma-dev-$$RELEASE-darwin-$$arch.zip" puma-dev; \
done
mkdir rel/linux_amd64
mv -v puma-dev_linux_amd64 rel/linux_amd64/puma-dev
tar -C rel/linux_amd64 -cvzf "pkg/puma-dev-$$RELEASE-linux-amd64.tar.gz" puma-dev

mkdir rel/darwin_amd64
mv -v puma-dev_darwin_amd64 rel/darwin_amd64/puma-dev
zip -j -v "pkg/puma-dev-$$RELEASE-darwin-amd64.zip" rel/darwin_amd64/puma-dev

mkdir rel/darwin_arm64
mv -v puma-dev_darwin_arm64 rel/darwin_arm64/puma-dev
zip -j -v "pkg/puma-dev-$$RELEASE-darwin-arm64.zip" rel/darwin_arm64/puma-dev

test: clean-test
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
Expand Down
1 change: 1 addition & 0 deletions dev/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ func (a *AppPool) maybeIdle(app *App) bool {

var ErrUnknownApp = errors.New("unknown app")

// Find an app by domain name. If the app is not running, launch it.
func (a *AppPool) lookupApp(name string) (*App, error) {
a.lock.Lock()
defer a.lock.Unlock()
Expand Down
77 changes: 0 additions & 77 deletions dev/app_test.go

This file was deleted.

0 comments on commit 3643bbb

Please sign in to comment.