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

Update repository #497

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Update repository #497

merged 1 commit into from
Sep 16, 2024

Conversation

Danielius1922
Copy link
Member

@Danielius1922 Danielius1922 commented Sep 12, 2024

  • upgrade go to 1.23
  • upgrade github runners to ubuntu:24.04
  • use golangsci-lint v1.61

Upgrade dependencies

Direct:
github.com/go-json-experiment/json v0.0.0-20240815175050-ebd3a8989ca1 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 google.golang.org/grpc v1.66.2

Indirect:
golang.org/x/crypto v0.27.0
golang.org/x/net v0.29.0
golang.org/x/sys v0.25.0

Summary by CodeRabbit

  • New Features

    • Upgraded the Go programming language requirement to version 1.23 across various workflows and configurations.
    • Updated the base image for Dockerfiles to use Go 1.23.1-alpine.
  • Bug Fixes

    • Improved compatibility and performance by updating dependencies to their latest versions.
  • Documentation

    • Revised the README to reflect the new Go version requirement.
  • Chores

    • Updated GitHub Actions workflows to use Ubuntu 24.04 for enhanced environment stability and performance.

Copy link

coderabbitai bot commented Sep 12, 2024

Walkthrough

The changes involve updates to several GitHub Actions workflow files and configuration files, primarily focusing on upgrading the environment from ubuntu-latest to ubuntu-24.04 and updating the Go programming language version from 1.22 to 1.23. These modifications affect the build, publish, linting, and testing processes, ensuring compatibility with newer features and dependencies. Additionally, the go.mod file reflects updated dependencies and versions, aligning with the overall enhancements made throughout the project.

Changes

File Path Change Summary
.github/workflows/build-publish-cfg.yaml Updated runs-on from ubuntu-latest to ubuntu-24.04.
.github/workflows/build-with-cfg.yml Updated runs-on from ubuntu-latest to ubuntu-24.04, go-version from ^1.22 to ^1.23.
.github/workflows/builds.yml Updated go-version from ~1.22 to ~1.23.
.github/workflows/ghcr-cleanup.yaml Updated runs-on from ubuntu-latest to ubuntu-24.04 for two jobs.
.github/workflows/golangci-lint.yml Updated runs-on from ubuntu-latest to ubuntu-24.04, go-version from ^1.22 to ^1.23, and set version to v1.61.
.github/workflows/test-with-cfg.yml Updated runs-on from ubuntu-latest to ubuntu-24.04, go-version from ^1.22 to ^1.23.
.golangci.yml Removed github.com/go-json-experiment/json from replace-allow-list, updated go version from "1.22" to "1.23".
README.md Updated Go version requirement from "1.22 or higher" to "1.23 or higher".
cmd/bridge-device/Dockerfile Changed base image from golang:1.22.3-alpine to golang:1.23.1-alpine.
go.mod Updated Go version from 1.22 to 1.23, along with various dependency updates.
test/cloud-server/Dockerfile Changed base image from golang:1.22.3-alpine to golang:1.23.1-alpine, modified package installation order.

Possibly related PRs

  • Upgrade dependencies #480: Updates the runs-on attribute in the .github/workflows/build-publish-cfg.yaml file, directly related to the main PR.
  • Upgrade dependencies #477: Modifies the go-version in the .github/workflows/golangci-lint.yml file, indicating a related update in the Go version.
  • Upgrade dependencies #488: Updates the go.mod file to reflect changes in the Go version and dependencies, relevant to the overall environment changes.
  • Upgrade dependencies #496: Includes updates to the go.mod file for github.com/go-json-experiment/json, related to dependency management.

🐰 In the garden, changes bloom,
A hop of joy, dispelling gloom.
From 22 to 23 we leap,
In code and workflows, promises we keep.
Ubuntu's new, a fresh delight,
With every build, our future's bright! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.78%. Comparing base (4a23043) to head (7b4fa91).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #497   +/-   ##
=======================================
  Coverage   76.78%   76.78%           
=======================================
  Files         122      122           
  Lines        7236     7236           
=======================================
  Hits         5556     5556           
  Misses       1090     1090           
  Partials      590      590           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Danielius1922
