Skip to content

Add Prometheus and docker-compose #39

Add Prometheus and docker-compose

Add Prometheus and docker-compose #39

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setting up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Check out code
uses: actions/checkout@v2
- name: Build
run: go build -o app -v .
fmt:
name: Format Check
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Check Formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "Unformatted files:"
echo "$unformatted"
exit 1
fi
unit-test:
name: Tests
runs-on: ubuntu-latest
needs: fmt
steps:
- name: Setting up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: Check out code
uses: actions/checkout@v2
- name: Cache Go Modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Unit Tests
run: go test -v ./...
hurl-tests:
name: Hurl Tests
runs-on: ubuntu-latest
needs: unit-test
steps:
- name: Install hrul
run: |
VERSION=4.3.0
curl --silent --location https://github.com/Orange-OpenSource/hurl/releases/download/$VERSION/hurl-$VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xvz -C /tmp
- name: setting up go
uses: actions/setup-go@v3
with:
go-version: '1.22.2'
- name: check out code
uses: actions/checkout@v2
- name: cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashfiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build app
run: go build -o app -v .
- name: Run app
run: |
./app &
sleep 10
- name: Run Hurl tests
run: |
for file in $(find ./hurl-tests -name "*.hurl"); do
/tmp/hurl-4.3.0-x86_64-unknown-linux-gnu/bin/hurl --test "$file" --variable host=localhost:8080
done