Skip to content

Commit

Permalink
devops: Refactor CI to use ctl.sh
Browse files Browse the repository at this point in the history
Also updates our goreleaser setup to work again
  • Loading branch information
tombh committed Jul 16, 2022
1 parent aaea254 commit 6ccf2af
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 219 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint
on: [push]

jobs:
lint:
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- run: npm ci
working-directory: ./webext
- name: Is web extension 'pretty'?
run: npm run lint
working-directory: ./webext

- name: Is Golang interfacer formatted?
run: ./ctl.sh golang_lint_check
30 changes: 17 additions & 13 deletions .github/workflows/test.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Run tests
name: Test/Release
on: [push]

jobs:
build:
test_maybe_release:
name: Test (then release if new version)
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
Expand All @@ -19,30 +21,25 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install latest Firefox
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: 102.0.1 # TODO: Use same version in Dockerfile
- run: firefox --version

# Web extension tests
# TODO: can these all be shared in a single script?
- run: npm ci
working-directory: ./webext
- name: Web extension tests
run: npm test
working-directory: ./webext
- run: npm install
working-directory: ./webext
- run: npx webpack
- run: npm run build_webextension
working-directory: ./webext

# Interfacer tests
- name: Pre-build
run: ./interfacer/contrib/build_browsh.sh
- name: Build # TODO: should this be included in `build_browsh.sh`?
working-directory: ./interfacer
- name: Build
run: go build ./cmd/browsh
working-directory: ./interfacer

- name: Unit tests
run: go test -v $(find src/browsh -name '*.go' | grep -v windows)
Expand All @@ -52,11 +49,18 @@ jobs:
working-directory: ./interfacer
- name: TTY debug log
if: ${{ failure() }}
run: cat ./interfacer/test/tty/debug.log
run: cat ./interfacer/test/tty/debug.log || echo "No log file"
- name: HTTP Server tests
run: go test test/http-server/*.go -v -ginkgo.slowSpecThreshold=30 -ginkgo.flakeAttempts=3
working-directory: ./interfacer
- name: HTTP Server debug log
if: ${{ failure() }}
run: cat ./interfacer/test/http-server/debug.log
run: cat ./interfacer/test/http-server/debug.log || echo "No log file"

# Release
- name: Check for new version
id: check_versions
run: ./ctl.sh github_actions_output_version_status
- name: Release
if: contains(steps.check_versions.outputs.is_new_version, 'true')
run: ./ctl.sh release
30 changes: 0 additions & 30 deletions .github/workflows/release.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

71 changes: 71 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Run with `ctl.sh release` to get ENV vars

project_name: browsh
builds:
- binary: browsh
env:
- CGO_ENABLED=0
main: cmd/browsh/main.go
goos:
- windows
- darwin
- linux
- freebsd
- openbsd
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 6
- 7
ignore:
- goos: darwin
goarch: 386
- goarch: arm64
goos: windows
ldflags: -s -w

archives:
- format_overrides:
- goos: windows
format: binary
- goos: linux
format: binary
- goos: freebsd
format: binary
- goos: openbsd
format: binary

nfpms:
- vendor: Browsh
homepage: https://www.brow.sh
maintainer: Thomas Buckley-Houston <[email protected]>
description: The modern, text-based browser
license: GPL v3
formats:
- deb
- rpm
dependencies:
- firefox
overrides:
deb:
dependencies:
- 'firefox | firefox-esr'

brews:
- name: browsh
tap:
owner: browsh-org
name: homebrew-browsh
commit_author:
name: Goreleaser Bot care of Github Actions
email: [email protected]
homepage: "https://www.brow.sh"
description: "The modern, text-based browser"
caveats: "You need Firefox 57 or newer to run Browsh"

release:
extra_files:
- glob: ./webext/dist/web-ext-artifacts/browsh-{{ Env.BROWSH_VERSION }}-an+fx.xpi
65 changes: 0 additions & 65 deletions interfacer/src/.goreleaser.yml

This file was deleted.

1 change: 0 additions & 1 deletion interfacer/src/browsh/firefox_unix.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris

package browsh

Expand Down
1 change: 0 additions & 1 deletion interfacer/src/browsh/firefox_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package browsh

Expand Down
Loading

0 comments on commit 6ccf2af

Please sign in to comment.