Skip to content

Commit

Permalink
fixing conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jandroav committed Dec 9, 2023
1 parent 15f1690 commit c39b261
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; https://editorconfig.org/

root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

[*.md]
indent_size = 4
trim_trailing_whitespace = false

eclint_indent_style = unset
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
115 changes: 115 additions & 0 deletions .github/workflows/attach-artifact-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Attach Artifact to Release

on:
pull_request:
types:
- closed

jobs:
attach-to-release:
name: Attach Artifact to Release
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install upx
run: |
sudo apt-get update
sudo apt-get install upx
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.4'

- name: Get Reusable Script Files
run: |
chmod +x release.sh
- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(grep "vtrainVersion" "./pkg/common/utilities.go" | awk -F'"' '{print $2}')" >> $GITHUB_ENV

- name: Backup release body
run: |
release_id=$(curl -X GET -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases?per_page=1 | jq -r '.[] | select(.name == "${{ env.artifact_id }}") | .id')
# Check if release_id is empty
if [ -z "$release_id" ]; then
echo "Release '$release_name' not found in the repository '$repo'."
exit 1
fi
release_url="https://api.github.com/repos/${{ github.repository }}/releases/$release_id"
curl -X GET -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$release_url" | jq -r .body > release_body.txt
- name: Store previous release body as artifact
uses: actions/upload-artifact@v2
with:
name: release_body.txt
path: release_body.txt

- name: Delete tag and release
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ env.artifact_id }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true

- name: Install dependencies
run: |
go version
go get
- name: Generate distributions
run: sh release.sh

- name: Upload Windows binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: vtrain_windows.zip
asset_name: vtrain_windows_$tag.zip
tag: ${{ env.artifact_id }}
overwrite: true

- name: Upload Linux binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: vtrain_linux.zip
asset_name: vtrain_linux_$tag.zip
tag: ${{ env.artifact_id }}
overwrite: true

- name: Upload macOS Silicon binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: vtrain_mac_arm.zip
asset_name: vtrain_mac_arm_$tag.zip
tag: ${{ env.artifact_id }}
overwrite: true

- name: Upload macOS Intel binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: vtrain_mac_intel.zip
asset_name: vtrain_mac_intel_$tag.zip
tag: ${{ env.artifact_id }}
overwrite: true

- name: Get latest release ID
id: get-release
run: |
LATEST_RELEASE=$(curl -X GET -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases?per_page=1" | jq -r '.[].id')
echo "Latest Release ID: $LATEST_RELEASE"
echo "RELEASE_ID=$LATEST_RELEASE" >> $GITHUB_ENV
- name: Edit Release
uses: irongut/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: ${{ env.RELEASE_ID }}
name: ${{ env.artifact_id }}
replacename: true
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Test
on:
push:
branches:
- '*'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Setup Go
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.4' # The Go version to download (if necessary) and use.

# Install all the dependencies
- name: Install dependencies
run: |
go version
go get
# Run build of the application
- name: Run build
run: go build -ldflags="-s -w" .

# Run vet & lint on the code
- name: Run vet
run: |
go vet .
# Run testing on the code
- name: Run testing
run: go test -covermode=count -coverpkg=./pkg -coverprofile cover.out -v ./test/...
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
**/main
**/vtrain
jandroav/
pulumi/
cloud_databases.gob

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
*.html

# Dependency directories (remove the comment below to include it)
# vendor/

# System files
**/.DS_Store

# Editor directories and files
.vscode/

0 comments on commit c39b261

Please sign in to comment.