mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-01 19:47:37 +03:00
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:
parent
d8e1748928
commit
7167e5ac87
7 changed files with 31 additions and 54 deletions
|
@ -4,10 +4,10 @@
|
||||||
"dockerfile": "Dockerfile",
|
"dockerfile": "Dockerfile",
|
||||||
"args": {
|
"args": {
|
||||||
// Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14
|
// Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14
|
||||||
"VARIANT": "1.21",
|
"VARIANT": "1.22",
|
||||||
// Options
|
// Options
|
||||||
"INSTALL_NODE": "true",
|
"INSTALL_NODE": "true",
|
||||||
"NODE_VERSION": "v18"
|
"NODE_VERSION": "v20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"workspaceMount": "",
|
"workspaceMount": "",
|
||||||
|
|
52
.github/workflows/pipeline.yml
vendored
52
.github/workflows/pipeline.yml
vendored
|
@ -19,15 +19,15 @@ jobs:
|
||||||
- name: Install taglib
|
- name: Install taglib
|
||||||
run: sudo apt-get install libtag1-dev
|
run: sudo apt-get install libtag1-dev
|
||||||
|
|
||||||
- name: Set up Go 1.21
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -51,7 +51,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go_version: [1.21.x, 1.20.x]
|
go_version: [1.22.x, 1.21.x]
|
||||||
steps:
|
steps:
|
||||||
- name: Update ubuntu repo
|
- name: Update ubuntu repo
|
||||||
run: sudo apt-get update
|
run: sudo apt-get update
|
||||||
|
@ -60,10 +60,10 @@ jobs:
|
||||||
run: sudo apt-get install libtag1-dev ffmpeg
|
run: sudo apt-get install libtag1-dev ffmpeg
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go ${{ matrix.go_version }}
|
- name: Set up Go ${{ matrix.go_version }}
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go_version }}
|
go-version: ${{ matrix.go_version }}
|
||||||
cache: true
|
cache: true
|
||||||
|
@ -83,10 +83,10 @@ jobs:
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
cache-dependency-path: "**/package-lock.json"
|
cache-dependency-path: "**/package-lock.json"
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ jobs:
|
||||||
cd ui
|
cd ui
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: js-bundle
|
name: js-bundle
|
||||||
path: ui/build
|
path: ui/build
|
||||||
|
@ -122,17 +122,17 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: js-bundle
|
name: js-bundle
|
||||||
path: ui/build
|
path: ui/build
|
||||||
|
|
||||||
- name: Config /github/workspace folder as trusted
|
- 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:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
@ -140,7 +140,7 @@ jobs:
|
||||||
|
|
||||||
- name: Run GoReleaser - SNAPSHOT
|
- name: Run GoReleaser - SNAPSHOT
|
||||||
if: startsWith(github.ref, 'refs/tags/') != true
|
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:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
@ -148,13 +148,13 @@ jobs:
|
||||||
|
|
||||||
- name: Run GoReleaser - RELEASE
|
- name: Run GoReleaser - RELEASE
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
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:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
args: goreleaser release --clean
|
args: goreleaser release --clean
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: binaries
|
name: binaries
|
||||||
path: |
|
path: |
|
||||||
|
@ -172,18 +172,18 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
id: qemu
|
id: qemu
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v4
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
with:
|
with:
|
||||||
name: binaries
|
name: binaries
|
||||||
|
@ -191,14 +191,14 @@ jobs:
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
@ -207,7 +207,7 @@ jobs:
|
||||||
- name: Extract metadata for Docker
|
- name: Extract metadata for Docker
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
labels: |
|
labels: |
|
||||||
maintainer=deluan
|
maintainer=deluan
|
||||||
|
@ -221,7 +221,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
if: env.DOCKER_IMAGE != ''
|
if: env.DOCKER_IMAGE != ''
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: .github/workflows/pipeline.dockerfile
|
file: .github/workflows/pipeline.dockerfile
|
||||||
|
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
||||||
v18
|
v20
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -9,7 +9,7 @@ GIT_SHA=source_archive
|
||||||
GIT_TAG=$(patsubst navidrome-%,v%,$(notdir $(PWD)))
|
GIT_TAG=$(patsubst navidrome-%,v%,$(notdir $(PWD)))
|
||||||
endif
|
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
|
setup: check_env download-deps setup-git ##@1_Run_First Install dependencies and prepare development environment
|
||||||
@echo Downloading Node dependencies...
|
@echo Downloading Node dependencies...
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
//go:build go1.21
|
|
||||||
|
|
||||||
package scanner
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
)
|
|
||||||
|
|
||||||
func contextWithoutCancel(ctx context.Context) context.Context {
|
|
||||||
return context.WithoutCancel(ctx)
|
|
||||||
}
|
|
|
@ -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()
|
|
||||||
}
|
|
|
@ -178,7 +178,7 @@ func (s *scanner) setStatusEnd(folder string, lastUpdate time.Time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *scanner) RescanAll(ctx context.Context, fullRescan bool) error {
|
func (s *scanner) RescanAll(ctx context.Context, fullRescan bool) error {
|
||||||
ctx = contextWithoutCancel(ctx)
|
ctx = context.WithoutCancel(ctx)
|
||||||
if !isScanning.TryLock() {
|
if !isScanning.TryLock() {
|
||||||
log.Debug(ctx, "Scanner already running, ignoring request for rescan.")
|
log.Debug(ctx, "Scanner already running, ignoring request for rescan.")
|
||||||
return ErrAlreadyScanning
|
return ErrAlreadyScanning
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue