Skip to content

Commit

Permalink
Update go1.24 (#227)
Browse files Browse the repository at this point in the history
* remove codeql.yml

* update go and dependencies

* update actions

* Add changlog releaser. Update changelog. Update docs.

* fix lint config
  • Loading branch information
funkyshu authored Feb 19, 2025
1 parent c423c97 commit 3344399
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 336 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
Expand All @@ -15,7 +12,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '^1.23.0'
go-version: '^1.24.0'
cache: false
- name: Checkout code
uses: actions/checkout@v4
Expand Down
107 changes: 0 additions & 107 deletions .github/workflows/codeql.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/ensure_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CHANGELOG.md Check
on:
pull_request:
branches:
- main
jobs:
verify_changelog_job:
runs-on: ubuntu-latest
name: Did CHANGELOG.md change?
steps:
- name: checkout
uses: actions/checkout@v4
- name: fetch
run: git fetch
- name: run changelog.sh
run: 'bash ${GITHUB_WORKSPACE}/.github/workflows/scripts/changelog.sh'
5 changes: 1 addition & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Go

on:
push:
branches:
- main
pull_request:
branches:
- main
Expand All @@ -13,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [1.22, 1.23]
go-version: [1.23, 1.24]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
Expand All @@ -13,7 +8,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '^1.23.0'
go-version: '^1.24.0'
cache: false
- uses: actions/checkout@v4
- name: golangci-lint
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/release-by-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release by Changelog

on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to create a release from'
required: true
default: 'main'
version:
description: 'Specify the semantic version for the release (vX.Y.Z)'
required: true
reason:
description: 'Reason for the manual release'
required: false

jobs:
release:
runs-on: ubuntu-latest

env:
GOPROXY: proxy.golang.org,direct
GOPRIVATE: github.com/c2fo,github.com/C2FO
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref_name }}
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24

- name: Install and run ReleaseGen
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REF_NAME: ${{ github.event.inputs.branch || github.ref_name }}
MANUAL_VERSION: ${{ github.event.inputs.version || '' }}
REASON: ${{ github.event.inputs.reason || '' }}
CUSTOM_CHANGE_TYPES: |
documentation:patch
run: |
git config --global url."https://c2fo-read-only:${{ secrets.GH_CI_READ }}@github.com/c2fo".insteadOf "https://github.com/c2fo"
go install github.com/c2fo/ep-tools/releasegen@latest
releasegen
36 changes: 36 additions & 0 deletions .github/workflows/scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Find all directories containing a CHANGELOG.md file
changelogDirs=$(find . -type f -name 'CHANGELOG.md' -exec dirname {} \;)

# Check each directory for changes and ensure CHANGELOG.md is updated
for dir in $changelogDirs; do
echo "Checking directory: $dir"

# Check if there are any changes in the directory
dirChanges=$(git --no-pager diff -w --numstat origin/main -- $dir | wc -l)
if [[ "$dirChanges" -gt 0 ]]; then
echo "Changes detected in $dir"

# Check if CHANGELOG.md has been modified
changelogMod=$(git --no-pager diff -w --numstat origin/main -- $dir/CHANGELOG.md)
if [[ -z "$changelogMod" ]]; then
echo "CHANGELOG.md in $dir has not been modified. Please update it with your changes before merging to main."
exit 1
else
echo "CHANGELOG.md in $dir has been modified. Verifying at least 1 (non-whitespace) line has been added."
changelogLines=$(echo "$changelogMod" | awk '{print $1}')
if [[ "$changelogLines" -lt 1 ]]; then
echo "Didn't detect any substantial changes to CHANGELOG.md in $dir."
exit 1
else
echo "Detected '$changelogLines' new non-whitespace lines in CHANGELOG.md in $dir. Thanks +1"
fi
fi
else
echo "No changes detected in $dir"
fi
done

echo "All directories with changes have updated CHANGELOG.md files."
exit 0
Loading

0 comments on commit 3344399

Please sign in to comment.