Skip to content

Commit

Permalink
Merge branch 'master' into feature/#617-dispatch-event
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Apr 6, 2023
2 parents 8c5bffc + 7f6c45f commit e75379e
Show file tree
Hide file tree
Showing 275 changed files with 1,715 additions and 814 deletions.
52 changes: 33 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,54 @@ name: build
on: [push, pull_request]

jobs:
analyze:
name: Static Analysis
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.19'

- name: Set up linters
run: make install-tools

- name: Lint
run: |
make vet
make lint
make fmt
git diff
if [[ $(git diff) != '' ]]; then echo 'Invalid formatting!' >&2; exit 1; fi
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
goVer: [1.17, 1.18]
goVer: [1.18, 1.19]
steps:
- name: Set up Go ${{ matrix.goVer }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.goVer }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up ANTLR
env:
ANTLR_VERSION: 4.9
ANTLR_VERSION: 4.11.1
run: |
sudo curl -o /usr/local/lib/antlr-${ANTLR_VERSION}-complete.jar https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar
export CLASSPATH=".:/usr/local/lib/antlr-${ANTLR_VERSION}-complete.jar:$CLASSPATH"
mkdir $HOME/antlr-bin
echo -e '#!/bin/bash\njava -jar /usr/local/lib/antlr-4.9-complete.jar "$@"' > $HOME/antlr-bin/antlr
echo -e '#!/bin/bash\njava -jar /usr/local/lib/antlr-4.11.1-complete.jar "$@"' > $HOME/antlr-bin/antlr
echo -e '#!/bin/bash\njava org.antlr.v4.gui.TestRig "$@"' > $HOME/antlr-bin/grun
chmod +x $HOME/antlr-bin/*
export PATH=$PATH:$HOME/antlr-bin
Expand All @@ -32,25 +59,12 @@ jobs:
- name: Set up Lab
run: |
curl https://raw.githubusercontent.com/MontFerret/lab/master/install.sh -o install.sh
sudo sh install.sh
- name: Set up linters
run: go install github.com/mgechev/revive@latest

- name: Check out code into the Go module directory
uses: actions/checkout@v2
chmod +x ./install.sh
LOCATION=$PWD ./install.sh
- name: Get dependencies
run: make install

- name: Lint
run: |
make vet
make lint
make fmt
git diff
if [[ $(git diff) != '' ]]; then echo 'Invalid formatting!' >&2; exit 1; fi
- name: Generate
run: |
export PATH=$PATH:$HOME/antlr-bin
Expand All @@ -65,5 +79,5 @@ jobs:
- name: E2E tests
run: |
docker run -d -p 9222:9222 ghcr.io/montferret/chromium:92.0.4512.0
make e2e
LAB_BIN=$PWD/lab make e2e
docker stop $(docker ps -q)
52 changes: 25 additions & 27 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '44 5 * * 4'

jobs:
analyze:
Expand All @@ -34,34 +32,34 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: build install compile test e2e doc fmt lint vet release
export CGO_ENABLED=0

LAB_BIN ?= lab
DIR_BIN = ./bin
DIR_PKG = ./pkg
DIR_E2E = ./e2e
Expand All @@ -9,6 +10,11 @@ default: build

build: vet generate test compile

install-tools:
go install honnef.co/go/tools/cmd/staticcheck@latest && \
go install golang.org/x/tools/cmd/goimports@latest && \
go install github.com/mgechev/revive@latest

install:
go get

Expand All @@ -24,7 +30,7 @@ cover:
curl -s https://codecov.io/bash | bash

e2e:
lab --timeout=120 --attempts=5 --concurrency=1 --wait=http://127.0.0.1:9222/json/version --runtime=bin://./bin/ferret --files=./e2e/tests --cdn=./e2e/pages/dynamic --cdn=./e2e/pages/static
${LAB_BIN} --timeout=120 --attempts=5 --concurrency=1 --wait=http://127.0.0.1:9222/json/version --runtime=bin://./bin/ferret --files=./e2e/tests --cdn=./e2e/pages/dynamic --cdn=./e2e/pages/static

bench:
go test -run=XXX -bench=. ${DIR_PKG}/...
Expand All @@ -37,11 +43,13 @@ doc:

# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
fmt:
go fmt ${DIR_PKG}/...
go fmt ${DIR_PKG}/... && \
goimports -w -local github.com/MontFerret ./pkg ./e2e

# https://github.com/mgechev/revive
# go get github.com/mgechev/revive
lint:
staticcheck ./pkg/compiler ./pkg/drivers ./pkg/runtime ./pkg/stdlib && \
revive -config revive.toml -formatter stylish -exclude ./pkg/parser/fql/... -exclude ./vendor/... ./...

# http://godoc.org/code.google.com/p/go.tools/cmd/vet
Expand Down
3 changes: 2 additions & 1 deletion e2e/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
Expand Down Expand Up @@ -259,7 +260,7 @@ func main() {
// check whether the app is getting a query via standard input
std := bufio.NewReader(os.Stdin)

b, err := ioutil.ReadAll(std)
b, err := io.ReadAll(std)

if err != nil {
fmt.Println(err)
Expand Down
39 changes: 22 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
module github.com/MontFerret/ferret

go 1.17
go 1.19

require (
github.com/PuerkitoBio/goquery v1.8.0
github.com/antchfx/htmlquery v1.2.5
github.com/antchfx/xpath v1.2.1
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220722194653-14703f21b580
github.com/corpix/uarand v0.1.1
github.com/PuerkitoBio/goquery v1.8.1
github.com/antchfx/htmlquery v1.3.0
github.com/antchfx/xpath v1.2.4
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1
github.com/corpix/uarand v0.2.0
github.com/gobwas/glob v0.2.3
github.com/gorilla/css v1.0.0
github.com/jarcoal/httpmock v1.2.0
github.com/mafredri/cdp v0.32.0
github.com/jarcoal/httpmock v1.3.0
github.com/mafredri/cdp v0.34.1
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.26.1
github.com/sethgrid/pester v1.1.0
github.com/rs/zerolog v1.29.0
github.com/sethgrid/pester v1.2.0
github.com/smartystreets/goconvey v1.7.2
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.8.2
github.com/wI2L/jettison v0.7.4
golang.org/x/net v0.0.0-20211209124913-491a49abca63
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/text v0.3.7
golang.org/x/net v0.8.0
golang.org/x/sync v0.1.0
golang.org/x/text v0.8.0
)

require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/stretchr/objx v0.1.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/sys v0.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit e75379e

Please sign in to comment.