Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(issue#37): implement ci build workflow #53

Merged
merged 21 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'CI - Build'
on: workflow_dispatch
jobs:
build-targets:
name: build-targets
runs-on: ubuntu-22.04
env:
GOPRIVATE: github.com/opentdf/opentdf-v2-poc/*
BIN_NAME: tructl
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
cache: false
- name: Get next version
uses: reecetech/version-increment@2023.9.3
averypfeiffer marked this conversation as resolved.
Show resolved Hide resolved
id: version
with:
release_branch: main
scheme: semver
increment: patch
pep440: false
- name: print-version
run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }}
# special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1.5.0
with:
app-id: '416599'
private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}'
owner: ${{ github.repository_owner }}
repositories: 'opentdf-v2-poc'
- run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/
- name: make-targets
env:
SEM_VER: ${{ steps.version.outputs.version }}
run: make build
- name: smoke-test
run: go test ./... -short -race -cover
- name: Release
uses: softprops/action-gh-release@v1
with:
files: './target/**/*'
body: "This is a test release, and will be removed"
tag_name: ${{ steps.version.outputs.version }}
repository: opentdf/tructl
generate_release_notes: true


23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# We're going to be using this Makefile as a sort of task runner, for all sorts of operations in this project

# first we'll grab the current version from our ENV VAR (added by our CI) - see here: https://github.com/marketplace/actions/version-increment
CURR_VERSION := ${SEM_VER}

# Default target executed when no arguments are given to make.
# NOTE: .PHONY is used to indicate that the target is not a file (e.g. there is no file called 'build-darwin-amd64', instead the .PHONY directive tells make that the proceeding target is a command to be executed, not a file to be generated)
.PHONY: all
all: run
.DEFAULT_GOAL := run




# Binary name: Change this to your actual binary name
BINARY_NAME=tructl
BINARY_NAME=${BIN_NAME}


# Output directory for compiled binaries
Expand All @@ -20,28 +25,28 @@ build: clean build-darwin-amd64 build-darwin-arm64 build-linux-amd64 build-linux

# Build commands for each platform
build-darwin-amd64:
GOOS=darwin GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-darwin-amd64 .
GOOS=darwin GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-darwin-amd64 .

build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-darwin-arm64 .
GOOS=darwin GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-darwin-arm64 .

build-linux-amd64:
GOOS=linux GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-amd64 .
GOOS=linux GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-amd64 .

build-linux-arm:
GOOS=linux GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-arm .
GOOS=linux GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-arm .

build-linux-arm64:
GOOS=linux GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-arm64 .
GOOS=linux GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-arm64 .

build-windows-amd64:
GOOS=windows GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-amd64.exe .
GOOS=windows GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-amd64.exe .

build-windows-arm:
GOOS=windows GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-arm.exe .
GOOS=windows GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-arm.exe .

build-windows-arm64:
GOOS=windows GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-arm64.exe .
GOOS=windows GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-arm64.exe .

# Target for running the project (adjust as necessary for your project)
.PHONY: run
Expand Down
Loading