devops: Refactor CI to use ctl.sh
Also updates our goreleaser setup to work again
This commit is contained in:
parent
aaea254f0d
commit
6ccf2afd07
|
@ -1,25 +0,0 @@
|
|||
name: Build browsh
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
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: Pre-build
|
||||
run: ./interfacer/contrib/build_browsh.sh
|
||||
- name: Build
|
||||
working-directory: ./interfacer
|
||||
run: go build ./cmd/browsh
|
||||
- name: Test
|
||||
run: ./interfacer/browsh --version
|
||||
|
|
@ -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
|
|
@ -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 }}
|
||||
|
@ -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)
|
||||
|
@ -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
|
|
@ -1,30 +0,0 @@
|
|||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
name: Release Browsh
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: ["386", amd64, arm64]
|
||||
exclude:
|
||||
- goarch: "386"
|
||||
goos: darwin
|
||||
- goarch: arm64
|
||||
goos: windows
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: wangyoucao577/go-release-action@v1.29
|
||||
with:
|
||||
pre_command: "./interfacer/contrib/build_browsh.sh"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: 1.18
|
||||
project_path: "./interfacer/cmd/browsh"
|
||||
binary_name: "browsh"
|
||||
extra_files: LICENSE README.md
|
47
.travis.yml
47
.travis.yml
|
@ -1,47 +0,0 @@
|
|||
if: tag IS blank
|
||||
language: go
|
||||
go:
|
||||
- 1.13.x
|
||||
|
||||
addons:
|
||||
# Use the full version number with ".0" if needed. This value is scraped by setup scripts.
|
||||
firefox: "67.0.1"
|
||||
apt:
|
||||
packages:
|
||||
- rpm
|
||||
- bsdtar
|
||||
- upx-ucl
|
||||
|
||||
env:
|
||||
global:
|
||||
- REPO_ROOT=$GOPATH/src/browsh
|
||||
- MDN_USER="user:13243312:78"
|
||||
# MDN_TOKEN
|
||||
- secure: "sKZ1/oBLKNWA0v16d4Yg8V500zIwZwEUpcnW7SMRpeqJMbzlR7GKLpJ/VX6ZAYexokBEEbU+JnI3/aHOmJaO9h2/+b1qwrQqje6totC6/rPhxkdxGxI9jETzPdL0V0XErK4rK2URATEANRnJUFLVuFGaXh6dUZDrbtn8NxDSfZEQGmHlqex5T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xwvldlS+n7HUhQ7c4B9c61KS19i+z5SxBiXjilL+zGlAVVgRcalIoKQrTRDSRKnKZkR5Ant0CLjt44pncHLwlYXD/aPuLNihCa4AqUlpYPYru0pQawXNkVnk6E/cg2DAsp7oDcpcg540="
|
||||
|
||||
before_install:
|
||||
- ./interfacer/contrib/setup_dep.sh
|
||||
- ./webext/contrib/setup_node.sh
|
||||
- mkdir -p $REPO_ROOT && cp -rfp $TRAVIS_BUILD_DIR -T $REPO_ROOT
|
||||
install:
|
||||
- cd $REPO_ROOT/interfacer && dep ensure
|
||||
- cd $REPO_ROOT/webext
|
||||
- source ~/.nvm/nvm.sh
|
||||
- npm run get-gobindata
|
||||
- npm install
|
||||
- npm run build
|
||||
- diff -u <(echo -n) <(gofmt -d ./)
|
||||
- ./node_modules/.bin/prettier --list-different "{src,test}/**/*.js"
|
||||
script:
|
||||
- cd $REPO_ROOT/webext && npm test
|
||||
- cd $REPO_ROOT/interfacer && go test $(find src/browsh -name *.go | grep -v windows)
|
||||
- cd $REPO_ROOT/interfacer && go test test/tty/*.go -v -ginkgo.slowSpecThreshold=30 -ginkgo.flakeAttempts=3
|
||||
- cd $REPO_ROOT/interfacer && go test test/http-server/*.go -v -ginkgo.slowSpecThreshold=30 -ginkgo.flakeAttempts=3
|
||||
after_failure:
|
||||
- cat $REPO_ROOT/interfacer/test/tty/debug.log
|
||||
- cat $REPO_ROOT/interfacer/test/http-server/debug.log
|
||||
after_success:
|
||||
- $REPO_ROOT/contrib/release_if_new_version.sh
|
||||
|
|
@ -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 <tom@tombh.co.uk>
|
||||
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: ci@github.com
|
||||
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
|
|
@ -1,65 +0,0 @@
|
|||
project_name: browsh
|
||||
builds:
|
||||
- main: .
|
||||
binary: browsh
|
||||
goos:
|
||||
- windows
|
||||
- darwin
|
||||
- linux
|
||||
- freebsd
|
||||
- openbsd
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 6
|
||||
- 7
|
||||
ldflags: -s -w
|
||||
|
||||
archive:
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: binary
|
||||
- goos: linux
|
||||
format: binary
|
||||
- goos: freebsd
|
||||
format: binary
|
||||
- goos: openbsd
|
||||
format: binary
|
||||
|
||||
nfpm:
|
||||
vendor: Browsh
|
||||
homepage: https://www.brow.sh
|
||||
maintainer: Thomas Buckley-Houston <tom@tombh.co.uk>
|
||||
description: The modern, text-based browser
|
||||
license: GPL v3
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
|
||||
dependencies:
|
||||
- firefox
|
||||
overrides:
|
||||
deb:
|
||||
dependencies:
|
||||
- 'firefox | firefox-esr'
|
||||
|
||||
brew:
|
||||
name: browsh
|
||||
|
||||
# Repository to push the tap to.
|
||||
github:
|
||||
owner: browsh-org
|
||||
name: homebrew-browsh
|
||||
|
||||
commit_author:
|
||||
name: Goreleaser Bot care of Travis CI
|
||||
email: builds@travis-ci.com
|
||||
|
||||
homepage: "https://www.brow.sh"
|
||||
|
||||
description: "The modern, text-based browser"
|
||||
|
||||
caveats: "You need Firefox 57 or newer to run Browsh"
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package browsh
|
||||
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export WEBEXTENSION_GO=$PROJECT_ROOT/interfacer/src/browsh/webextension.go
|
||||
export GOBINDATA_VERSION=3.23.0
|
||||
|
||||
# Convert the web extension into binary data that can be compiled into a
|
||||
# cross-platform Go binary.
|
||||
function xpi_to_bin() {
|
||||
local xpi_file=$1
|
||||
local bin_file=$2
|
||||
|
||||
if ! command -v go-bindata &>/dev/null; then
|
||||
echo "Installing \`go-bindata'..."
|
||||
go install github.com/kevinburke/go-bindata/go-bindata@v"$GOBINDATA_VERSION"
|
||||
go-bindata -version
|
||||
fi
|
||||
|
||||
go-bindata \
|
||||
-nocompress \
|
||||
-prefix "$PROJECT_ROOT/interfacer" \
|
||||
-pkg browsh \
|
||||
-o "$bin_file" \
|
||||
"$xpi_file"
|
||||
|
||||
ls -alh "$WEBEXTENSION_GO"
|
||||
}
|
||||
|
||||
function build_webextension() {
|
||||
local NODE_BIN=$PROJECT_ROOT/webext/node_modules/.bin
|
||||
|
||||
|
@ -38,17 +13,16 @@ function build_webextension() {
|
|||
"$NODE_BIN"/web-ext build --overwrite-dest
|
||||
ls -alh web-ext-artifacts
|
||||
|
||||
version=$("$PROJECT_ROOT"/ctl.sh browsh_version)
|
||||
version=$(browsh_version)
|
||||
|
||||
local xpi_file=browsh-$version-an+fx.xpi
|
||||
local zip_file=browsh-$version.zip
|
||||
local source_file
|
||||
local source_dir=$PROJECT_ROOT/webext/dist/web-ext-artifacts
|
||||
local bundle_file=$PROJECT_ROOT/interfacer/src/browsh/browsh.xpi
|
||||
|
||||
if [ "$BROWSH_ENV" == "RELEASE" ]; then
|
||||
# The signed version. There can only be one canonical XPI for each semantic
|
||||
# version.
|
||||
source_file=$source_dir/$xpi_file
|
||||
bundle_file=$PROJECT_ROOT/interfacer/browsh.xpi
|
||||
source_file="$source_dir/browsh-$version-an+fx.xpi"
|
||||
"$NODE_BIN"/web-ext sign --api-key "$MDN_USER" --api-secret "$MDN_KEY"
|
||||
else
|
||||
# TODO: This doesn't currently work with the Marionettte `tempAddon`
|
||||
|
@ -58,13 +32,11 @@ function build_webextension() {
|
|||
# by `Asset()` in `main.go`.
|
||||
# In development/testing, we want to be able to bundle the webextension
|
||||
# frequently without having to resort to version bumps.
|
||||
source_file=$source_dir/$zip_file
|
||||
bundle_file=$source_dir/browsh.zip
|
||||
source_file="$source_dir/browsh-$version.zip"
|
||||
fi
|
||||
|
||||
echo "Bundling $source_file to $bundle_file"
|
||||
cp -f "$source_file" "$bundle_file"
|
||||
echo "Bundling $source_file to $WEBEXTENSION_GO using internal path $bundle_file"
|
||||
xpi2bin "$bundle_file" "$WEBEXTENSION_GO"
|
||||
}
|
||||
|
||||
function bundle_production_webextension() {
|
||||
|
@ -73,6 +45,4 @@ function bundle_production_webextension() {
|
|||
local release_url="$base/v$version/browsh-$version-an.fx.xpi"
|
||||
local xpi_file=$PROJECT_ROOT/interfacer/src/browsh/browsh.xpi
|
||||
curl -L -o "$xpi_file" "$release_url"
|
||||
|
||||
xpi2bin "$xpi_file" "$WEBEXTENSION_GO"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"scripts": {
|
||||
"build_webextension": "../ctl.sh build_webextension",
|
||||
"lint": "prettier --list-different "{src,test}/**/*.js",
|
||||
"lint": "prettier --list-different '{src,test}/**/*.js'",
|
||||
"test": "NODE_PATH=src:test mocha"
|
||||
},
|
||||
"babel": {
|
||||
|
|
Loading…
Reference in New Issue