diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 000000000..c9c466bfa --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +name: Go + +on: + push: + branches: + - 3.x + pull_request: + branches: + - 3.x + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + + - name: Install dependencies + run: go mod download + working-directory: src/go + + - name: Setup environment + run: make env-up + working-directory: src/go + + - name: Run tests + run: go test ./... + working-directory: src/go diff --git a/.github/workflows/toolkit.yml b/.github/workflows/toolkit.yml index 50e7d8f2f..6818c07e8 100644 --- a/.github/workflows/toolkit.yml +++ b/.github/workflows/toolkit.yml @@ -20,12 +20,14 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' + - name: Build - run: cd src/go; make linux-amd64; cd ../../ + working-directory: src/go + run: make linux-amd64 - name: Build the Docker image - run: echo "FROM oraclelinux:9-slim" > Dockerfile; echo "RUN microdnf -y update" >> Dockerfile; echo "COPY bin/* /usr/bin/" >> Dockerfile; docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }} + run: docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }} - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.29.0 with: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..59c81a4f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM oraclelinux:9-slim +RUN microdnf -y update +COPY bin/* /usr/bin/ diff --git a/src/go/Makefile b/src/go/Makefile index 0caceca45..594247fd8 100644 --- a/src/go/Makefile +++ b/src/go/Makefile @@ -173,7 +173,7 @@ test: ## Run tests format: ## Format source code. gofumpt -w -s $(FILES) - gofumports -local github.com/percona/pmm-managed -l -w $(FILES) + gofumports -local github.com/percona/percona-toolkit -l -w $(FILES) vet: ## Run vet on Go code @echo ">> vetting code"