-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup env-loader CI/CD and dev tooling
- Loading branch information
Showing
16 changed files
with
407 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,50 +4,11 @@ name: Changelog generator CI | |
on: | ||
pull_request: | ||
|
||
env: | ||
TOOL_DIRECTORY: tools/changelog | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Determine if tests should run | ||
# This is a monorepo and GH checks cannot be required for only specific | ||
# paths, so this is required instead of a trigger `paths` filter. | ||
- name: Check if relavent files have changed | ||
id: changes | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
with: | ||
filters: | | ||
tool: | ||
- 'tools/changelog/**' | ||
- '.github/workflows/changelog-ci.yaml' | ||
# Setup | ||
- name: Checkout repository | ||
if: steps.changes.outputs.tool == 'true' | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- name: Setup Go | ||
if: steps.changes.outputs.tool == 'true' | ||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: "${{ env.TOOL_DIRECTORY }}/go.mod" | ||
|
||
# Linting | ||
- name: Install golangci-lint | ||
if: steps.changes.outputs.tool == 'true' | ||
run: go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
- name: Lint | ||
if: steps.changes.outputs.tool == 'true' | ||
working-directory: ${{ env.TOOL_DIRECTORY }} | ||
run: make lint | ||
|
||
# Tests | ||
- name: Install gotestsum | ||
if: steps.changes.outputs.tool == 'true' | ||
run: go install gotest.tools/[email protected] | ||
- name: Run tests | ||
if: steps.changes.outputs.tool == 'true' | ||
working-directory: ${{ env.TOOL_DIRECTORY }} | ||
run: make test | ||
release: | ||
uses: ./tools/repo-release-tooling/workflows/reusable-ci.yaml | ||
permissions: | ||
contents: write | ||
packages: write | ||
with: | ||
tool-directory: ./tools/changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: Environment value loader CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- tools/env-loader | ||
tags: | ||
- "tools/env-loader/v[0-9]+.[0-9]+.[0-9]+**" | ||
pull_request: | ||
paths: | ||
- tools/env-loader/workflows/cd.yaml | ||
- .github/workflows/env-loader-cd.yaml | ||
- tools/repo-release-tooling/workflows/reusable-cd.yaml | ||
|
||
jobs: | ||
release: | ||
uses: ./tools/repo-release-tooling/workflows/reusable-cd.yaml | ||
permissions: | ||
contents: write | ||
packages: write | ||
with: | ||
tool-directory: ./tools/env-loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Environment value loader CI | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
release: | ||
uses: ./tools/repo-release-tooling/workflows/reusable-ci.yaml | ||
permissions: | ||
contents: write | ||
packages: write | ||
with: | ||
tool-directory: ./tools/env-loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,3 @@ | ||
OS ?= $(shell uname -s | tr '[[:upper:]]' '[[:lower:]]') | ||
ARCH ?= $(shell uname -m) | ||
TOOL_NAME = changelog | ||
BUILD_DIR = build/$(OS)/$(ARCH) | ||
VERSION = v0.0.0-dev | ||
BINARY_NAME = $(TOOL_NAME) | ||
ifeq ($(OS),windows) | ||
BINARY_NAME := $(BINARY_NAME).exe | ||
endif | ||
|
||
lint: | ||
@golangci-lint run ./... --out-format colored-line-number | ||
|
||
test: | ||
@gotestsum --format github-actions ./... -- -shuffle on -timeout 2m -race | ||
|
||
binary: | ||
@echo "Building for $(OS)/$(ARCH) and writing to $(BUILD_DIR)" | ||
@mkdir -p "$(BUILD_DIR)" | ||
@GOOS=$(OS) GOARCH=$(ARCH) go build -o "$(BUILD_DIR)/" -ldflags="-s -w" | ||
|
||
tarball: TARBALL_NAME = $(TOOL_NAME)-$(VERSION)-$(OS)-$(ARCH).tar.gz | ||
tarball: binary | ||
tar -C "$(BUILD_DIR)" -czvf "$(BUILD_DIR)/$(TARBALL_NAME)" "$(BINARY_NAME)" > /dev/null | ||
|
||
container-image: OS = linux | ||
container-image: binary | ||
@docker buildx build --platform="linux/$(ARCH)" -t "$(TOOL_NAME)" . | ||
|
||
clean: | ||
@rm -rf build/ | ||
@docker image rm -f "$(TOOL_NAME):$(VERSION)" 2> /dev/null | ||
|
||
.PHONY: lint test binary tarball container-image clean | ||
include ../repo-release-tooling/tooling.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TOOL_NAME = env-loader | ||
PACKAGE_PATH = ./cmd/env-loader.go | ||
|
||
include ../repo-release-tooling/tooling.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.