Skip to content

Test CI

Test CI #468

Workflow file for this run

name: Test CI
on:
pull_request:
branches: ["*"]
paths:
- ".github/workflows/ci_test.yml" # this file
- "go.mod"
- "go.sum"
- "Makefile"
- "generate/**/*"
- "src/**/*"
schedule:
- cron: "37 13 * * *"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Generate go code from go:generate comments
run: make install
- name: Build project
run: make compile
test:
runs-on: ubuntu-latest
permissions:
contents: read
services:
redis:
image: docker.io/library/redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
dynamodb:
image: docker.io/amazon/dynamodb-local:latest
ports:
- 8000:8000
options: >-
--health-cmd "curl -s http://localhost:8000/shell/ -o /dev/null"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Generate go code from go:generate comments
run: make install
- name: Test units (w/o engines & cache)
run: make test
- name: Test units (only redis)
run: make test-redis
env:
REDIS_HOST: localhost
REDIS_PORT: "6379"
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
- name: Configure AWS CLI for Local DynamoDB
run: |
aws configure set aws_access_key_id dummy
aws configure set aws_secret_access_key dummy
aws configure set region eu-central-1
- name: Setup DynamoDB table KV
env:
AWS_REGION: "eu-central-1"
AWS_ACCESS_KEY_ID: "hearchco"
AWS_SECRET_ACCESS_KEY: "hearchco"
DYNAMODB_TABLE: "hearchco"
DYNAMODB_ENDPOINT: "http://localhost:8000"
run: >-
aws dynamodb create-table
--table-name $DYNAMODB_TABLE
--attribute-definitions AttributeName=Key,AttributeType=S
--key-schema AttributeName=Key,KeyType=HASH
--billing-mode PAY_PER_REQUEST
--endpoint-url $DYNAMODB_ENDPOINT
- name: Setup DynamoDB table TTL
env:
AWS_REGION: "eu-central-1"
AWS_ACCESS_KEY_ID: "hearchco"
AWS_SECRET_ACCESS_KEY: "hearchco"
DYNAMODB_TABLE: "hearchco"
DYNAMODB_ENDPOINT: "http://localhost:8000"
run: >-
aws dynamodb update-time-to-live
--table-name $DYNAMODB_TABLE
--time-to-live-specification "Enabled=true, AttributeName=TTL"
--endpoint-url $DYNAMODB_ENDPOINT
- name: Test units (only dynamodb)
run: make test-dynamodb
env:
AWS_REGION: "eu-central-1"
AWS_ACCESS_KEY_ID: "hearchco"
AWS_SECRET_ACCESS_KEY: "hearchco"
DYNAMODB_TABLE: "hearchco"
DYNAMODB_ENDPOINT: "http://localhost:8000"
test-engines:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Generate go code from go:generate comments
run: make install
- name: Test units (only engines)
run: make test-engines
lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Generate go code from go:generate comments
run: make install
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: latest
skip-pkg-cache: true
args: --timeout=5m