Skip to content

Commit

Permalink
ci: run go generate in ci and dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
JM-Lemmi committed Feb 14, 2024
1 parent b10c83d commit efd1507
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/generate-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$DIR" || exit 1

if [[ $(git tag -l --contains HEAD) ]]; then
echo -n $(git tag -l --contains HEAD) > ../.././cmd/ical-relay/VERSION
echo -n $(git tag -l --contains HEAD) > ../../cmd/ical-relay/VERSION
else
echo -n $(git rev-parse --short HEAD) > ../.././cmd/ical-relay/VERSION
echo -n $(git rev-parse --short HEAD) > ../../cmd/ical-relay/VERSION
fi
if ! git diff --quiet; then
echo -n "-dirty" >> ../.././cmd/ical-relay/VERSION
echo -n "-dirty" >> ../../cmd/ical-relay/VERSION
fi
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- run: ./.github/scripts/generate-version.sh
- uses: actions/setup-go@v4
with:
go-version: '1.18.0' # The Go version to download (if necessary) and use.
- run: go generate cmd/ical-relay/main.go
- run: go build -o ./bin/ical-relay ./cmd/ical-relay/
- uses: actions/upload-artifact@v3
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- run: ./.github/scripts/generate-version.sh
- uses: actions/setup-go@v4
with:
go-version: '1.18.0' # The Go version to download (if necessary) and use.
- run: go generate cmd/ical-relay/main.go
- run: go build -o ./bin/ical-relay ./cmd/ical-relay/ && strip ./bin/ical-relay
- uses: actions/upload-artifact@v3
with:
Expand All @@ -70,7 +70,6 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- run: ./.github/scripts/generate-version.sh
- name: Create debpkg structure
run: |
mkdir -p cmd/ical-relay/.debpkg/etc/ical-relay
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- run: ./.github/scripts/generate-version.sh

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- run: go generate cmd/ical-relay/main.go

- name: Run tests
run: go test ./cmd/ical-relay/...
5 changes: 2 additions & 3 deletions cmd/ical-relay/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM golang:alpine AS build

RUN apk --update add git
RUN apk --update add git bash

WORKDIR /app
COPY . /app

RUN if [[ $(git tag -l --contains HEAD) ]]; then echo -n $(git tag -l --contains HEAD) > ./cmd/ical-relay/VERSION; else echo -n $(git rev-parse --short HEAD) > ./cmd/ical-relay/VERSION; fi

RUN go generate ./cmd/ical-relay/
RUN go build -o ./cmd/ical-relay/ical-relay ./cmd/ical-relay/

FROM alpine AS run
Expand Down

0 comments on commit efd1507

Please sign in to comment.