Skip to content

Add golangci-lint with the config from: https://gist.github.com/marat… #78

Add golangci-lint with the config from: https://gist.github.com/marat…

Add golangci-lint with the config from: https://gist.github.com/marat… #78

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
# TODO: go linting: https://sparkbox.com/foundry/go_vet_gofmt_golint_to_code_check_in_Go
# TODO: https://github.com/search?q=gofmt+language%3AYAML+path%3A.github%2Fworkflows&type=code
env:
LINE_LENGTH: 99 # TODO: would we like to increase this to 120?
jobs:
docker-lint-hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hadolint/[email protected]
with:
recursive: true
go-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run gofmt
run: ./ci/go/go-fmt.sh
shell: bash
# Copied from https://github.com/golangci/golangci-lint-action
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '^1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54
working-directory: datastore
args: '--config "../ci/go/golangci.yml"'
go-vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run gofmt
run: ./ci/go/go-vet.sh
shell: bash
python-lint-black:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: x64
- name: Install Black
run: pip install black
- name: Lint Python with Black
run: black . --check --line-length=${LINE_LENGTH}
python-lint-flake8:
runs-on: ubuntu-latest
steps:
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: x64
- name: Checkout Source
uses: actions/checkout@v3
- name: Install flake8
run: pip install flake8
- name: Syntax Error Check
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Code Style Check
run: flake8 . --count --max-line-length=$LINE_LENGTH --ignore=W503 --show-source --statistics
test:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build docker containers
run: docker compose --profile test build
- name: Start docker stack
run: docker compose up -d
- name: Test loader runs without errors
run: docker compose run --rm loader
- name: Integration test
run: docker compose run --rm integration
- name: Test client runs without errors
run: docker compose run --rm client
- name: Run load test
run: |
python --version
pip install -r load-test/requirements.txt
python -m grpc_tools.protoc --proto_path=datastore/protobuf datastore.proto --python_out=load-test --grpc_python_out=load-test
cd load-test
locust --headless -u 5 -r 1 --run-time 60 --only-summary --csv store
- name: Archive load test artifacts
uses: actions/upload-artifact@v3
with:
name: performance
path: load-test/store_*.csv
- name: Print results
run: |
pip install csvkit
echo "## Stats" >> $GITHUB_STEP_SUMMARY
csvlook load-test/store_stats.csv >> $GITHUB_STEP_SUMMARY
echo "## Stats history" >> $GITHUB_STEP_SUMMARY
csvlook load-test/store_stats_history.csv >> $GITHUB_STEP_SUMMARY
echo "## Failures" >> $GITHUB_STEP_SUMMARY
csvlook load-test/store_failures.csv >> $GITHUB_STEP_SUMMARY
- name: Cleanup
if: always()
run: docker compose down --volumes