-
-
Notifications
You must be signed in to change notification settings - Fork 419
123 lines (118 loc) · 3.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Test-Release
on: [push, pull_request]
jobs:
tests:
name: "Tests (webextension, interfacer: unit, tty, http-server)"
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
outputs:
is_new_version: ${{ steps.check_versions.outputs.is_new_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'interfacer/go.mod'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: 102.0.1
- run: firefox --version
# Web extension tests
- run: npm ci
working-directory: ./webext
- name: Web extension tests
run: npm test
working-directory: ./webext
# Interfacer tests
- name: Interfacer tests setup
run: |
touch interfacer/src/browsh/browsh.xpi
cd webext
npm run build:dev
- name: Unit tests
run: go test -v $(find src/browsh -name '*.go' | grep -v windows)
working-directory: ./interfacer
- name: TTY tests
run: go test test/tty/*.go -v -ginkgo.slowSpecThreshold=30 -ginkgo.flakeAttempts=3
working-directory: ./interfacer
- name: TTY debug log
if: ${{ failure() }}
run: cat ./interfacer/test/tty/debug.log || echo "No log file"
- name: HTTP Server tests
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 15
command: |
cd interfacer
go test test/http-server/*.go -v -ginkgo.slowSpecThreshold=30 -ginkgo.flakeAttempts=3
- name: HTTP Server debug log
if: ${{ failure() }}
run: cat ./interfacer/test/http-server/debug.log || echo "No log file"
- name: Check for new version
id: check_versions
run: ./ctl.sh github_actions_output_version_status
release:
name: Release
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/master' && contains(needs.tests.outputs.is_new_version, 'true')
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
MDN_KEY: ${{ secrets.MDN_KEY }}
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup Deploy Keys
uses: webfactory/[email protected]
with:
# Note that these private keys depend on having an ssh-keygen'd comment with the
# Git remote URL. This is because Github Actions use the *first* matching private
# key and fails if it doesn't match. webfactory/ssh-agent
ssh-private-key: |
${{ secrets.HOMEBREW_DEPLOY_KEY }}
${{ secrets.WWW_DEPLOY_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Setup go
uses: actions/setup-go@v3
with:
go-version-file: 'interfacer/go.mod'
- run: npm ci
working-directory: ./webext
- name: Binary Release
run: ./ctl.sh release
- name: Push new tag
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: tombh
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Docker Release
run: ./ctl.sh docker_release
- name: Update Homebrew Tap
run: ./ctl.sh update_homebrew_tap_with_new_version
- name: Update Browsh Website
run: ./ctl.sh update_browsh_website_with_new_version