Skip to content

Commit

Permalink
Update Settings For CI (#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrm authored Jun 23, 2023
1 parent b90fb3b commit fe73b73
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,29 @@ jobs:
matrix:
goversion:
- 1.18

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go 1.x
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{matrix.goversion}}
go-version: ${{ matrix.goversion }}

- name: Docker Compose Install
- name: Install Docker Compose
uses: KengoTODA/actions-setup-docker-compose@92cbaf8ac8c113c35e1cedd1182f217043fbdd00
with:
version: '1.25.4'

- run: docker-compose pull

- name: Vault
- name: Start Vault
run: |
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d vault;
sleep 3;
- name: Test
- name: Run Tests
run: |
export VAULT_TOKEN=$(docker logs grant-vault 2>&1 | grep "Root Token" | tail -1 | cut -d ' ' -f 3 );
docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm dev make;
18 changes: 9 additions & 9 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ jobs:

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -49,8 +49,12 @@ jobs:

# 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
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

- name: Download Modules and Build
run: |
make codeql
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -59,9 +63,5 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ ifdef TEST_RUN
TEST_FLAGS = --tags=$(TEST_TAGS) $(TEST_PKG) --run=$(TEST_RUN)
endif

.PHONY: all buildcmd docker test create-json-schema lint clean
.PHONY: all buildcmd docker test create-json-schema lint clean download-mod
all: test create-json-schema buildcmd

.DEFAULT: buildcmd

codeql: download-mod buildcmd

buildcmd:
cd main && CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -v -ldflags "-w -s -X main.version=${GIT_VERSION} -X main.buildTime=${BUILD_TIME} -X main.commit=${GIT_COMMIT}" -o ${OUTPUT}/bat-go main.go
cd main && CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-w -s -X main.version=${GIT_VERSION} -X main.buildTime=${BUILD_TIME} -X main.commit=${GIT_COMMIT}" -o ${OUTPUT}/bat-go main.go

mock:
cd services && mockgen -source=./promotion/claim.go -destination=promotion/mockclaim.go -package=promotion
Expand Down Expand Up @@ -196,3 +198,13 @@ lint:
docker run --rm -v "$$(pwd):/app" -v batgo_lint_gomod:/go/pkg --workdir /app/tools golangci/golangci-lint:v1.49.0 golangci-lint run -v ./...
docker run --rm -v "$$(pwd):/app" -v batgo_lint_gomod:/go/pkg --workdir /app/serverless/email/webhook golangci/golangci-lint:v1.49.0 golangci-lint run -v ./...
docker run --rm -v "$$(pwd):/app" -v batgo_lint_gomod:/go/pkg --workdir /app/serverless/email/unsubscribe golangci/golangci-lint:v1.49.0 golangci-lint run -v ./...

download-mod:
cd ./cmd && go mod download && cd ..
cd ./libs && go mod download && cd ..
cd ./main && go mod download && cd ..
cd ./services && go mod download && cd ..
cd ./tools && go mod download && cd ..
cd ./serverless/email/status && go mod download && cd ../../..
cd ./serverless/email/unsubscribe && go mod download && cd ../../..
cd ./serverless/email/webhook && go mod download && cd ../../..

0 comments on commit fe73b73

Please sign in to comment.