Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #322 from vania-pooh/master
Browse files Browse the repository at this point in the history
Go 1.19
  • Loading branch information
vania-pooh authored Nov 17, 2022
2 parents e8f8e20 + 294cc7a commit 263e3c5
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: ~1.19.3

- uses: actions/cache@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: ~1.19.3

- uses: actions/cache@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: ~1.19.3

- uses: actions/cache@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.12
FROM alpine:3

RUN apk add -U ca-certificates tzdata && rm -Rf /var/cache/apk/*
COPY cm /
Expand Down
36 changes: 18 additions & 18 deletions browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"files": {
"linux": {
"amd64": {
"url": "https://chromedriver.storage.googleapis.com/104.0.5112.29/chromedriver_linux64.zip",
"url": "https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_linux64.zip",
"filename": "chromedriver"
}
},
"darwin": {
"amd64": {
"url": "https://chromedriver.storage.googleapis.com/104.0.5112.29/chromedriver_mac64.zip",
"url": "https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_mac64.zip",
"filename": "chromedriver"
}
},
"windows": {
"386": {
"url": "https://chromedriver.storage.googleapis.com/104.0.5112.29/chromedriver_win32.zip",
"url": "https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_win32.zip",
"filename": "chromedriver.exe"
},
"amd64": {
"url": "https://chromedriver.storage.googleapis.com/104.0.5112.29/chromedriver_win32.zip",
"url": "https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_win32.zip",
"filename": "chromedriver.exe"
}
}
Expand All @@ -32,27 +32,27 @@
"files": {
"linux": {
"386": {
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux32.tar.gz",
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux32.tar.gz",
"filename": "geckodriver"
},
"amd64": {
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz",
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz",
"filename": "geckodriver"
}
},
"darwin": {
"amd64": {
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-macos.tar.gz",
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-macos.tar.gz",
"filename": "geckodriver"
}
},
"windows": {
"386": {
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-win32.zip",
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-win32.zip",
"filename": "geckodriver.exe"
},
"amd64": {
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-win64.zip",
"url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-win64.zip",
"filename": "geckodriver.exe"
}
}
Expand All @@ -64,23 +64,23 @@
"files": {
"linux": {
"amd64": {
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.103.0.5060.66/operadriver_linux64.zip",
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_linux64.zip",
"filename": "operadriver_linux64/operadriver"
}
},
"darwin": {
"amd64": {
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.103.0.5060.66/operadriver_mac64.zip",
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_mac64.zip",
"filename": "operadriver_mac64/operadriver"
}
},
"windows": {
"386": {
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.103.0.5060.66/operadriver_win32.zip",
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_win32.zip",
"filename": "operadriver_win32/operadriver.exe"
},
"amd64": {
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.103.0.5060.66/operadriver_win64.zip",
"url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_win64.zip",
"filename": "operadriver_win64/operadriver.exe"
}
}
Expand Down Expand Up @@ -121,27 +121,27 @@
"files": {
"linux": {
"amd64": {
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/105.0.1321.0/edgedriver_linux64.zip",
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/107.0.1418.42/edgedriver_linux64.zip",
"filename": "msedgedriver"
}
},
"darwin": {
"amd64": {
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/105.0.1321.0/edgedriver_mac64.zip",
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/107.0.1418.42/edgedriver_mac64.zip",
"filename": "msedgedriver"
},
"arm64": {
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/105.0.1321.0/edgedriver_arm64.zip",
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/107.0.1418.42/edgedriver_arm64.zip",
"filename": "msedgedriver"
}
},
"windows": {
"386": {
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/105.0.1321.0/edgedriver_win32.zip",
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/107.0.1418.42/edgedriver_win32.zip",
"filename": "msedgedriver.exe"
},
"amd64": {
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/105.0.1321.0/edgedriver_win64.zip",
"url": "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/107.0.1418.42/edgedriver_win64.zip",
"filename": "msedgedriver.exe"
}
}
Expand Down
2 changes: 1 addition & 1 deletion ci/docker-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

docker build -t "$GITHUB_REPOSITORY" -t "$GITHUB_REPOSITORY:$1" .
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker build --pull -t "$GITHUB_REPOSITORY" -t "$GITHUB_REPOSITORY:$1" .
docker push "$GITHUB_REPOSITORY"
docker push "$GITHUB_REPOSITORY:$1"
3 changes: 3 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

export GO111MODULE="on"
go test -race -v github.com/aerokube/cm/selenoid -coverprofile=coverage.txt -covermode=atomic -coverpkg github.com/aerokube/cm/selenoid

go install golang.org/x/vuln/cmd/govulncheck@latest
"$(go env GOPATH)"/bin/govulncheck ./...
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/aerokube/cm

go 1.18
go 1.19

require (
github.com/Masterminds/semver/v3 v3.0.1
Expand Down
9 changes: 4 additions & 5 deletions selenoid/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"github.com/docker/docker/api"
"github.com/docker/go-units"
"io/ioutil"
"log"
"sort"

Expand Down Expand Up @@ -114,7 +113,7 @@ func NewDockerConfigurator(config *LifecycleConfig) (*DockerConfigurator, error)
}
if c.Quiet {
log.SetFlags(0)
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
}
err := c.initDockerClient()
if err != nil {
Expand Down Expand Up @@ -389,12 +388,12 @@ func (c *DockerConfigurator) Configure() (*SelenoidConfig, error) {
if err != nil {
return nil, fmt.Errorf("failed to marshal json: %v", err)
}
return &cfg, ioutil.WriteFile(getSelenoidConfigPath(c.ConfigDir), data, 0644)
return &cfg, os.WriteFile(getSelenoidConfigPath(c.ConfigDir), data, 0644)
}

func (c *DockerConfigurator) syncWithConfig() (*SelenoidConfig, error) {
c.Titlef(`Requested to sync configuration from "%v"...`, color.GreenString(c.BrowsersJson))
data, err := ioutil.ReadFile(c.BrowsersJson)
data, err := os.ReadFile(c.BrowsersJson)
if err != nil {
return nil, fmt.Errorf("failed to read browsers.json from %s: %v", c.BrowsersJson, err)
}
Expand All @@ -418,7 +417,7 @@ func (c *DockerConfigurator) syncWithConfig() (*SelenoidConfig, error) {
}
c.pullVideoRecorderImage()
}
return &cfg, ioutil.WriteFile(getSelenoidConfigPath(c.ConfigDir), data, 0644)
return &cfg, os.WriteFile(getSelenoidConfigPath(c.ConfigDir), data, 0644)
}

func (c *DockerConfigurator) createConfig() SelenoidConfig {
Expand Down
3 changes: 1 addition & 2 deletions selenoid/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
. "github.com/aandryashin/matchers"
"github.com/aerokube/selenoid/config"
"github.com/docker/docker/api/types"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -431,7 +430,7 @@ func TestSyncWithConfig(t *testing.T) {

initialCfgFile := filepath.Join(dir, "initial-browsers.json")
data, _ := json.Marshal(initialCfg)
ioutil.WriteFile(initialCfgFile, data, 0644)
os.WriteFile(initialCfgFile, data, 0644)

lcConfig := LifecycleConfig{
ConfigDir: dir,
Expand Down
5 changes: 2 additions & 3 deletions selenoid/drivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/mitchellh/go-ps"
"gopkg.in/cheggaaa/pb.v1"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -285,7 +284,7 @@ func (d *DriversConfigurator) Configure() (*SelenoidConfig, error) {
if err != nil {
return &cfg, fmt.Errorf("failed to marshal json: %v", err)
}
return &cfg, ioutil.WriteFile(getSelenoidConfigPath(d.ConfigDir), data, 0644)
return &cfg, os.WriteFile(getSelenoidConfigPath(d.ConfigDir), data, 0644)
}

func (d *DriversConfigurator) generateConfig(downloadedDrivers []downloadedDriver) SelenoidConfig {
Expand Down Expand Up @@ -406,7 +405,7 @@ func extractFile(data []byte, filename string, outputDir string) (string, error)
return untar(data, filename, outputDir)
} else {
outputPath := filepath.Join(outputDir, filename)
err := ioutil.WriteFile(outputPath, data, os.ModePerm)
err := os.WriteFile(outputPath, data, os.ModePerm)
if err != nil {
return "", fmt.Errorf("failed to save file %s: %v", outputPath, err)
}
Expand Down
9 changes: 4 additions & 5 deletions selenoid/drivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
. "github.com/aandryashin/matchers"
"github.com/aerokube/selenoid/config"
"github.com/google/go-github/github"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -276,7 +275,7 @@ func testUnpack(t *testing.T, data []byte, fileName string, fn func([]byte, stri
}

func readFile(t *testing.T, fileName string) []byte {
data, err := ioutil.ReadFile(fileName)
data, err := os.ReadFile(fileName)
if err != nil {
t.Fatal(err)
}
Expand All @@ -299,7 +298,7 @@ func mockServerUrl(mockServer *httptest.Server, relativeUrl string) string {
}

func withTmpDir(t *testing.T, prefix string, fn func(*testing.T, string)) {
dir, err := ioutil.TempDir("", prefix)
dir, err := os.MkdirTemp("", prefix)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -365,7 +364,7 @@ func checkContentsEqual(t *testing.T, outputPath string, expectedFileContents st
if !fileExists(outputPath) {
t.Fatalf("release was not downloaded to %s: file does not exist\n", outputPath)
}
data, err := ioutil.ReadFile(outputPath)
data, err := os.ReadFile(outputPath)
AssertThat(t, err, Is{nil})
AssertThat(t, string(data), EqualTo{expectedFileContents})

Expand Down Expand Up @@ -418,7 +417,7 @@ func TestWrongBaseUrl(t *testing.T) {
})
}

//Based on https://npf.io/2015/06/testing-exec-command/
// Based on https://npf.io/2015/06/testing-exec-command/
func TestStartStopProcess(t *testing.T) {
execCommand = fakeExecCommand
defer func() {
Expand Down

0 comments on commit 263e3c5

Please sign in to comment.