Skip to content

Commit

Permalink
Merge branch 'main' into PMM-7-use-image-from-env-for-encrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk committed Aug 28, 2023
2 parents 6481a4f + 4aca88d commit 8eb2882
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 20 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,8 @@ jobs:
with:
go-version-file: ${{ github.workspace }}/go.mod

- name: Initialize dependencies and linters
run: make init

- name: Diff
run: |
make format
git diff --exit-code
- name: Test
run: |
TEST_MONGODB_IMAGE=${{ matrix.image }} make test-cluster
make test-race
make test-cluster-clean
- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
make check-license
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint

on:
schedule:
# run every Sunday
- cron: '0 13 * * 0'
push:
branches:
- main
- release-0.1x
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:

jobs:
lint:
name: Lint Check

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ github.workspace }}/go.mod

- name: Initialize dependencies and linters
run: make init

- name: Diff
run: |
make format
git diff --exit-code
- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
make check-license
6 changes: 3 additions & 3 deletions exporter/v1_compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package exporter
import (
"context"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -100,7 +100,7 @@ func TestMakeLockMetric(t *testing.T) {
}

func TestAddLocksMetrics(t *testing.T) {
buf, err := ioutil.ReadFile(filepath.Join("testdata/", "locks.json"))
buf, err := os.ReadFile(filepath.Join("testdata/", "locks.json"))
assert.NoError(t, err)

var m bson.M
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestSumMetrics(t *testing.T) {
testCase := tt

t.Run(tt.name, func(t *testing.T) {
buf, err := ioutil.ReadFile(filepath.Join("testdata/", "get_diagnostic_data.json"))
buf, err := os.ReadFile(filepath.Join("testdata/", "get_diagnostic_data.json"))
assert.NoError(t, err)

var m bson.M
Expand Down
3 changes: 1 addition & 2 deletions internal/tu/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"os"
"os/exec"
Expand Down Expand Up @@ -139,7 +138,7 @@ func TestClient(ctx context.Context, port string, t *testing.T) *mongo.Client {

// LoadJSON loads a file and returns the result of unmarshaling it into a bson.M structure.
func LoadJSON(filename string) (bson.M, error) {
buf, err := ioutil.ReadFile(filepath.Clean(filename))
buf, err := os.ReadFile(filepath.Clean(filename))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 8eb2882

Please sign in to comment.