Skip to content

Commit

Permalink
Merge pull request #19 from nlnwa/reimplementation
Browse files Browse the repository at this point in the history
Reimplementation in Go
  • Loading branch information
maeb authored Sep 21, 2021
2 parents 1ba5d4b + 8bce863 commit 053cee1
Show file tree
Hide file tree
Showing 64 changed files with 3,633 additions and 3,948 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Docker

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

# Run tests for any PRs.
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.29

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs:
- test
- golangci

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: docker build . --file Dockerfile --tag image

- name: Log into registry
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
Expand Down
8 changes: 0 additions & 8 deletions .mvn/extensions.xml

This file was deleted.

22 changes: 0 additions & 22 deletions .mvn/jgitver.config.xml

This file was deleted.

117 changes: 0 additions & 117 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

2 changes: 0 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties

This file was deleted.

19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/build_script.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/push_script.sh

This file was deleted.

28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM golang:1.17 as build

WORKDIR /build

COPY go.mod .
COPY go.sum .

RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test ./...

# -trimpath remove file system paths from executable
# -ldflags arguments passed to go tool link:
# -s disable symbol table
# -w disable DWARF generation
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" .

FROM gcr.io/distroless/base
COPY --from=build /build/veidemann-contentwriter /

# api server
EXPOSE 8080/tcp
# prometheus metrics server
EXPOSE 9153/tcp

ENTRYPOINT ["/veidemann-contentwriter"]
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
[![License Apache](https://img.shields.io/github/license/nlnwa/veidemann-contentwriter.svg)](https://github.com/nlnwa/veidemann-contentwriter/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/nlnwa/veidemann-contentwriter.svg)](https://github.com/nlnwa/veidemann-contentwriter/releases/latest)
[![Build Status](https://travis-ci.org/nlnwa/veidemann-contentwriter.svg?branch=master)](https://travis-ci.org/nlnwa/veidemann-contentwriter)

# veidemann-contentwriter

## Build container

mvn package -Pdocker-build

## Run integration tests

mvn verify -Pintegration-tests
Loading

0 comments on commit 053cee1

Please sign in to comment.