Copy link
Member Author

Danielius1922 commented Sep 12, 2024

Waiting for go1.23 support in CodeQL github/codeql-action#2467

- upgrade go to 1.23
- upgrade github runners to ubuntu:24.04
- use golangsci-lint v1.61

Upgrade dependencies

Direct:
github.com/go-json-experiment/json v0.0.0-20240815175050-ebd3a8989ca1
github.com/plgd-dev/go-coap/v3 v3.3.5
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
google.golang.org/grpc v1.66.2

Indirect:
github.com/pion/dtls/v3 v3.0.2
golang.org/x/crypto v0.27.0
golang.org/x/net v0.29.0
golang.org/x/sys v0.25.0
@Danielius1922 Danielius1922 force-pushed the adam/feature/update-deps branch from acfea60 to 7b4fa91 Compare September 14, 2024 13:01
@Danielius1922 Danielius1922 marked this pull request as ready for review September 14, 2024 13:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
.github/workflows/golangci-lint.yml (1)

31-31: Consider updating to the latest stable version in the future.

Using a specific, stable version of golangci-lint is a good practice to ensure consistency and reproducibility of the linting process across different environments and runs.

It's important to keep an eye on the development status of golangci-lint and consider upgrading to the latest stable version when it becomes available to take advantage of new features and improvements. You can use the following script to check for updates periodically:

#!/bin/bash
# Description: Check for updates to golangci-lint.

# Get the current version
current_version=$(grep -oP 'version: \K.*' .github/workflows/golangci-lint.yml)

