Skip to content

Commit

Permalink
Cloney 1.1.0 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurSudbrackIbarra authored Dec 13, 2023
1 parent f0b7864 commit 2782dbe
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 72 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please provide a brief description of the changes introduced by this pull reques
- [ ] I have added tests that prove my fix is effective or that my feature works (if applicable).
- [ ] I have checked for security issues and addressed them (if applicable).
- [ ] I have added or modified relevant comments and documentation in the code.
- [ ] I have updated the `CHANGELOG.md` file.

## Related Issues

Expand Down
39 changes: 23 additions & 16 deletions .github/workflows/auto_release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Automatic Release
# Workflow Name: Automatic Release

# Description:
# This GitHub Actions workflow is triggered when a tag is pushed. It builds the Cloney application
# for multiple platforms, creates zip archives, generates checksums, and releases the artifacts
# using the release-action GitHub action.

# Trigger the workflow when a tag is pushed.
on:
# Trigger when a tag is pushed.
push:
tags:
- "*"
Expand All @@ -15,35 +20,37 @@ jobs:
contents: write

steps:
# Check out the repository.
# Step 1: Check out the repository.
- uses: actions/checkout@v3

# Setup Go.
# Step 2: Setup Go.
- uses: actions/setup-go@v4
with:
go-version: "1.21"

# Install goversioninfo to embed properties into the Windows executable.
# Step 3: Install goversioninfo to embed properties into the Windows executable.
- name: Install goversioninfo
run: |
go get github.com/josephspurrier/[email protected]
go install github.com/josephspurrier/goversioninfo
# Run go generate.
- name: Run Go Generate
run: go generate
run: go install github.com/josephspurrier/goversioninfo/cmd/[email protected]

# Build the application for different platforms.
# Step 4: Build the application for different platforms.
- name: Build Application
run: |
goversioninfo -64
stat resource.syso
GOOS=windows GOARCH=amd64 go build -o cloney-windows-amd64/cloney.exe
rm -f resource.syso
goversioninfo -arm
stat resource.syso
GOOS=windows GOARCH=arm64 go build -o cloney-windows-arm64/cloney.exe
rm -f resource.syso
GOOS=linux GOARCH=amd64 go build -o cloney-linux-amd64/cloney
GOOS=linux GOARCH=arm64 go build -o cloney-linux-arm64/cloney
GOOS=darwin GOARCH=amd64 go build -o cloney-darwin-amd64/cloney
GOOS=darwin GOARCH=arm64 go build -o cloney-darwin-arm64/cloney
# Zip the application for different platforms.
# Step 5: Zip the application for different platforms.
- name: Zip Application
run: |
zip -r cloney-windows-amd64.zip cloney-windows-amd64
Expand All @@ -53,7 +60,7 @@ jobs:
zip -r cloney-darwin-amd64.zip cloney-darwin-amd64
zip -r cloney-darwin-arm64.zip cloney-darwin-arm64
# Generate checksums for the application.
# Step 6: Generate checksums for the application.
- name: Generate Checksums
run: |
sha256sum cloney-windows-amd64.zip > cloney-windows-amd64-checksum.sha256
Expand All @@ -63,7 +70,7 @@ jobs:
sha256sum cloney-darwin-amd64.zip > cloney-darwin-amd64-checksum.sha256
sha256sum cloney-darwin-arm64.zip > cloney-darwin-arm64-checksum.sha256
# Use the release-action GitHub action to create a release.
# Step 7: Use the release-action GitHub action to create a release.
- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand Down
64 changes: 60 additions & 4 deletions .github/workflows/auto_tag.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Automatic Tag
# Workflow Name: Automatic Tag

# Description:
# This GitHub Actions workflow automates the tagging process when a pull request is closed on the 'main' branch.
# It determines the next version using the GitHub Tag Action, updates version-related files, and pushes the tag.

# Trigger the workflow when a pull request is closed on the 'main' branch.
on:
# Trigger the workflow when a pull request is closed on the 'main' branch.
pull_request:
types:
- closed
Expand All @@ -17,15 +21,67 @@ jobs:
contents: write

steps:
# Check out the repository.
# Step 1: Check out the repository.
- uses: actions/checkout@v3
with:
# Check out the specific commit associated with the closed pull request.
ref: ${{ github.event.pull_request.merge_commit_sha }}
# Fetch all commit history for tags to work correctly.
fetch-depth: "0"

