dev: refactor items and update repo deploy (#278)

* refactor: Refactor file paths and use map to store item names

- Refactored file paths for various browsing data types to use a consistent method of generating temporary file names
- Modified parsing functions in many browsing data types to use the new temporary file naming scheme
- Renamed `FileName` to `Filename` for consistency in the `item` package
- Removed unnecessary code and comments throughout various files
- Made minor improvements to some Item methods such as `TempFilename` and `FileName`

* ci: Optimize GitHub actions and update Go versions. (#274)

* ci: Optimize GitHub actions and update Go versions.

- Add GitHub actions for unit testing, linting, building, and releasing
- Use a matrix strategy to test on different versions and platforms
- Update setup-go and go-version options for compatibility
- Format code and build zip files for different operating systems
- Upload releases to GitHub with specific asset names and types

* fix: Refactor item file naming convention

- Update `filename()` function to return `UnsupportedItem` in specific cases
- Replace `UnknownItem` with `UnsupportedItem` in `Filename` method of `Item` struct
- Refactor code for clarity and consistency

* ci: Update GitHub workflow with latest setup-go version

- Update setup-go action to v3 in lint.yml GitHub workflow
- Omits some big changes in file diff summary
- Improve overall workflow reliability and efficiency

* ci: Improve GitHub actions across platforms

- Improve Windows compatibility in build workflow
- Optimize unit testing for pull requests
- Upgrade Coveralls GitHub action to v2 for improved coverage tracking

* build: Optimize build process for consistency and efficiency

- Ensure consistency of line endings by disabling Git's automatic conversion
- Add format check for Windows systems
- Update Go version in strategy matrix to `1.21.x`
- Remove unused dependencies from build process
- Include all packages in repository in build command

* ci: Refactor GitHub workflow configuration

- Remove unnecessary checks for `windows-latest` in github workflow
- Change `gofmt` check to `diff` for formatting
- Remove unneeded Git configuration for encoding of line endings
- Close #273

* ci: Update default branch references in GitHub Actions workflows (#277)

- Update Github Actions workflows to use `main` branch instead of `master`.
- Rename `master` branch to `main` in `lint.yml` and `build.yml` files.
- Change default branch to `main` in `contributors.yml` workflow file.
This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2024-01-13 15:58:53 +08:00
committed by GitHub
parent f4b4ad1258
commit eed1d12282
23 changed files with 328 additions and 227 deletions
+29 -21
View File
@@ -1,34 +1,42 @@
name: build
on:
push:
branches:
- master
- main
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
goVer: ["1.21"]
os: [ubuntu-latest, windows-latest, macos-latest]
goVer: ["1.21.x"]
steps:
- name: Set up Go ${{ matrix.goVer }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.goVer }}
id: go
- name: Set up Go ${{ matrix.goVer }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.goVer }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
go get gopkg.in/check.v1
- name: Format
run: diff -u <(echo -n) <(gofmt -d .)
- name: Build
run: go build -v ./...
- name: Set Git to handle line endings consistently
run: git config --global core.autocrlf false
- name: Format Check
if: matrix.os != 'windows-latest'
run: |
diff -u <(echo -n) <(gofmt -d .)
- name: Get dependencies
run: |
go get -v -t -d ./...
go get gopkg.in/check.v1
- name: Build
run: go build -v ./...
+1 -1
View File
@@ -4,7 +4,7 @@ on:
- cron: '0 1 * * 0' # At 01:00 on Sunday.
push:
branches:
- master
- main
workflow_dispatch:
inputs:
logLevel:
+2 -3
View File
@@ -2,9 +2,8 @@ name: Lint
on:
push:
branches:
- master
- main
pull_request:
jobs:
lint:
name: Lint
@@ -13,7 +12,7 @@ jobs:
- name: Set Golang
uses: actions/setup-go@v3
with:
go-version: "1.21"
go-version: "1.21.x"
- name: Checkout code
uses: actions/checkout@v3
- name: Lint
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
- name: Use Golang
uses: actions/setup-go@v3
with:
go-version: "1.21"
go-version: "1.21.x"
- name: Build with xgo
uses: crazy-max/ghaction-xgo@v2
+43
View File
@@ -0,0 +1,43 @@
on:
[pull_request]
name: run tests
jobs:
test:
strategy:
matrix:
go-version: [ "1.21.x" ]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests
run: go test -v ./... -covermode=count
coverage:
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v3
with:
go-version: "1.21.x"
- name: Checkout code
uses: actions/checkout@v2
- name: Calc coverage
run: |
go test -v ./... -covermode=count -coverprofile=coverage.out
- name: Convert coverage.out to coverage.lcov
uses: jandelgado/gcov2lcov-action@v1
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov