Upgrade to Go 1.22 and Node v20 (#2861)

* Remove workaround for missing `context.WithoutCancel` in Go 1.20

* Upgrade to Go 1.22

* Upgrade GitHub Actions

* Upgrade Node to v20
This commit is contained in:
Deluan Quintão 2024-02-16 20:29:16 -05:00 committed by GitHub
parent d8e1748928
commit 7167e5ac87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 31 additions and 54 deletions

View File

@ -4,10 +4,10 @@
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14
"VARIANT": "1.21",
"VARIANT": "1.22",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "v18"
"NODE_VERSION": "v20"
}
},
"workspaceMount": "",

View File

@ -19,15 +19,15 @@ jobs:
- name: Install taglib
run: sudo apt-get install libtag1-dev
- name: Set up Go 1.21
uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.21.x, 1.20.x]
go_version: [1.22.x, 1.21.x]
steps:
- name: Update ubuntu repo
run: sudo apt-get update
@ -60,10 +60,10 @@ jobs:
run: sudo apt-get install libtag1-dev ffmpeg
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
cache: true
@ -83,10 +83,10 @@ jobs:
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "npm"
cache-dependency-path: "**/package-lock.json"
@ -110,7 +110,7 @@ jobs:
cd ui
npm run build
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: js-bundle
path: ui/build
@ -122,17 +122,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: js-bundle
path: ui/build
- name: Config /github/workspace folder as trusted
uses: docker://deluan/ci-goreleaser:1.21.5-1
uses: docker://deluan/ci-goreleaser:1.22.0-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@ -140,7 +140,7 @@ jobs:
- name: Run GoReleaser - SNAPSHOT
if: startsWith(github.ref, 'refs/tags/') != true
uses: docker://deluan/ci-goreleaser:1.21.5-1
uses: docker://deluan/ci-goreleaser:1.22.0-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@ -148,13 +148,13 @@ jobs:
- name: Run GoReleaser - RELEASE
if: startsWith(github.ref, 'refs/tags/')
uses: docker://deluan/ci-goreleaser:1.21.5-1
uses: docker://deluan/ci-goreleaser:1.22.0-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: goreleaser release --clean
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: binaries
path: |
@ -172,18 +172,18 @@ jobs:
steps:
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
if: env.DOCKER_IMAGE != ''
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
if: env.DOCKER_IMAGE != ''
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: env.DOCKER_IMAGE != ''
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
if: env.DOCKER_IMAGE != ''
with:
name: binaries
@ -191,14 +191,14 @@ jobs:
- name: Login to Docker Hub
if: env.DOCKER_IMAGE != ''
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
if: env.DOCKER_IMAGE != ''
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -207,7 +207,7 @@ jobs:
- name: Extract metadata for Docker
if: env.DOCKER_IMAGE != ''
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
labels: |
maintainer=deluan
@ -221,7 +221,7 @@ jobs:
- name: Build and Push
if: env.DOCKER_IMAGE != ''
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: .github/workflows/pipeline.dockerfile

2
.nvmrc
View File

@ -1 +1 @@
v18
v20

View File

@ -9,7 +9,7 @@ GIT_SHA=source_archive
GIT_TAG=$(patsubst navidrome-%,v%,$(notdir $(PWD)))
endif
CI_RELEASER_VERSION=1.21.5-1 ## https://github.com/navidrome/ci-goreleaser
CI_RELEASER_VERSION=1.22.0-1 ## https://github.com/navidrome/ci-goreleaser
setup: check_env download-deps setup-git ##@1_Run_First Install dependencies and prepare development environment
@echo Downloading Node dependencies...

View File

@ -1,11 +0,0 @@
//go:build go1.21
package scanner
import (
"context"
)
func contextWithoutCancel(ctx context.Context) context.Context {
return context.WithoutCancel(ctx)
}

View File

@ -1,12 +0,0 @@
//go:build !go1.21
package scanner
import (
"context"
)
// TODO Remove this file when we drop support for go 1.20
func contextWithoutCancel(ctx context.Context) context.Context {
return context.TODO()
}

View File

@ -178,7 +178,7 @@ func (s *scanner) setStatusEnd(folder string, lastUpdate time.Time) {
}
func (s *scanner) RescanAll(ctx context.Context, fullRescan bool) error {
ctx = contextWithoutCancel(ctx)
ctx = context.WithoutCancel(ctx)
if !isScanning.TryLock() {
log.Debug(ctx, "Scanner already running, ignoring request for rescan.")
return ErrAlreadyScanning