# Use the GitHub Tag Action to create tags.
# Step 2: Run auto-tag in dry-run mode to determine the next version of Cloney.
- name: Determine Next Version
id: determine_next_version
uses: anothrNick/[email protected]
env:
# Do not prepend the 'v' prefix to the tag.
WITH_V: false
DRY_RUN: true

# Step 3: Extract version information from the output of the previous step.
- name: Export Version Information
run: |
CLONEY_NEXT_VERSION_FULL="${{ steps.determine_next_version.outputs.new_tag }}"
CLONEY_NEXT_VERSION_MAJOR="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f1)"
CLONEY_NEXT_VERSION_MINOR="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f2)"
CLONEY_NEXT_VERSION_PATCH="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f3)"
echo "CLONEY_NEXT_VERSION_FULL=$CLONEY_NEXT_VERSION_FULL" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_MAJOR=$CLONEY_NEXT_VERSION_MAJOR" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_MINOR=$CLONEY_NEXT_VERSION_MINOR" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_PATCH=$CLONEY_NEXT_VERSION_PATCH" >> "$GITHUB_ENV"
# Step 4: Edit the versioninfo.json file to update the version.
- name: Edit versioninfo.json File
run: |
sed -i "s/\"Major\": -1/\"Major\": $CLONEY_NEXT_VERSION_MAJOR/" versioninfo.json
sed -i "s/\"Minor\": -1/\"Minor\": $CLONEY_NEXT_VERSION_MINOR/" versioninfo.json
sed -i "s/\"Patch\": -1/\"Patch\": $CLONEY_NEXT_VERSION_PATCH/" versioninfo.json
sed -i "s/\"ProductVersion\": \"X.X.X\"/\"ProductVersion\": \"$CLONEY_NEXT_VERSION_FULL\"/" versioninfo.json
if git diff --exit-code versioninfo.json; then
echo "versioninfo.json is unchanged but should have been updated."
exit 1
fi
# Step 5: Edit the pkg/config/config.go file to update the version.
- name: Edit pkg/config/config.go File
run: |
sed -i "s/AppVersion: \"X.X.X\"/AppVersion: \"$CLONEY_NEXT_VERSION_FULL\"/" pkg/config/config.go
if git diff --exit-code pkg/config/config.go; then
echo "pkg/config/config.go is unchanged but should have been updated."
exit 1
fi
# Step 6: Edit the installation/install.sh file to update the version.
- name: Edit installation/install.sh File
run: |
sed -i "s/CLONEY_VERSION=\"X.X.X\"/CLONEY_VERSION=\"$CLONEY_NEXT_VERSION_FULL\"/" installation/install.sh
if git diff --exit-code installation/install.sh; then
echo "installation/install.sh is unchanged but should have been updated."
exit 1
fi
# Step 7: Use the GitHub Tag Action to create the tag and push it to the repository.
- name: Bump Version and Push Tag.
uses: anothrNick/[email protected]
env:
Expand Down
113 changes: 89 additions & 24 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,123 @@
name: Run Automated Tests
# Workflow Name: Run Automated Tests

# Description:
# This GitHub Actions workflow is triggered when a pull request is created against the main branch
# or when a commit is pushed to the main branch. It runs automated tests for the Go application,
# and validates the build steps (e.g., building the Windows executable, creating a zip archive,
# and generating checksums) without actually releasing the application.

# Trigger when a PR is created against the main branch and when a commit is pushed to the main branch.
on:
# Trigger when a PR is created against the main branch.
pull_request:
types:
- opened
- synchronize
branches:
- main
# Trigger when a commit is pushed to the main branch.
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-22.04

steps:
# Check out the repository.
- uses: actions/checkout@v3
# Step 1: Check out the repository.
- name: Checkout Repository
uses: actions/checkout@v3

# Set up Go.
- uses: actions/setup-go@v4
# Step 2: Setup Go.
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

# Run the tests.
# Step 3: Run the tests.
- name: Run Tests
run: go test ./... -v

#
# Check if there are no errors when building the application.
# Validate auto-tagging steps.
#

# Install goversioninfo to embed properties into the Windows executable.
- name: Check Install goversioninfo
# Step 4: Run auto-tag in dry-run mode to determine the next version of Cloney.
- name: Validate Determine Next Version
id: determine_next_version
uses: anothrNick/[email protected]
env:
# Do not prepend the 'v' prefix to the tag.
WITH_V: false
DRY_RUN: true

