Skip to content

Commit

Permalink
Merge pull request #21 from PaulWaldo/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulWaldo authored Oct 16, 2023
2 parents 63f8deb + d1b1c18 commit b0c7428
Show file tree
Hide file tree
Showing 18 changed files with 424 additions and 422 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,3 @@ jobs:
# - os: ios
# args: -app-id calc.sha${{ github.sha }}
# host: macos-latest

# - name: Cache build artifacts
# uses: actions/cache@v3
# with:
# path: |
# ~/go/pkg/mod
# ~/.cache/go-build
# ~/.cache/fyne-cross
# key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }}

# - name: Install Fyne-cross
# # working-directory: fyne-cross
# run: go install github.com/fyne-io/fyne-cross@latest

# # attempt to use "go install" but fallback to "go get"
# # - name: Install Fyne
# # run: |
# # go install fyne.io/fyne/v2/cmd/fyne@latest ||
# # go get fyne.io/fyne/v2/cmd/fyne@latest

# # - name: Install Podman
# # if: ${{ runner.os == 'macos' }}
# # run: |
# # brew install podman
# # podman machine init
# # podman machine start

# - name: Build
# # working-directory: calculator
# run: |
# fyne-cross \
# ${{ matrix.target.os }} \
# ${{ matrix.target.args }} \
# -name mastotool${{ matrix.target.ext }} \
# -app-id com.github.PaulWaldo.mastotool
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ jobs:
with:
cache: true
go-version-file: "go.mod"
cache-dependency-path: |
go.sum

- name: Install Fyne-cross
# working-directory: fyne-cross
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
# cache:
# - description: Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
# default: false
go-version-file: "go.mod"
cache-dependency-path: |
go.sum
- name: "Install staticcheck"
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: "Install goimports"
Expand All @@ -30,22 +25,22 @@ jobs:
run: test -z $(find . -name '*.go' -type f | xargs goimports -e -d | tee /dev/stderr)
- name: "Run staticcheck"
run: staticcheck ./...
# Unable to do race detection now, see https://github.com/fyne-io/fyne/issues/2509
- name: "Unit Tests"
run: go test -v -race -cover ./...
run: go test -v -cover ./...

golangci:
strategy:
matrix:
go: ["1.21"]
os: [macos-latest, windows-latest, linux]
name: lint
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install required packages
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev xorg-dev

- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false
go-version: "1.21.x"

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
184 changes: 184 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# !! Requires Pre-Commit
# !! https://pre-commit.com
# !! Config File: $GIT_REPO_ROOT/.pre-commit-config.yaml
# !! Already have a config file present?
# !! Copy/Paste everything below `repos:` into your existing file
# !! Don't already have a config file?
# !! Copy this whole file into your repo root (as '.pre-commit-config.yaml')
# !! Delete this header section
# !! Consider adding some built-in pre-commmit hooks to your project
# !! (They're quite useful!)
# !! ALL Hooks enabled by default - Comment out hooks you are not using
repos:
# ==========================================================================
# Golang Pre-Commit Hooks | https://github.com/tekwizely/pre-commit-golang
#
# Visit the project home page to learn more about the available Hooks,
# including useful arguments you might want to pass into them.
#
# File-Based Hooks:
# Run against matching staged files individually.
#
# Module-Based Hooks:
# Run against module root folders containing matching staged files.
#
# Package-Based Hooks:
# Run against folders containing one or more staged files.
#
# Repo-Based Hooks:
# Run against the entire repo.
# The hooks only run once (if any matching files are staged),
# and are NOT provided the list of staged files,
#
# My-Cmd-* Hooks
# Allow you to invoke custom tools in various contexts.
# Can be useful if your favorite tool(s) are not built-in (yet)
#
# Hook Suffixes
# Hooks have suffixes in their name that indicate their targets:
#
# +-----------+--------------+
# | Suffix | Target |
# |-----------+--------------+
# | <none> | Files |
# | -mod | Module |
# | -pkg | Package |
# | -repo | Repo Root |
# | -repo-mod | All Modules |
# | -repo-pkg | All Packages |
# +-----------+--------------+
#
# ! Multiple Hook Invocations
# ! Due to OS command-line-length limits, Pre-Commit can invoke a hook
# ! multiple times if a large number of files are staged.
# ! For file and repo-based hooks, this isn't an issue, but for module
# ! and package-based hooks, there is a potential for the hook to run
# ! against the same module or package multiple times, duplicating any
# ! errors or warnings.
#
# Useful Hook Parameters:
# - id: hook-id
# args: [arg1, arg2, ..., '--'] # Pass options ('--' is optional)
# always_run: true # Run even if no matching files staged
# alias: hook-alias # Create an alias
#
# Passing Options To Hooks:
# If your options contain a reference to an existing file, then you will
# need to use a trailing '--' argument to separate the hook options from
# the modified-file list that Pre-Commit passes into the hook.
# NOTE: For repo-based hooks, '--' is not needed.
#
# Passing Environment Variables to Hooks:
# You can pass environment variables to hooks using args with the
# following format:
#
# --hook:env:NAME=VALUE
#
# Always Run:
# By default, hooks ONLY run when matching file types are staged.
# When configured to "always_run", a hook is executed as if EVERY matching
# file were staged.
#
# Aliases:
# Consider adding aliases to longer-named hooks for easier CLI usage.
# ==========================================================================
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
#
# Go Build
#
# - id: go-build-mod
# - id: go-build-pkg
# - id: go-build-repo-mod
# - id: go-build-repo-pkg
#
# Go Mod Tidy
#
- id: go-mod-tidy
# - id: go-mod-tidy-repo
#
# Go Test
#
- id: go-test-mod
# - id: go-test-pkg
# - id: go-test-repo-mod
# - id: go-test-repo-pkg
#
# Go Vet
#
# - id: go-vet
# - id: go-vet-mod
# - id: go-vet-pkg
# - id: go-vet-repo-mod
# - id: go-vet-repo-pkg
#
# Revive
#
# - id: go-revive
# - id: go-revive-mod
# - id: go-revive-repo-mod
#
# GoSec
#
# - id: go-sec-mod
# - id: go-sec-pkg
# - id: go-sec-repo-mod
# - id: go-sec-repo-pkg
#
# StaticCheck
#
- id: go-staticcheck-mod
# - id: go-staticcheck-pkg
# - id: go-staticcheck-repo-mod
# - id: go-staticcheck-repo-pkg
#
# StructSlop
#
# - id: go-structslop-mod
# - id: go-structslop-pkg
# - id: go-structslop-repo-mod
# - id: go-structslop-repo-pkg
#
# Formatters
#
# - id: go-fmt
# - id: go-fmt-repo
# - id: go-fumpt # replaces go-fmt
# - id: go-fumpt-repo # replaces go-fmt-repo
# - id: go-imports # replaces go-fmt
# - id: go-imports-repo # replaces go-fmt-repo
# - id: go-returns # replaces go-imports & go-fmt
# - id: go-returns-repo # replaces go-imports-repo & go-fmt-repo
#
# Style Checkers
#
# - id: go-lint
# - id: go-critic
#
# GolangCI-Lint
# - Fast Multi-Linter
# - Can be configured to replace MOST other hooks
# - Supports repo config file for configuration
# - https://github.com/golangci/golangci-lint
#
# - id: golangci-lint
# - id: golangci-lint-mod
# - id: golangci-lint-pkg
- id: golangci-lint-repo-mod
# - id: golangci-lint-repo-pkg
#
# Invoking Custom Go Tools
# - Configured *entirely* through the `args` attribute, ie:
# args: [ go, test, ./... ]
# - Use arg `--hook:error-on-output` to indicate that any output from the tool
# should be treated as an error.
# - Use the `name` attribute to provide better messaging when the hook runs
# - Use the `alias` attribute to be able to invoke your hook via `pre-commit run`
#
# - id: my-cmd
# - id: my-cmd-mod
# - id: my-cmd-pkg
# - id: my-cmd-repo
# - id: my-cmd-repo-mod
# - id: my-cmd-repo-pkg
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ test:
go test ./...

tidy:
go mod tidy
go fmt ./...
go vet ./...

package:
fyne package -icon assets/Icon.png -name Mastotool
fyne package -icon assets/Icon.png -name Mastotool

mobilesim:
go run -tags mobile main.go

showcov:
go test ./... -coverprofile=coverage.out -covermode=count
go tool cover -html=coverage.out
rm coverage.out

testdocs:
gotestdox ./...
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ go 1.19
replace github.com/mattn/go-mastodon => github.com/PaulWaldo/go-mastodon v1.1.0

require (
fyne.io/fyne/v2 v2.4.0
fyne.io/fyne/v2 v2.4.1
github.com/google/go-cmp v0.5.8
github.com/mattn/go-mastodon v0.0.6
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
)

require (
fyne.io/systray v1.10.1-0.20230722100817-88df1e0ffa9a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fredbi/uri v1.0.0 // indirect
github.com/fredbi/uri v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fyne-io/gl-js v0.0.0-20230506162202-1fdaa286a934 // indirect
github.com/fyne-io/glfw-js v0.0.0-20220517201726-bebc2019cd33 // indirect
github.com/fyne-io/image v0.0.0-20230811065323-ed435dc8bca6 // indirect
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect
github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 // indirect
github.com/go-text/typesetting v0.0.0-20230803102845-24e03d8b5372 // indirect
github.com/go-text/typesetting v0.0.0-20231013144250-6cc35dbfae7d // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
Expand All @@ -35,8 +36,8 @@ require (
github.com/tevino/abool v1.2.0 // indirect
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
github.com/yuin/goldmark v1.5.6 // indirect
golang.org/x/image v0.12.0 // indirect
golang.org/x/mobile v0.0.0-20230901161150-52620a4a7557 // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/mobile v0.0.0-20231006135142-2b44d11868fe // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand Down
Loading

0 comments on commit b0c7428

Please sign in to comment.