# Get the latest stable version
latest_version=$(curl -s https://api.github.com/repos/golangci/golangci-lint/releases/latest | grep -oP '"tag_name": "\K.*?(?=")')

# Compare versions
if [ "$current_version" != "$latest_version" ]; then
  echo "A new version of golangci-lint is available: $latest_version"
else
  echo "You are using the latest version of golangci-lint: $current_version"
fi
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4a23043 and 7b4fa91.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (11)
  • .github/workflows/build-publish-cfg.yaml (1 hunks)
  • .github/workflows/build-with-cfg.yml (1 hunks)
  • .github/workflows/builds.yml (1 hunks)
  • .github/workflows/ghcr-cleanup.yaml (2 hunks)
  • .github/workflows/golangci-lint.yml (2 hunks)
  • .github/workflows/test-with-cfg.yml (1 hunks)
  • .golangci.yml (1 hunks)
  • README.md (1 hunks)
  • cmd/bridge-device/Dockerfile (1 hunks)
  • go.mod (3 hunks)
  • test/cloud-server/Dockerfile (1 hunks)
Files skipped from review due to trivial changes (1)
  • test/cloud-server/Dockerfile
Additional comments not posted (21)
.github/workflows/builds.yml (1)

20-21: LGTM!

The update to Go version 1.23 in the build matrix is a positive change that aligns with the overall objective of the pull request. Upgrading to a newer minor version of Go can provide benefits such as improved features, performance enhancements, or security updates.

The change is straightforward and does not introduce any issues or potential problems.

.github/workflows/build-with-cfg.yml (2)

18-18: LGTM!

The update to use ubuntu-24.04 as the runner ensures consistency and aligns with the PR objective of updating the GitHub runners to use Ubuntu 24.04.


26-26: LGTM!

Updating the go-version to ^1.23 ensures the usage of Go 1.23 and aligns with the PR objective of upgrading the Go programming language to version 1.23.

.github/workflows/golangci-lint.yml (2)

22-22: Verify compatibility with Go 1.23.

Upgrading to Go 1.23 is a good practice to ensure access to the latest language features, performance optimizations, and security enhancements.

Please ensure that all project code and dependencies are compatible with Go 1.23 to avoid any potential issues. You can run the following script to check the compatibility of the project's code and dependencies:

Verification successful

Go 1.23 compatibility confirmed.

The upgrade to Go 1.23 has been properly implemented across the project:

  • The go.mod file specifies go 1.23 and toolchain go1.23.0.
  • The CI/CD configuration in .github/workflows/golangci-lint.yml has been updated to use Go 1.23+.

Given the project's structure, extensive test files, and use of golangci-lint in CI, it's likely that compatibility has been thoroughly verified during the upgrade process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of project code and dependencies with Go 1.23.

# Test 1: Check if the project's Go code is compatible with Go 1.23. Expect: No compatibility issues found.
go run -tags=go1.23 ./...

# Test 2: Check if the project's dependencies are compatible with Go 1.23. Expect: No compatibility issues found.
go mod tidy
go mod verify

Length of output: 267


Script:

#!/bin/bash

# Search for Go-related files
echo "Searching for Go-related files:"
fd -e go -e mod -e sum

# Check contents of go.mod if it exists
echo -e "\nContents of go.mod (if exists):"
cat go.mod 2>/dev/null || echo "go.mod not found"

# List all .go files
echo -e "\nListing all .go files:"
fd -e go

# Check for CI/CD configuration files
echo -e "\nChecking for CI/CD configuration files:"
fd -e yml -e yaml -p 'workflow|ci|cd' .github/workflows

# Display contents of golangci-lint.yml
echo -e "\nContents of .github/workflows/golangci-lint.yml:"
cat .github/workflows/golangci-lint.yml

Length of output: 17786


14-14: Verify compatibility with Ubuntu 24.04.

Upgrading to a newer version of Ubuntu is a good practice to ensure access to the latest features, security patches, and performance improvements.

Please ensure that all project dependencies and tools are compatible with Ubuntu 24.04 to avoid any potential issues. You can run the following script to check the compatibility of the project's dependencies:

cmd/bridge-device/Dockerfile (1)

2-2: Approve the update to the base image version, but verify compatibility.

Updating the base image to golang:1.23.1-alpine is a good step to leverage the latest features, optimizations, and bug fixes in Go 1.23.1. However, it's crucial to ensure that the application and its dependencies are fully compatible with this newer version of Go.

Please run comprehensive tests and perform thorough verification to confirm that the application builds successfully and functions as expected with Go 1.23.1. Pay special attention to any third-party libraries or dependencies that might have version constraints or compatibility issues.

README.md (1)

19-19: Verify compatibility and thoroughly test the changes.

Updating the Go version requirement is a significant change that can impact the project's compatibility and functionality. It's crucial to ensure that the codebase and all dependencies are compatible with Go 1.23.

Please make sure to:

  1. Run all unit tests and integration tests with Go 1.23 to identify any potential issues or breaking changes.
  2. Verify that all dependencies support Go 1.23. Update any incompatible dependencies to their latest compatible versions.
  3. Perform thorough manual testing to ensure that the project functions as expected with the new Go version.
go.mod (7)

5-5: LGTM!

The toolchain version update aligns with the Go version update.


10-10: Approve dependency update.

Updating the github.com/go-json-experiment/json dependency to a newer version is a good practice.

Please review the changelog at https://github.com/go-json-experiment/json/releases to understand the changes and their potential impact on the codebase.


19-19: LGTM!

Using a specific version without a timestamp for the github.com/plgd-dev/go-coap/v3 dependency is a good practice for reproducibility and stability.


25-25: Approve dependency update.

Updating the golang.org/x/exp dependency to a newer version is a good practice.

Please review the changelog at https://github.com/golang/exp/releases to understand the changes and their potential impact on the codebase.


27-27: Approve dependency update.

Updating the google.golang.org/grpc dependency to version v1.66.2 is a good practice.

Please review the changelog at https://github.com/grpc/grpc-go/releases to understand the changes and their potential impact on the codebase.


39-41: Acknowledge indirect dependency updates.

The updates to the indirect dependencies golang.org/x/crypto, golang.org/x/net, and golang.org/x/sys are a result of updating the direct dependencies.

Please ensure that the updated versions of the indirect dependencies are compatible with the codebase by running tests and performing thorough testing.


3-3: Approve Go version update.

Updating to Go 1.23 is a good move to leverage the latest features and improvements.

Please ensure that the entire codebase is compatible with Go 1.23 and that all tests pass. Run the following script to verify:

Verification successful

Approve Go 1.23 update and recommend verification steps.

The update to Go 1.23 is appropriate and aligns with the project's configuration. The go.mod file and CI/CD settings confirm Go 1.23+ usage.

To verify compatibility:

  1. Use the Makefile for building and testing:

    make build
    make test
    
  2. Run linting to catch any potential issues:

    golangci-lint run
    
  3. If possible, run the CI/CD tests locally or in a similar environment to ensure full compatibility.

These steps will provide comprehensive verification of the Go 1.23 update across the project.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Go 1.23 compatibility and run tests.

# Test: Check Go version. Expect: Go 1.23.x.
go version

# Test: Build the project. Expect: Successful build.
go build ./...

# Test: Run tests. Expect: All tests pass.
go test ./...

Length of output: 256


Script:

#!/bin/bash
# Description: Investigate project structure and build setup

# Check for Dockerfile
echo "Checking for Dockerfile:"
fd Dockerfile

# Check for CI/CD configuration files
echo "Checking for CI/CD configuration files:"
fd -e yml -e yaml

# Check for build or test related files
echo "Checking for build or test related files:"
fd Makefile
fd -e sh

# Check content of go.mod file
echo "Content of go.mod file:"
cat go.mod

# Check for README or other documentation
echo "Checking for README or other documentation:"
fd README -e md

# List root directory contents
echo "Root directory contents:"
ls -la

Length of output: 3788


Script:

#!/bin/bash
# Description: Investigate build and test procedures

# Check Makefile for build and test commands
echo "Makefile build and test commands:"
grep -E '(build|test):' Makefile

# Check README.md for build/test instructions
echo "README.md build/test instructions:"
grep -i -A 5 -E '(build|test|install)' README.md

# Check CI/CD configuration
echo "CI/CD configuration:"
cat .github/workflows/*.yml

# List Docker-related files
echo "Docker-related files:"
fd Dockerfile
fd docker-compose

# Check for any custom build or test scripts
echo "Custom build/test scripts:"
fd -e sh

Length of output: 9746

.github/workflows/test-with-cfg.yml (2)

35-35: LGTM!

The upgrade from ubuntu-latest to ubuntu-24.04 aligns with the PR objective of updating the GitHub runners to use Ubuntu 24.04. This change ensures compatibility with the latest features and improvements available in the newer Ubuntu version.


43-43: LGTM!

The update from Go version 1.22 to 1.23 aligns with the PR objective of upgrading the Go programming language to version 1.23. This change ensures that the workflow utilizes the latest features and improvements available in Go 1.23, which may enhance performance or introduce new functionalities.

Setting check-latest to true is a good practice to ensure that the latest patch version of Go 1.23 is used during the setup, providing access to the most recent bug fixes and improvements.

.github/workflows/ghcr-cleanup.yaml (2)

13-13: Verify compatibility of snok/container-retention-policy action with ubuntu-24.04.

The runner update from ubuntu-latest to ubuntu-24.04 looks good. However, please ensure that the snok/container-retention-policy action used in this job is compatible with ubuntu-24.04.


54-54: Verify compatibility of ./.github/actions/cleanup-stale action with ubuntu-24.04.

The runner update from ubuntu-latest to ubuntu-24.04 looks good. However, please ensure that the local action ./.github/actions/cleanup-stale used in this job is compatible with ubuntu-24.04.

.github/workflows/build-publish-cfg.yaml (1)

30-30: Approve the change to a specific Ubuntu version.

Updating the runs-on attribute to use a specific Ubuntu version (ubuntu-24.04) is a good practice for better control and reproducibility of the build environment.

Please ensure that all dependencies, libraries, and tools used in this workflow are compatible with Ubuntu 24.04. You can verify this by running the following script:

This script performs the following checks:

  1. Searches for Dockerfile(s) and verifies that the base image is compatible with Ubuntu 24.04.
  2. Searches for the usage of the actions/setup-go action and verifies that the version supports Go 1.23.

If any incompatibilities are found, the script will exit with an error message. Otherwise, it will indicate that the compatibility check completed successfully.

Verification successful

Confirm ubuntu-24.04 runner compatibility

The change to ubuntu-24.04 for the runs-on attribute is acceptable. Our compatibility check found no direct incompatibilities with this Ubuntu version.

For context:

  • The project uses Alpine-based images (golang:1.23.1-alpine and alpine:3.20) in its Dockerfiles, which is common for containerized environments and doesn't conflict with the GitHub Actions runner OS.
  • No setup-go action usage was detected, suggesting Go setup might be handled differently in this project.

While no issues were found, it's recommended to monitor the initial workflow runs with this new runner to ensure smooth operation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description: Verify compatibility of dependencies, libraries, and tools with Ubuntu 24.04.

# Test: Search for Dockerfile(s) and check the base image.
# Expect: The base image should be compatible with Ubuntu 24.04.
dockerfile_files=$(fd Dockerfile)
for file in $dockerfile_files; do
  echo "Checking Dockerfile: $file"
  base_image=$(awk '/^FROM/{print $2}' "$file")
  echo "Base image: $base_image"
  
  if [[ $base_image == *"ubuntu"* ]]; then
    ubuntu_version=$(echo "$base_image" | awk -F: '{print $2}')
    if [[ "$ubuntu_version" != "24.04" ]]; then
      echo "::error::Incompatible Ubuntu version in Dockerfile: $file. Expected 24.04, found $ubuntu_version."
      exit 1
    fi
  fi
  echo "----"
done

# Test: Search for setup-go action usage and check the version.
# Expect: The setup-go action version should support Go 1.23.
setup_go_action_files=$(rg --type yaml -l $'uses: actions/setup-go@')
for file in $setup_go_action_files; do
  echo "Checking setup-go action in file: $file"
  setup_go_version=$(awk '/uses: actions\/setup-go@/{getline; print}' "$file" | awk -F@ '{print $NF}')
  echo "setup-go action version: $setup_go_version"

  if [[ "$setup_go_version" < "v4" ]]; then
    echo "::error::Incompatible setup-go action version in file: $file. Expected v4 or higher to support Go 1.23, found $setup_go_version."
    exit 1
  fi  
  echo "----"
done

echo "Compatibility check completed successfully."

Length of output: 1136

.golangci.yml (2)

Line range hint 12-13: LGTM!

Removing github.com/go-json-experiment/json from the replace-allow-list is a good change. It ensures that the original module is used instead of any replacements, aligning with the best practice of using original modules whenever possible.


161-161: Verify that the project's Go version is also updated to 1.23.

Updating the Go version in the golangci-lint configuration to 1.23 is a good change. It ensures that the linting process uses the latest stable release of Go, which includes various improvements and new features.

Please make sure that the project's Go version is also updated to 1.23 to maintain consistency and avoid potential incompatibilities.

To verify the project's Go version, you can run the following command in the project's root directory:

The output should show Go version 1.23.x.

Verification successful

Go version 1.23 confirmed in project's go.mod file

The update of the Go version to 1.23 in the .golangci.yml file is consistent with the project's actual Go version. The go.mod file, which is the authoritative source for Go version in a project, specifies:

go 1.23

This confirms that the project and the golangci-lint configuration are aligned, using Go version 1.23. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

go version

Length of output: 82


Script:

#!/bin/bash

# Search for go.mod file and extract Go version if present
echo "Searching for go.mod file:"
fd -t f -e mod -x cat {} | grep -E "^go [0-9]+\.[0-9]+"

# Search for .go files with potential Go version comments
echo -e "\nSearching for .go files with version comments:"
rg -t go "// \+build go[0-9]+\.[0-9]+" -g "!vendor/**"

# Look for CI/CD configuration files
echo -e "\nSearching for CI/CD configuration files:"
fd -t f "\.github/workflows" -x cat {}

# Check for any other files that might indicate Go version
echo -e "\nSearching for other files that might indicate Go version:"
rg -i "go version" -g "!vendor/**" -g "!*.mod" -g "!*.go"

Length of output: 627

Copy link

@Danielius1922 Danielius1922 merged commit a42e836 into main Sep 16, 2024
15 checks passed
@Danielius1922 Danielius1922 deleted the adam/feature/update-deps branch September 16, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants