Skip to content

no more gin framework - only net.http #6

no more gin framework - only net.http

no more gin framework - only net.http #6

Workflow file for this run

name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
linting:
name: Run a golangci-lint
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Run golangci-lint'
uses: golangci/golangci-lint-action@v3.2.0
sonar:
name: Run a SonarCloud Scan
needs: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'SonarCloud Scan'
uses: SonarSource/sonarcloud-github-action@v1.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=gaellm
-Dsonar.projectKey=gaellm_alfred.go
-Dsonar.exclusions=docs/**,tests/**,assets/**,grafana/**
projectBaseDir: .
test:
name: Test Alfred
needs: [linting, sonar]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
load-test:
name: Load Test Alfred
needs: [linting, sonar, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build
run: go build
- name: Start
run: ALFRED_CORE_LISTEN_IP=127.0.0.1 nohup ./alfred &
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Run tests
run: |
./k6 run tests/k6-loadtest.js
push_to_registry:
name: Push Docker image to Docker Hub
needs: [linting, sonar, test, load-test]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: gaellm/alfred.go
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: gaellm/alfred.go:latest
labels: ${{ steps.meta.outputs.labels }}