# Step 5: Extract version information from the output of the previous step.
- name: Validate Export Version Information
run: |
go get github.com/josephspurrier/[email protected]
go install github.com/josephspurrier/goversioninfo
CLONEY_NEXT_VERSION_FULL="${{ steps.determine_next_version.outputs.new_tag }}"
CLONEY_NEXT_VERSION_MAJOR="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f1)"
CLONEY_NEXT_VERSION_MINOR="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f2)"
CLONEY_NEXT_VERSION_PATCH="$(echo $CLONEY_NEXT_VERSION_FULL | cut -d. -f3)"
# Run go generate.
- name: Check Run Go Generate
run: go generate
echo "CLONEY_NEXT_VERSION_FULL=$CLONEY_NEXT_VERSION_FULL" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_MAJOR=$CLONEY_NEXT_VERSION_MAJOR" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_MINOR=$CLONEY_NEXT_VERSION_MINOR" >> "$GITHUB_ENV"
echo "CLONEY_NEXT_VERSION_PATCH=$CLONEY_NEXT_VERSION_PATCH" >> "$GITHUB_ENV"
# Step 6: Validate Edit the versioninfo.json file to update the version.
- name: Validate Edit versioninfo.json File
run: |
sed -i "s/\"Major\": 0/\"Major\": $CLONEY_NEXT_VERSION_MAJOR/" versioninfo.json
sed -i "s/\"Minor\": 0/\"Minor\": $CLONEY_NEXT_VERSION_MINOR/" versioninfo.json
sed -i "s/\"Patch\": 0/\"Patch\": $CLONEY_NEXT_VERSION_PATCH/" versioninfo.json
sed -i "s/\"ProductVersion\": \"X.X.X\"/\"ProductVersion\": \"$CLONEY_NEXT_VERSION_FULL\"/" versioninfo.json
if git diff --exit-code versioninfo.json; then
echo "versioninfo.json is unchanged but should have been updated."
exit 1
fi
# Build the application.
- name: Build Application
run: GOOS=windows GOARCH=amd64 go build -o cloney-windows-amd64/cloney.exe
# Step 7: Validate Edit the pkg/config/config.go file to update the version.
- name: Validate Edit pkg/config/config.go File
run: |
sed -i "s/AppVersion: \"X.X.X\"/AppVersion: \"$CLONEY_NEXT_VERSION_FULL\"/" pkg/config/config.go
if git diff --exit-code pkg/config/config.go; then
echo "pkg/config/config.go is unchanged but should have been updated."
exit 1
fi
# Step 8: Validate Edit the installation/install.sh file to update the version.
- name: Validate Edit installation/install.sh File
run: |
sed -i "s/CLONEY_VERSION=\"X.X.X\"/CLONEY_VERSION=\"$CLONEY_NEXT_VERSION_FULL\"/" installation/install.sh
if git diff --exit-code installation/install.sh; then
echo "installation/install.sh is unchanged but should have been updated."
exit 1
fi
#
# Validate build steps (not actual release).
#

# Step 9: Install goversioninfo to embed properties into the Windows executable.
- name: Install goversioninfo
run: go install github.com/josephspurrier/goversioninfo/cmd/[email protected]

# Step 10: Validate building the application for Windows.
- name: Validate Build for Windows
run: |
goversioninfo -64
stat resource.syso
GOOS=windows GOARCH=amd64 go build -o cloney-windows-amd64/cloney.exe
rm -f resource.syso
# Zip the application.
- name: Check Zip Application
# Step 11: Validate creating a zip archive.
- name: Validate Zip Application
run: zip -r cloney-windows-amd64.zip cloney-windows-amd64

# Generate checksum for the application.
- name: Check Generate Checksums
# Step 12: Validate generating checksum for the application.
- name: Validate Generate Checksums
run: sha256sum cloney-windows-amd64.zip > cloney-windows-amd64-checksum.sha256

# Check if the checksum matches.
- name: Check Checksum Matches
# Step 13: Validate checksum matches.
- name: Validate Checksum Matches
run: sha256sum -c cloney-windows-amd64-checksum.sha256
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

This document lists all significant changes to the Cloney project, following [Keep a Changelog](http://keepachangelog.com/) and adhering to [Semantic Versioning](http://semver.org/).

## (Minor) Cloney 1.1.0 - 2023-12-13

### Added

- No new features were added in this release.

### Changed

- No changes were made in this release.

TODO...

### Fixed

- Addressed an issue where executing the `dry-run` command with the `--hot-reload, -r` flag occasionally failed to wait for the variables file to be saved before initiating the template reload.

## (Major) Cloney 1.0.0 - 2023-12-06

### Added
Expand Down
Loading

0 comments on commit 2782dbe

Please sign in to comment.