From ec255e077f55bb9b29e0621ed9a1ee18f40e0401 Mon Sep 17 00:00:00 2001 From: sudoforge Date: Fri, 13 Mar 2026 00:56:38 -0700 Subject: [PATCH] WIP: build: use stable nix to build git-bug and subpackages This change refactors all tooling to use stable nix to build the project's packages (the git-bug binary and web ui). Support for the experimental features of nix that were previously in use were removed: `flakes` and `nix-command`. This requires updating many different parts of the development toolchain, namely: CI, internal tools, and documentation. As a result of this, onboarding has been simplified (as users no longer need to add support for the experimental features), nix is now exclusively being used to build in CI, and is the recommended golden path outside of CI (for correctness guarantees, at least). A `release-binaries` drv has been added that builds git-bug for a variety of platforms to support moving away from gox (and add support for `darwin/arm64`). When evaluating the treefmt configuration, optimizations were realized: - zizmor is being used instead of pinact for performing analysis of pipelines defined in //.github/workflows. as a result of this, changes were made to improve pipeline security - codespell configuration has been updated to include hidden files by default, and to skip over additional generated fileas - treefmt verbosity was changed so that additional information is shown during its execution - treefmt will no longer emit messages about unmatched files by default (but will if debug logging is enabled) This is one of the rare cases in which I'll submit a change that crosses multiple logical boundaries and closes several issues at once, but the nature of this change opened up the possibility to do so fairly neatly. I hope that this brings about a simpler experience for contributors to this project, and for downstream consumers (packagers and source-builders). Closes: #1491 Closes: #1418 Closes: #1508 Change-Id: I3fb65c84c9c1a98b045548802d5710de9b117b2e # Conflicts: # Makefile --- .codespellrc | 3 +- .envrc | 28 +- .github/workflows/build-and-test.yml | 95 ++++--- .github/workflows/lint.yml | 35 +++ .github/workflows/presubmit.yml | 10 +- .github/workflows/release.yml | 50 ++-- .github/workflows/scan.yml | 1 + .github/workflows/trunk.yml | 9 +- .gitignore | 26 +- .npins/default.nix | 249 ++++++++++++++++ .npins/sources.json | 23 ++ CHANGELOG.md | 407 ++++++++++++++------------- CONTRIBUTING.md | 177 ++++++------ INSTALLATION.md | 45 ++- Makefile | 54 ++-- {nix => ci}/checks/spelling.nix | 13 +- ci/default.nix | 185 ++++++++++++ default.nix | 206 ++++++++++++++ doc/design/bridges/jira.md | 23 +- doc/design/data-model.md | 4 +- flake.lock | 133 --------- flake.nix | 62 ---- main.go | 3 - nix/checks/pinact.nix | 12 - flake-hook.bash => shell-hook.bash | 0 shell.nix | 36 +++ treefmt.nix | 92 ------ webui/.gitignore | 11 +- webui/.prettierrc | 4 - webui/Makefile | 1 - webui/codegen.yaml | 4 - webui/debug_assets.go | 2 +- webui/default.nix | 67 +++++ webui/pack_webui.go | 2 +- webui/package.json | 9 +- 35 files changed, 1304 insertions(+), 777 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .npins/default.nix create mode 100644 .npins/sources.json rename {nix => ci}/checks/spelling.nix (52%) create mode 100644 ci/default.nix create mode 100644 default.nix delete mode 100644 flake.lock delete mode 100644 flake.nix delete mode 100644 nix/checks/pinact.nix rename flake-hook.bash => shell-hook.bash (100%) create mode 100644 shell.nix delete mode 100644 treefmt.nix delete mode 100644 webui/.prettierrc create mode 100644 webui/default.nix diff --git a/.codespellrc b/.codespellrc index 991380a4616f33d4f0dd6a8e093a9c3db961ecb6..b244d4974ae742e3a04c851a1ad8bdd8464ab232 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,5 +1,6 @@ [codespell] -skip = .git,.venv,*.svg,*/package-lock.json,go.mod,go.sum,./misc/completion/* +check-hidden = true +skip = CHANGELOG.md,.direnv/*,.git,*.svg,*/package-lock.json,go.mod,go.sum,misc/completion/*/,webui/node_modules/* # ot,fo,te - used as short variable names # optionall - OptionAll but codespell is case insensitive # testing - TestIn diff --git a/.envrc b/.envrc index efba7f6ea6e1dee892b0580dddc73897b53f52dc..72722d356a957a2a11b7903e069b3d66dae1f0ee 100644 --- a/.envrc +++ b/.envrc @@ -1,21 +1,25 @@ -# this is required for versions of direnv older than 2.29.0, since they do not -# support `use flake`, and is recommended in all cases, since it caches the -# environment and prevents dependencies from being garbage-collected by nix. +# ensure that nix-direnv is available at the minimum specified version (or +# greater). this supports caching of the dev shell, which greatly reduces the +# loading time of activations after the first. if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then source_url \ "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" \ "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" fi -# allow extending this .envrc with a user-defined .envrc.local +# allow extending this .envrc with a user-defined .envrc.local. note that if +# this exists, it is automatically watched for changes source_env_if_exists .envrc.local -# load the development shell defined in the flake.nix file -# note: this automatically watches the following files: -# - flake.nix -# - flake.lock -use flake +# ancillary files to watch for changes. these files are included in the +# development shell and as such, the shell should be reloaded after changes +watch_file shell-hook.bash +watch_file ci/default.nix -# files to watch -watch_file .envrc.local -watch_file flake-hook.bash +# load the development shell defined in the flake.nix file +# note that this automatically watches the following files: +# $HOME/.direnvrc +# $HOME/.config/direnv/direnvrc +# shell.nix +# default.nix +use nix diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 017bd002c32e39a3f620f98c21812b8e06d26754..8101aec09c43849c33712fa0af18b3de27898175 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -3,40 +3,76 @@ name: build-and-test on: workflow_call: + secrets: + github-test-token: + required: true + github-token-private: + required: true + github-token-public: + required: true + gitlab-api-token: + required: true + gitlab-project-id: + required: true permissions: contents: read jobs: - with-go: + standard: strategy: matrix: - go-version: [1.24.2] - platform: [ubuntu-latest, macos-latest, windows-latest] + platform: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.platform }} steps: - - name: Check out code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - go-version: ${{ matrix.go-version }} + persist-credentials: false - - name: Build - run: make + - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 - - name: Test - run: make test - env: - GITHUB_USER: ${{ env.TEST_USER_GITHUB }} - GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_GITHUB }} - GITHUB_TOKEN_PRIVATE: ${{ secrets._GITHUB_TOKEN_PRIVATE }} - GITHUB_TOKEN_PUBLIC: ${{ secrets._GITHUB_TOKEN_PUBLIC }} - GITLAB_API_TOKEN: ${{ secrets.GITLAB_API_TOKEN }} - GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }} - - with-node: + - name: build with nix-build + run: | + nix-build -A default --argstr version "${{ github.sha }}" + + echo "### Build details" >> "$GITHUB_STEP_SUMMARY" + echo "```" >> "$GITHUB_STEP_SUMMARY" + echo "$ file ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY" + file ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY" + echo + echo "$ go version -m ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY" + nix-shell --run 'go version -m ./result/bin/git-bug' >> "$GITHUB_STEP_SUMMARY" + + # We run this job in order to test the release derivation, to ensure that any + # changes to the derivation configuration does not affect the release build + release-binaries: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 + + - name: build with nix-build + run: | + nix-build -A release --argstr version "${{ github.sha }}" + + echo "### Build details" >> "$GITHUB_STEP_SUMMARY" + echo "```" >> "$GITHUB_STEP_SUMMARY" + echo "$ file ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY" + file ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_SUMARY" + echo "$ ls -sh ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY" + ls -sh ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_SUMMARY" + echo "$ nix-shell --run 'go version -m ./result/bin/git-bug'" >> "$GITHUB_STEP_SUMMARY" + nix-shell --run 'go version -m ./result/bin/git-bug' >> "$GITHUB_STEP_SUMMARY" + + web-ui: runs-on: ubuntu-latest strategy: matrix: @@ -52,6 +88,8 @@ jobs: - name: Check out code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - uses: DeterminateSystems/nix-installer-action@21a544727d0c62386e78b4befe52d19ad12692e3 # v17 @@ -66,16 +104,3 @@ jobs: - name: Test run: make test - with-nix: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - uses: DeterminateSystems/nix-installer-action@21a544727d0c62386e78b4befe52d19ad12692e3 # v17 - - - uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1.2.1 - - - run: nix flake check diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000000000000000000000000000000000..3e9e7b50bf31fd439c5d452aff15b0cdb17ec834 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +--- +name: lint + +on: + workflow_call: + +permissions: {} + +defaults: + run: + shell: bash + +jobs: + check-formatting: + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1 + + - name: Check that files are formatted + run: |- + if ! nix-build ci --no-out-link -A checks.fmt; then + printf "%s\n%s\n\t%s\n\t%s\n%s\n%s\n" \ + "One or more files are not formatted correctly." + "Please run the formatter by changing to the root directory and running one of:" + "nix-shell --run treefmt" + "nix develop --command treefmt" + "Make sure your branch is up to date with trunk; rebase if not." + "If you're having trouble, please reach out on matrix at #git-bug-general:matrix.org." + exit 1 + fi diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 35bf4dc7efab6a0ef4d505a3c3188f25fce6bc1d..d718e72a57e31e5c0d9bca48e46709e9863e2dbd 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -24,6 +24,14 @@ permissions: contents: read jobs: + lint: + uses: ./.github/workflows/lint.yml + build-and-test: uses: ./.github/workflows/build-and-test.yml - secrets: inherit + secrets: + github-test-token: ${{ secrets.TEST_TOKEN_GITHUB }} + github-token-private: ${{ secrets._GITHUB_TOKEN_PRIVATE }} + github-token-public: ${{ secrets._GITHUB_TOKEN_PUBLIC }} + gitlab-api-token: ${{ secrets.GITLAB_API_TOKEN }} + gitlab-project-id: ${{ secrets.GITLAB_PROJECT_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90104e21bfc7025b78ca284f8b5a0f4d72fdd088..cdbe6f483894aaa2914bc074867e8b238375b66a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ permissions: contents: read jobs: - build-release: + build-and-release: runs-on: "ubuntu-latest" permissions: # unfortunately, this is necessary for creating the release. there is a @@ -24,31 +24,39 @@ jobs: # [0]: https://github.com/orgs/community/discussions/68252 contents: write steps: - - name: Check out code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Set up Go - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - go-version: 1.24.2 - - - name: Build - run: make + persist-credentials: false - name: Setup minimal git config run: | - git config --global user.email "action@github.com" - git config --global user.name "GitHub Action" + git config --global user.email "bot@git-bug.org" + git config --global user.name "git-bug" - - name: Test - run: make test + - name: Test with go + run: nix-shell --run "go test -v -bench=. ./..." - - name: Build binaries - run: make releases + - name: Determine version string + id: version-string + run: | + v=$(git describe --match='v*' --always --dirty --broken) + echo "value=${v}" >> "$GITHUB_OUTPUT" - - uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.2.1 + - name: Build release binaries + env: + VERSION: ${{ steps.version-string.outputs.value }} + run: | + nix-build -A release --argstr version "$VERSION" + + # this is the symlink to the native output artifact, built by the + # `default` derivation when the host system is linux or macos. because + # this job runs on 64-bit linux, we manually rename it so that the + # artifact uploaded to the GitHub Release is appropriately named for + # end users + mv ./result/bin/git-bug ./result/bin/git-bug-linux-amd64 + echo '- version built: `${VERSION}`' >> "$GITHUB_STEP_SUMMARY" + + - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - draft: true - prerelease: false - files: dist/* + files: result/* + diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 98d44d480cef381aba847ca3227043e0b7d2cbc1..90f6195600f83c449575ed7bb399a7dd05d0c8c3 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -22,6 +22,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 2 + persist-credentials: false - name: Initialize CodeQL uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 7b57dcf806037b0b70f061d68df5915e650a978d..dc5196ecfd8656c20830fb34f3212756c347d415 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -21,7 +21,12 @@ permissions: jobs: build-and-test: uses: ./.github/workflows/build-and-test.yml - secrets: inherit + secrets: + github-test-token: ${{ secrets.TEST_TOKEN_GITHUB }} + github-token-private: ${{ secrets._GITHUB_TOKEN_PRIVATE }} + github-token-public: ${{ secrets._GITHUB_TOKEN_PUBLIC }} + gitlab-api-token: ${{ secrets.GITLAB_API_TOKEN }} + gitlab-project-id: ${{ secrets.GITLAB_PROJECT_ID }} benchmark: runs-on: ubuntu-latest @@ -30,6 +35,8 @@ jobs: deployments: write steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: diff --git a/.gitignore b/.gitignore index d6eae0b3200d3d6c4ce1c648724d07da53309b05..db92d1c5432e90a0aea861c04410afbdf1444ee9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,18 @@ -git-bug -!/misc/completion/bash/git-bug -!/misc/completion/fish/git-bug -!/misc/completion/powershell/git-bug -!/misc/completion/zsh/git-bug -.gitkeep -dist -coverage.txt +# go compiler output file +/git-bug + +# test binaries built with go test -c +*.test + +# code coverage and test artifacts +*.out +coverage.* +*.coverprofile +profile.cov + +# editor configuration .idea/ -.git_bak* +.vscode/ # nix and direnv related tooling .envrc @@ -15,5 +20,6 @@ coverage.txt /.direnv/ !/.envrc -# nix output directory from `nix build` commands +# symlinks to nix-store output dirs, created by `nix-build` /result +/result-* diff --git a/.npins/default.nix b/.npins/default.nix new file mode 100644 index 0000000000000000000000000000000000000000..884fc8cc587d6e0f050ef5e826c673b92a426504 --- /dev/null +++ b/.npins/default.nix @@ -0,0 +1,249 @@ +/* + This file is provided under the MIT licence: + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +# Generated by npins. Do not modify; will be overwritten regularly +let + # Backwards-compatibly make something that previously didn't take any arguments take some + # The function must return an attrset, and will unfortunately be eagerly evaluated + # Same thing, but it catches eval errors on the default argument so that one may still call it with other arguments + mkFunctor = + fn: + let + e = builtins.tryEval (fn { }); + in + (if e.success then e.value else { error = fn { }; }) // { __functor = _self: fn; }; + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatStrings = builtins.concatStringsSep ""; + + # If the environment variable NPINS_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + # (Taken from Niv for compatibility) + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path + else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" + ); + + mkSource = + name: spec: + { + pkgs ? null, + }: + assert spec ? type; + let + # Unify across builtin and pkgs fetchers. + # `fetchGit` requires a wrapper because of slight API differences. + fetchers = + if pkgs == null then + { + inherit (builtins) fetchTarball fetchurl; + # For some fucking reason, fetchGit has a different signature than the other builtin fetchers … + fetchGit = args: (builtins.fetchGit args).outPath; + } + else + { + fetchTarball = + { + url, + sha256, + }: + pkgs.fetchzip { + inherit url sha256; + extension = "tar"; + }; + inherit (pkgs) fetchurl; + fetchGit = + { + url, + submodules, + rev, + name, + narHash, + }: + pkgs.fetchgit { + inherit url rev name; + fetchSubmodules = submodules; + hash = narHash; + }; + }; + + # Dispatch to the correct code path based on the type + path = + if spec.type == "Git" then + mkGitSource fetchers spec + else if spec.type == "GitRelease" then + mkGitSource fetchers spec + else if spec.type == "PyPi" then + mkPyPiSource fetchers spec + else if spec.type == "Channel" then + mkChannelSource fetchers spec + else if spec.type == "Tarball" then + mkTarballSource fetchers spec + else if spec.type == "Container" then + mkContainerSource pkgs spec + else + builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = mayOverride name path; }; + + mkGitSource = + { + fetchTarball, + fetchGit, + ... + }: + { + repository, + revision, + url ? null, + submodules, + hash, + ... + }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null && !submodules then + fetchTarball { + inherit url; + sha256 = hash; + } + else + let + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else if repository.type == "Forgejo" then + "${repository.server}/${repository.owner}/${repository.repo}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName url revision; + in + fetchGit { + rev = revision; + narHash = hash; + + inherit name submodules url; + }; + + mkPyPiSource = + { fetchurl, ... }: + { + url, + hash, + ... + }: + fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = + { fetchTarball, ... }: + { + url, + hash, + ... + }: + fetchTarball { + inherit url; + sha256 = hash; + }; + + mkTarballSource = + { fetchTarball, ... }: + { + url, + locked_url ? url, + hash, + ... + }: + fetchTarball { + url = locked_url; + sha256 = hash; + }; + + mkContainerSource = + pkgs: + { + image_name, + image_tag, + image_digest, + ... + }: + if pkgs == null then + builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers" + else + pkgs.dockerTools.pullImage { + imageName = image_name; + imageDigest = image_digest; + finalImageTag = image_tag; + }; +in +mkFunctor ( + { + input ? ./sources.json, + }: + let + data = + if builtins.isPath input then + # while `readFile` will throw an error anyways if the path doesn't exist, + # we still need to check beforehand because *our* error can be caught but not the one from the builtin + # *piegames sighs* + if builtins.pathExists input then + builtins.fromJSON (builtins.readFile input) + else + throw "Input path ${toString input} does not exist" + else if builtins.isAttrs input then + input + else + throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset"; + version = data.version; + in + if version == 7 then + builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins + else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" +) diff --git a/.npins/sources.json b/.npins/sources.json new file mode 100644 index 0000000000000000000000000000000000000000..af7fa0f044f89dd095eef86a5712c06a28377eb0 --- /dev/null +++ b/.npins/sources.json @@ -0,0 +1,23 @@ +{ + "pins": { + "nixpkgs": { + "type": "Channel", + "name": "nixpkgs-unstable", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre961255.e607cb5360ff/nixexprs.tar.xz", + "hash": "sha256-Ki+NJLX77OuKlMVV5rXhQnVyZYGnC1d776lSMrhV9nU=" + }, + "treefmt": { + "type": "Git", + "repository": { + "type": "Git", + "url": "https://github.com/numtide/treefmt-nix" + }, + "branch": "main", + "submodules": false, + "revision": "71b125cd05fbfd78cab3e070b73544abe24c5016", + "url": null, + "hash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=" + } + }, + "version": 7 +} diff --git a/CHANGELOG.md b/CHANGELOG.md index a17081bf0fd0d13879abd51763c94db984d65f20..38af46180baac03781adcf98e435149817f6ef82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ To view the full set of changes, including internal developer-centric changes, run the following command: ``` -git log --oneline v0.10.0 +git log --oneline v0.9.0..v0.10.0 ``` ### Documentation @@ -40,24 +40,6 @@ git log --oneline v0.10.0 - **BREAKING CHANGE**: **dev-infra**: remove gokart (89b880bd) -## 0.10.0 (2025-05-18) - -To view the full set of changes, including internal developer-centric changes, -run the following command: - -``` -git log --oneline v0.9.0..v0.10.0 -``` - -### Documentation - -- **bridge**: correct command used to create a new bridge (9942337b) - -### Features - -- **web**: simplify header navigation (7e95b169) -- **web**: remark upgrade + gfm + syntax highlighting (6ee47b96) - ## 0.9.0 (2025-05-12) This release contains minor improvements and bug fixes. @@ -71,7 +53,12 @@ git log --oneline v0.8.1..v0.9.0 ### Bug fixes -- **completion**: remove errata from string literal (aa102c91) +- remove errata from string literal (aa102c91) + +### Documentation + +- clarify testing activation of the dev shell (d753637e) +- correct mispelled words (89ff47a4) ### Features @@ -79,8 +66,9 @@ git log --oneline v0.8.1..v0.9.0 ## 0.8.1 (2025-05-05) -This release contains the culmination of new features, bug fixes, and other -miscellaneous changes (documentation, tooling) since the last release in 2022. +This release contains the culmination of new features, bug fixes, and +other miscellaneous changes (documentation, tooling) since the last +release in 2022. To view the full set of changes, including internal developer-centric changes, run the following command: @@ -91,15 +79,15 @@ git log --oneline v0.8.0..v0.8.1 ### Bug fixes +- **#971**: parse submodule .git files instead of erroring (e97df9c8) +- **972**: use prerelease of GoKart with repaired panic (344438b9) +- **TestCache**: eliminate hanging Windows tests (ea9b3aa0) +- **commands**: run tests in ./commands/... without ANSI color (e4707cd8) +- **commands**: create env.Env once for all Cobra commands (0bddfe1d) +- **commands**: replace missing import (723b3c41) - remove repeated use of the same fmt.Errorf() calls (0cd2f3b4) -- use prerelease of GoKart with repaired panic (344438b9) - keyrings must return keys with entities/identities (de6f5404) - resolve Go vulnerabilities (33e3e4b6) -- (cli): run tests in ./commands/... without ANSI color (e4707cd8) -- (cli): create env.Env once for all Cobra commands (0bddfe1d) -- (cli): replace missing import (723b3c41) -- parse submodule .git files instead of erroring (e97df9c8) -- openpgp handling to sign/check (429b913d) - correct typo: acceps => accepts (76de669d) - bump to go v1.22.5 (f79ea38c) - add missing `with` property to //.github/workflows:cron.yml (eef62798) @@ -107,22 +95,23 @@ git log --oneline v0.8.0..v0.8.1 - move codeql into an independent workflow (1fa858dc) - run the presubmit pipeline for PRs (5893f948) - correct path for reusable workflow: lifecycle (1dd81071) -- typos in docs (d499b6e9) - set GitLastTag to an empty string when git-describe errors (25f755cb) - refactor how gitlab title changes are detected (197eb599) - use correct url for gitlab PATs (7b6eb5db) - use -0700 when formatting time (edbd105c) - checkout repo before setting up go environment (5e8efbae) -- resolve the remote URI using url.\*.insteadOf (a150cdb0) +- resolve the remote URI using url.*.insteadOf (a150cdb0) ### Documentation +- **commands**: try to make cleaned argument use more obvious (3f764397) - normalize verb tense and fix typo (8537869a) - add a feature matrix (3c1b8fd0) - update install, contrib, and usage documentation (96c7a111) ### Features +- **ci**: support a merge queue (1bde5dff) - wrap ErrNoConfigEntry to report missing key (64c18b15) - wrap ErrMultipleConfigEntry to report duplicate key (49929c03) - upgrade go-git to v5.1.1 (7c4a3b12) @@ -150,33 +139,32 @@ git log --oneline v0.8.0..v0.8.1 ### Other changes +- **TestCache**: cleanup per PR review (5c45e70a) +- **TestCache**: remove empty trailing line from function (59684d74) - reorg into different packages (acc9a6f3) - add a workflow to continuously run benchmarks (c227f2e9) - make it work? (c6bb6b9c) - cleanup test token when test is done (10851853) - proper reduced interface for full-text indexing (60d40d60) -- return specific error on object not found, accept multiple namespace to - push/pull (905c9a90) +- return specific error on object not found, accept multiple namespace to push/pull (905c9a90) - tie up the refactor up to compiling (9b98fc06) - generic withSnapshot, some cleanup (d65e8837) - fix some bugs after refactor (95911100) - tie the last printf in an event to make the core print free (13a7a599) - move bug specific input code into commands/bug/input (d5b07f48) - simplify cache building events handling (b2795875) -- generic `select` code, move bug completion in bugcmd (e9209878) +- generic "select" code, move bug completion in bugcmd (e9209878) - don't double build the lamport clocks (c9009b52) - remove lint security step as it's crashing (57f328fb) - share JSON creation (5844dd0a) - fix tests? (70b0c5b8) - check error when closing a repo in tests (2664332b) -- temporary use a fork of go-git due to - https://github.com/go-git/go-git/pull/659 (03dcd7ee) +- temporary use a fork of go-git due to https://github.com/go-git/go-git/pull/659 (03dcd7ee) - don't forget to close a file (5bf274e6) - add a nice terminal progress bar when building the cache (7df34aa7) - move terminal detection to Out, introduce the compagnion In (f011452a) - adapt the output of the bug list to the terminal size (9fc8dbf4) -- remove compact style for `bug`, as the width adaptive default renderer cover - that usage (f23a7f07) +- remove compact style for "bug", as the width adaptive default renderer cover that usage (f23a7f07) - different pattern to detect changed flags (3e41812d) - code cleanup, fix some edge cases (5238d1dd) - add a helper to generate testing regex for CLI output (b66d467a) @@ -190,13 +178,13 @@ git log --oneline v0.8.0..v0.8.1 - also teardown cleanly on SIGTERM (42aea2cd) - better IsRunning(pid) (4b62a945) - fix some cache building progress bar artifact (281d4a64) -- no `with` means using codespellrc, add more opt out (d8bcd71d) +- no "with" means using codespellrc, add more opt out (d8bcd71d) - regenerate after gqlgen upgrade (31a97380) - more ignore (de8d2c13) - fix some struct names in comments (ce7fd6fc) - remove refs to deprecated io/ioutil (d4f6f273) - update go dependencies (f5076359) -- it is `new` not `configure` command (also was missing \\) (f00e42e7) +- it is "new" not "configure" command (also was missing \) (f00e42e7) - regenerate command completion and documentation (c3ff05f9) - make label a common type, in a similar fashion as for status (3a4b8805) - properly namespace Bug to make space for other entities (57e71470) @@ -220,32 +208,28 @@ git log --oneline 0.7.1..v0.8.0 ### Bug fixes -- cache not rebuilding properly (c326007d) -- github action (87a2638c) -- ListCommits implementation (27e70af2) -- go sum rebase artifacts (fb9170e2) -- merge (1ced77af) +- **778**: remove extra mutex lock when resolving bug prefix (eda312f9) +- **808**: replace Windows line terminators (cd1099aa) +- **808**: simplify handling of Windows line terminations (1a504e05) +- **808**: remove duplication stderr/stdout set-up (848f7253) +- **836**: revert to older test harness (870fe693) +- **850**: remove obsolete test logging (2c2c4491) +- **850**: merge in CombinedId from 664 (ff1b7448) +- **850**: normalize Windows line endings -> *nix (0f885d4f) +- **850**: normalize Windows line endings -> *nix (golden files) (c4a4d457) +- **884**: scan PRs for insecure practices (2b47003f) - issue with toggling the author (248201bc) - issue with regex (bff9fa67) - issue with keyDown propagation (72fc0ef7) - regex issue (41ee97a4) -- remove extra mutex lock when resolving bug prefix (eda312f9) -- replace Windows line terminators (cd1099aa) - remove only t.Parallel() (da9f95e4) -- simplify handling of Windows line terminations (1a504e05) -- remove duplication stderr/stdout set-up (848f7253) -- revert to older test harness (870fe693) -- remove obsolete test logging (2c2c4491) -- merge in CombinedId from 664 (ff1b7448) -- normalize Windows line endings -> \*nix (0f885d4f) -- normalize Windows line endings -> \*nix (golden files) (c4a4d457) - hide tools versioning behind build tags (1dcdee49) - correct name for one of the security phonies (8bd98454) - process unused (but assigned) error (fc444915) -- scan PRs for insecure practices (2b47003f) ### Documentation +- **847**: add compact to docs and bash for ls command's format flag (d3f2fb0d) - fix typos (ff0ff863) - generate concurrently (7f87eb86) - cleanup query documentation (10a259b6) @@ -254,11 +238,11 @@ git log --oneline 0.7.1..v0.8.0 - tiny tweaks (b43a447a) - more tiny fixes (c6be0588) - more tiny fixes (2ade8fb1) -- add compact to docs and bash for ls command's format flag (d3f2fb0d) - fix incorrect indentation (55a2e8e4) ### Features +- **836**: updates default ls formatter for TSV output (a5802792) - use author to filter the list (54c5b662) - add filter by label (31871f29) - check if there are labels (7a7e93c9) @@ -266,7 +250,6 @@ git log --oneline 0.7.1..v0.8.0 - use predefined filters (f82071a3) - Github bridge mutation rate limit (247e1a86) - make local storage configurable (b42fae38) -- updates default ls formatter for TSV output (a5802792) - version tools using Go module system (d989f9b6) - add security tools (2caade93) - add recipes for security analysis (ec739558) @@ -274,6 +257,8 @@ git log --oneline 0.7.1..v0.8.0 ### Other changes +- **808**: merge in LocalStorage namespace configuration (5982e8fb) +- **808**: rearrange imports to git-bug convention (941f5b3f) - document workflows (685a4fdc) - fix image links (e43920bc) - better phrasing (a8aecec6) @@ -286,12 +271,10 @@ git log --oneline 0.7.1..v0.8.0 - enable Fish completion (78f39c40) - Add support to ls dump bug information in specific formats (de5565b5) - cleanup and re-generate files (1d06244c) -- harmonize how time are used, fix some issues in command special formats - (aab3a04d) +- harmonize how time are used, fix some issues in command special formats (aab3a04d) - remove tie to Bug, improved and reusable testing (88ad7e60) - more tests (939bcd57) -- render component's children as a function to avoid uncecessary rendering - (07d6c6aa) +- render component's children as a function to avoid uncecessary rendering (07d6c6aa) - pack (3aaf7758) - refactor to avoid globals (26bd1dd1) - open and close the backend in a single place, simplify commands (536c290d) @@ -301,16 +284,14 @@ git log --oneline 0.7.1..v0.8.0 - fix segfault with badly loaded backend (71989045) - minor code improvements (5c823a70) - avoid importing a whole package to check an error (ac7e5086) -- skip the broken test as `known broken` :( (0590de9f) +- skip the broken test as "known broken" :( (0590de9f) - code cleanup for the rm feature (a62ce78c) -- cleanup the command's usage to avoid warnings when generating the doc - (ae5c0967) +- cleanup the command's usage to avoid warnings when generating the doc (ae5c0967) - fix BugExcerpt's timestamp not properly stored (92a59ece) - make the help visually easier to parse (9ce84fc1) - help bar background goes all the width (8eb7faf6) - fix FreeBSD package name (e374c9da) -- use sha256 to compute labels color, to use a single hash function in the - codebase (47ea66f6) +- use sha256 to compute labels color, to use a single hash function in the codebase (47ea66f6) - fix tests (60466f86) - simplify cache eviction (4d678f3e) - Remove empty borders around bug table view (6824ecf0) @@ -379,7 +360,7 @@ git log --oneline 0.7.1..v0.8.0 - Add target to EditCommentInput (cc7788ad) - Regenerate the GraphQL-Server (2a1c7723) - fix various config issues around case insentivity (890c014d) -- only FTS index token \< 100 characters (32958b5c) +- only FTS index token < 100 characters (32958b5c) - test for FTS bub with long description (e9856537) - fix no-label filter not properly wired (f7dec7e9) - match wikipedia algorithm (44d75879) @@ -392,7 +373,7 @@ git log --oneline 0.7.1..v0.8.0 - don't store the id in Bug, match how it's done for Identity (2788c5fc) - fix tests (fcf43915) - generalize the combined Ids, use 64 length (db707430) -- fix `comment edit` usage (bb8a214d) +- fix "comment edit" usage (bb8a214d) - add error to signal invalid format (5f6a3914) - partially add two new functions to RepoData (5c4e7de0) - add embryo of a generic, DAG-enabled entity (9cca74cc) @@ -447,10 +428,9 @@ git log --oneline 0.7.1..v0.8.0 - allow to resolve identities when numashalling operations (fd14a076) - fix incorrect client creation reusing the same credential (6f112824) - add an extensive example (450d7f7a) -- don't serialize multiple time the author, only once in OperationPack - (c5b70d8d) +- don't serialize multiple time the author, only once in OperationPack (c5b70d8d) - use the correct GenBashCompletionV2 instead of the legacy function (f25690db) -- fix bash completion with `git bug` (edc8b758) +- fix bash completion with "git bug" (edc8b758) - fix incorrect query parsing with quotes escaped by the shell (b9991d84) - lots of small ironing (3d534a70) - strict Markdown requires empty lines before (and after) lists (33c67027) @@ -465,19 +445,14 @@ git log --oneline 0.7.1..v0.8.0 - fix data race when closing event channel (7348fb9e) - clean-up commented code (e29f58bf) - close index before deleting it on disk (50de0306) -- merge in LocalStorage namespace configuration (5982e8fb) -- rearrange imports to git-bug convention (941f5b3f) -- ensure that the default repo has a non-empty name to make js/apollo happy - (295da9c7) +- ensure that the default repo has a non-empty name to make js/apollo happy (295da9c7) - proper base operation for simplified implementation (3d454d9d) - fix an issue where Id would be used, then changed due to metadata (d179b8b7) -- generalized resolvers to resolve any entity time when unmarshalling an - operation (45f5f852) -- have a type for combined ids (45b04351) +- generalized resolvers to resolve any entity time when unmarshalling an operation (45f5f852) +- have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653 (45b04351) - adapt to CombinedId (6ed4b8b7) - add a flag to log handling errors (8d11e620) -- test op serialisation with the unmarshaller, to allow resolving entities - (e1b172aa) +- test op serialisation with the unmarshaller, to allow resolving entities (e1b172aa) - update most of dependencies (c02528b7) - put react-scripts and typescript as dev-dependency (49fe8e9f) - better PHONY (0eef9391) @@ -510,15 +485,13 @@ git log --oneline 0.7.0..0.7.1 - tag bugs with the base URL, tighten the matching (43977668) - tighten the import matching (fae3b2e7) - tighten the bug matching (a8666bfe) -- replace the all-in-one query parser by a complete one with AST/lexer/parser - (5e4dc87f) +- replace the all-in-one query parser by a complete one with AST/lexer/parser (5e4dc87f) - no need for an ast package (314fcbb2) - fix a nil value access (aec81b70) - more robust tokenizer (ecde909b) - fix a bad login handling in the configurator (38b42bc8) - refactor the iterator, fix bugs (f4ca533f) -- fix iterator (paginate with first index 1) and avoid the trailing API call - (903549ca) +- fix iterator (paginate with first index 1) and avoid the trailing API call (903549ca) ## 0.7.0 (2020-03-01) @@ -529,13 +502,6 @@ run the following command: git log --oneline 0.6.0..0.7.0 ``` -### Bug fixes - -- version not set properly when built on travis (20080aa0) -- merge (20ca2bc0) -- tests ? (2e7ac569) -- usage of newIdentityRaw (d349137e) - ### Documentation - fix typos (710d8566) @@ -560,8 +526,7 @@ git log --oneline 0.6.0..0.7.0 - implement filtering (4d97e3a1) - implement issue list sort (ead5bad7) - add open/closed issues count (adb28885) -- don't store legacy identities IDs in bug excerpt as they are not reachable. - Fix a panic (f093be96) +- don't store legacy identities IDs in bug excerpt as they are not reachable. Fix a panic (f093be96) - better reusable prompt functions (db893494) - rework mutation (390b13c9) - rework resolving of bugs, identity (da0904d2) @@ -569,8 +534,7 @@ git log --oneline 0.6.0..0.7.0 - fix wrong error used (a335725c) - hopefully fix tests (bef35d4c) - fix 2 uncatched errors (9b1aaa03) -- use the cache in priority for fast browsing at \< 20ms instead of seconds - (81f5c3e0) +- use the cache in priority for fast browsing at < 20ms instead of seconds (81f5c3e0) - add proper locking to avoid concurrent access (b7dc5b8a) - many fixes and improvments at the config step (bd7b50bc) - update install instruction with go modules (39a31040) @@ -619,12 +583,10 @@ git log --oneline 0.6.0..0.7.0 - run linter fix (f9648439) - fix bad formatting on Date (1164e341) - adjust some margins (f1759ea3) -- record the login used during the configure and use it as default credential - (0cebe1e5) +- record the login used during the configure and use it as default credential (0cebe1e5) - fix label cropped in the label edition window (a322721a) - fix bad rendering due to outdated go-runewidth (68acfa51) -- bring back the login to hold that info from bridges (purely informational) - (893de4f5) +- bring back the login to hold that info from bridges (purely informational) (893de4f5) - correct casing for user provided login (fe38af05) - fix tests (a90954ae) - fix GetRemote to not break when there is no remotes (eeeb932b) @@ -639,20 +601,11 @@ run the following command: git log --oneline 0.5.0..0.6.0 ``` -### Bug fixes - -- imported bugs count (458f4da1) -- tests (bc03a89a) -- index out of range panic in github configuration (b82ef044) -- everything following the hash-->id change (612a29b0) - ### Documentation - update implementation table (03b6afa2) - replace images with new ones (21e82d53) - update generated documentations (c5824ff1) -- README: make the feature-list render as list in more Markdown flavors - (61d94305) ### Other changes @@ -679,13 +632,12 @@ git log --oneline 0.5.0..0.6.0 - Render markdown (356d1b41) - refactor how test repo are created/cleaned (c7abac38) - add ReadConfigBool and ReadConfigString functions (d564e37b) -- add flags/config to control the automatic opening in the default browser - (8bfc65df) +- add flags/config to control the automatic opening in the default browser (8bfc65df) - fix Bug's Lamport edit time potentially wrong due to rebase (777ccb9c) - generate PowerShell command completion (b64587f8) - expose the operation when creating a new bug (08c0e18a) - change mutations to respect the Relay specification (b2f8572c) -- consistently use `ref` to fetch a repository (9f4da4ce) +- consistently use "ref" to fetch a repository (9f4da4ce) - fix typo (17cbe457) - document the PowerShell completion (aa4464db) - github exporter is no longer a planned feature (41a5a7fc) @@ -694,8 +646,7 @@ git log --oneline 0.5.0..0.6.0 - fix a missing line break (eef73332) - rework how RmConfigs works with git (76db2f42) - RmConfigs usage of git version lt 2.18 (fb50d470) -- don't use the gqlgen command to generate to avoid pulling urfave/cli - (14022953) +- don't use the gqlgen command to generate to avoid pulling urfave/cli (14022953) - fix project visibility prompt (c805142f) - add github.com/xanzy/go-gitlab vendors (15d12fb6) - init new bridge (01c0f644) @@ -740,15 +691,13 @@ git log --oneline 0.5.0..0.6.0 - add context.Context to ImportAll and ExportAll signatures (5ca326af) - use errgroup.Group instead of sync.WaitGroup (501a9310) - silence export and import nothing events (e6931aaf) -- fix name case sensitivity in retrieving and creating labels using github - graphql api (d19b8e1a) +- fix name case sensitivity in retrieving and creating labels using github graphql api (d19b8e1a) - add exporter test cases for label change bug (4a4e238d) - add exporter implementation (f1c65a9f) - rebase and correct exporter (f1be129d) - fix edit comment request and remove label functionalities (514dc30c) - improve exporter error handling and label change operations (63e7b086) -- exporter ignore issues imported from or exported to different projects - (22960159) +- exporter ignore issues imported from or exported to different projects (22960159) - remove gitlab url checking before export (c8fdaab5) - tweaking (35c6cb6e) - fix git version parsing with broken version (91e4a183) @@ -756,11 +705,11 @@ git log --oneline 0.5.0..0.6.0 - allow to cancel a cleaner (cb204411) - also protect cancel with the mutex (c4accf55) - minor cleanup (6a0336e0) -- add a `tui` alias for `termui` (c7792a5d) +- add a "tui" alias for "termui" (c7792a5d) - enhance flag description (65d7ce7c) - add bridge configure completion scripts (77e60ace) - recover terminal state in password prompts (be947803) -- move cleaners to where is called (46f95734) +- move cleaners to where is called (46f95734) - add tokenStdin field to bridgeParams (f3d8da10) - update react-scripts (c56801b7) - fix a missing key (0020e608) @@ -771,9 +720,9 @@ git log --oneline 0.5.0..0.6.0 - fix minor grammar issues and clarify a bit (26b0a9c9) - reference git internals documentation (17e0c032) - fix integration tests (8498deaa) -- iterator now query all label events when NextLabelEvent() i called, and sort - them by ID (312bc58c) +- iterator now query all label events when NextLabelEvent() i called, and sort them by ID (312bc58c) - iterator use simple swap (ed774e4e) +- make the feature-list render as list in more Markdown flavors [fix] (61d94305) - try to describe the `OperationPack` format more clearly (98792a02) - config interface and implementation rework (ab935674) - add ReadTimestamp methods and improve naming (7f177c47) @@ -798,8 +747,7 @@ git log --oneline 0.5.0..0.6.0 - add missing error check in export tests (b1a76184) - improve iterator readability (bf84a789) - migrate to awesome-gocui instead of the old fork I had (cb8236c9) -- rework the cursor in bugtable to match the rendering before the switch to - awesome-gocui (965102f7) +- rework the cursor in bugtable to match the rendering before the switch to awesome-gocui (965102f7) - Implement token functionalities (a6ce5344) - comment token functionalities (56551b6a) - add bridge token subcommand (9370e129) @@ -808,12 +756,11 @@ git log --oneline 0.5.0..0.6.0 - various cleanups (3984919a) - use a hash as token identifier instead of the token it self (baefa687) - use entity.Id as id type (4dc7b8b0) -- store token in the global config and replace scopes with create date - (bbbf3c6c) +- store token in the global config and replace scopes with create date (bbbf3c6c) - regenerate documentation and fix imports (45653bd3) - various improvement on the global token PR (e2445edc) - add bridge token show (f8cf3fea) -- rename `token` into `auth` (e0b15ee7) +- rename "token" into "auth" (e0b15ee7) - update github.com/xanzy/go-gitlab to v0.22.0 (83eb7abd) - follow API changes (c1f33db2) - fix iterator regression (e3e37fd7) @@ -843,8 +790,8 @@ git log --oneline 0.5.0..0.6.0 - move export event handling to the CLI (1a1e313f) - fix incorrect last import time on context cancel (8f7f8956) - huge refactor to accept multiple kind of credentials (b92adfcb) -- Correctly cast configs\[configKeyKind\] (58c0e5aa) -- `user create` only assign the user identity if not set (da6591e4) +- Correctly cast configs[configKeyKind] (58c0e5aa) +- "user create" only assign the user identity if not set (da6591e4) - support self-hosted GitLab instance (f6b4830c) - allow to configure and pull without having set a user first (864d3ed3) - add missing baseUrl prompt and options (5cffb5d1) @@ -868,9 +815,9 @@ git log --oneline 0.4.0..0.5.0 ### Other changes +- **opencollective**: use tiers (090cd808) - minor cleaning (5653ae98) -- fix broken truncate with unicode and use the ellipsis character in - LeftPadMaxLine (5e744891) +- fix broken truncate with unicode and use the ellipsis character in LeftPadMaxLine (5e744891) - use the '↵' symbol to save screen space (ab970da4) - tighter column in the bug table (9c89cf5b) - slightly better error message (a133cdff) @@ -879,8 +826,7 @@ git log --oneline 0.4.0..0.5.0 - Add developer-specific information. (c31e7fba) - add more explanation about the dev process (63807382) - minor cleaning (47b2aa4c) -- upgrade npm dependencies to fix - https://nvd.nist.gov/vuln/detail/CVE-2018-16469 (8fc15a03) +- upgrade npm dependencies to fix https://nvd.nist.gov/vuln/detail/CVE-2018-16469 (8fc15a03) - now that it's possible, split the schema for clarity (0d5bd6b1) - hopefuly fix the handling of chinese (f9fc85ac) - fix a wrapping bug leading to line longer than they should (261aa617) @@ -895,11 +841,10 @@ git log --oneline 0.4.0..0.5.0 - fix handling of wide characters (32b3e263) - fix non determinist zsh comp generation (3f694195) - show: change for a single valued --field flag (43d0fe5c) -- use tiers (090cd808) - update the date in the generated doc (09692456) - output the build info message on stderr to avoid breaking scripts (d380b3c1) -- Add ls-id \[\] command (f70f38c8) -- Add ls-id \[\] command (3c0c13bb) +- Add ls-id [] command (f70f38c8) +- Add ls-id [] command (3c0c13bb) - fix unhandled error (0aefae6f) - implement the loading from git (06d9c687) - add metadata support (3df4f46c) @@ -926,15 +871,14 @@ git log --oneline 0.4.0..0.5.0 - fix typo (b59623a8) - fix 3 edge-case failures (e100ee9f) - simplify some code (268f6175) -- fix ResolveIdentityImmutableMetadata byt storing metadata in IdentityExcerpt - (8bba6d14) -- add a super-fast `user ls` command (7a80d8f8) -- add a `user adopt` command to use an existing identity (304a3349) -- add a `.` at the end of Short commands usage (2fd5f71b) +- fix ResolveIdentityImmutableMetadata byt storing metadata in IdentityExcerpt (8bba6d14) +- add a super-fast "user ls" command (7a80d8f8) +- add a "user adopt" command to use an existing identity (304a3349) +- add a "." at the end of Short commands usage (2fd5f71b) - another round of cleanups (46beb4b8) -- show the last modification time in `user` (c235d89d) +- show the last modification time in "user" (c235d89d) - better API to access excerpts (bad05a4f) -- `user ls` also show metadata (f6eb8381) +- "user ls" also show metadata (f6eb8381) - fix potential bug due to var aliasing (b6bed784) - `git bug ls` should be faster (43e56692) - make the title filter case insensitive (40865451) @@ -942,10 +886,9 @@ git log --oneline 0.4.0..0.5.0 - don't make bug actions drive identity actions (a40dcc8a) - add basic unit testing (d27e3849) - properly push/pull identities and bugs (24d6714d) -- only return the error (not the function help) when no identity is set - (bdf8523d) -- fix a bad output in `bug comment` (029861fa) -- display comment's id in `git bug comment` (0a71e6d2) +- only return the error (not the function help) when no identity is set (bdf8523d) +- fix a bad output in "bug comment" (029861fa) +- display comment's id in "git bug comment" (0a71e6d2) - Upgrade dependencies (67c84af4) - Use Timeline API instead of raw operations (850b9db8) - Rework timeline style (22089b5e) @@ -953,10 +896,9 @@ git log --oneline 0.4.0..0.5.0 - expose allIdentities, identities and userIdentity in the repo (15c258cd) - Fix and match for labels (1d758f9f) - add a push/pull test (96987bf6) -- fix labels no showing properly in `git bug show -f labels` (a64aaacc) -- add `show --field humanId` (96d356a3) -- add a --field flag to `git bug user` to display users details individually - (5b0a92de) +- fix labels no showing properly in "git bug show -f labels" (a64aaacc) +- add "show --field humanId" (96d356a3) +- add a --field flag to "git bug user" to display users details individually (5b0a92de) - make Bug's actors and participants a connection (e027d5ee) - fix test indentation (5733178a) - expose valid labels (14461060) @@ -978,11 +920,6 @@ run the following command: git log --oneline 0.3.0..0.4.0 ``` -### Bug fixes - -- build (a37a5320) -- js formatting with prettier (e89375f2) - ### Documentation - update manpages due to change of month (95021a07) @@ -997,14 +934,14 @@ git log --oneline 0.3.0..0.4.0 - add `git bug comment add` to add a comment (6cdc6c08) - add a title command to display a bug's title (d9f72695) - add a title edit command (ae100e0e) -- make the `commands` command show subcommands as well (b9fc8b66) -- add a `status` command to show a bug status (a846fb96) -- migrate the open/close commands under the `status` command (dad61892) -- make `label` display the current labels (cc086eba) -- add a `label add` command to add new label to a bug (2965b70f) -- add a `label rm` command to remove labels from a bug (5eaf9e83) +- make the "commands" command show subcommands as well (b9fc8b66) +- add a "status" command to show a bug status (a846fb96) +- migrate the open/close commands under the "status" command (dad61892) +- make "label" display the current labels (cc086eba) +- add a "label add" command to add new label to a bug (2965b70f) +- add a "label rm" command to remove labels from a bug (5eaf9e83) - add a package to handle implicit bug selection (0d5998eb) -- add a `select` command to select a bug for future implicit use (5f9fd2a2) +- add a "select" command to select a bug for future implicit use (5f9fd2a2) - convert compatible commands to the implicit select mechanism (544b9cc0) - readBug returns better errors (84555679) - don't ignore error when building the cache (760d0771) @@ -1012,16 +949,15 @@ git log --oneline 0.3.0..0.4.0 - explain how to quit (2daf2ddc) - relay early the merge events (63d0b8b7) - don't stop the process when one merge fail (4c576470) -- reclassify some merge error as `invalid` instead of hard error (1060acfd) +- reclassify some merge error as "invalid" instead of hard error (1060acfd) - fix a panic on merge invalid (d57e2fdd) - ls now accept queries without quote (d71411f9) - update favicon with git-bug logo (386cc3d6) - workaround for git returning no path when inside a .git dir (8a038538) -- serve the index.html file by default to deal with the SPA router requirements - (7c63417e) +- serve the index.html file by default to deal with the SPA router requirements (7c63417e) - add the beginning of a github importer (1c86a66c) - description cleanup (cfce3a99) -- add a `ls-labels` command that output valid labels (6e447594) +- add a "ls-labels" command that output valid labels (6e447594) - make github 2FA work (6a575fbf) - split the Repo interface to avoid abstraction leak in RepoCache (82eaceff) - better interfaces, working github configurator (921cd18c) @@ -1029,21 +965,20 @@ git log --oneline 0.3.0..0.4.0 - cleanup file name (a122d533) - add functions to read/write git config (666586c5) - big refactor and cleanup (5e8fb7ec) -- add the `bridge` and `bridge configure` commands (43bda202) -- add `bridge rm` (061e83d4) -- add `bridge pull` (2282cbb5) +- add the "bridge" and "bridge configure" commands (43bda202) +- add "bridge rm" (061e83d4) +- add "bridge pull" (2282cbb5) - validate config before use (c86e7231) - query most of the data (c4a20762) - add the ability to store arbitrary metadata on an operation (a72ea453) - add the optional field AvatarUrl to Person (5d7c3a76) -- add raw edit functions to allow setting up the author, the timestamp and the - metadatas (40c6e64e) +- add raw edit functions to allow setting up the author, the timestamp and the metadatas (40c6e64e) - add a target producing a debugger friendly build (25bec8eb) - first working github importer (879e147e) - add a general test for the handler/resolvers (f9693709) - detect when the title is not changed and abort the operation (ac29b825) - detect when an edit title doesn't change it and abort the operation (18f5c163) -- add a `deselect` command to deselect a previously selected bug (04ddeef9) +- add a "deselect" command to deselect a previously selected bug (04ddeef9) - don't forget to treat the error when selecting a bug (86792d78) - clear the selected bug when invalid (66f3b37c) - better responsive columns in the bug table (5b3a8f01) @@ -1061,20 +996,18 @@ git log --oneline 0.3.0..0.4.0 - use a value embedding for OpBase (3402230a) - add a test for OpBase metadata (bda9b01b) - add a test for operations hash (97d94948) -- `bridge` don't take arguments (a4be82ca) +- "bridge" don't take arguments (a4be82ca) - also index the first op metadata (be59fe0d) - add a new no-op operation to store arbitrary metadata on a bug (de81ed49) - also clear the cache after deleting the bugs (aea85f04) - custom error for the different error case when loading a bug (f026f61a) -- in op convenience function, return the new op to be able to set metadata later - (6ea6f361) +- in op convenience function, return the new op to be able to set metadata later (6ea6f361) - message can be empty on edit comment (0fe7958a) - make sure to invalidate the hash when changing an op's metadata (f18c2d27) - working incremental + comment history for the first comment (8ec1dd09) - incremental import of comments + editions (892c25aa) - incremental import for labels, title edition, status changes (b5025a51) -- better multi choice prompt to select the target for `bridge configure` - (f37155d0) +- better multi choice prompt to select the target for "bridge configure" (f37155d0) - explain better what happen with the user credentials (f4643632) - handle the case where no diff is available for a comment edition (558e149b) - deal with the deleted user case where github return a null actor (64133ee5) @@ -1083,11 +1016,9 @@ git log --oneline 0.3.0..0.4.0 - update packed files (e414a0e3) - some cleanup in the label edition code (7275280d) - don't load the repo for commands that don't need it (7a511f9a) -- fix `comment add` flags set on the wrong command (b08e28e6) -- check the bug id before the user write the message for `comment add` - (f67c57c0) -- unify the processing from editor/file/stdin for `add` and `comment add` - (d37ffa6b) +- fix "comment add" flags set on the wrong command (b08e28e6) +- check the bug id before the user write the message for "comment add" (f67c57c0) +- unify the processing from editor/file/stdin for "add" and "comment add" (d37ffa6b) - add a new SetMetadataOperation to retroactively tag operations (82701f8c) ## 0.3.0 (2018-09-13) @@ -1099,10 +1030,6 @@ run the following command: git log --oneline 0.2.0..0.3.0 ``` -### Bug fixes - -- english grammar (30d4bc21) - ### Documentation - fix some typos (73bd0f4a) @@ -1126,10 +1053,8 @@ git log --oneline 0.2.0..0.3.0 - a bit of styling (fd268767) - more styling (94217828) - lock the repo with a pid file; automatic cleaning (6d7dc465) -- introduce WithSnapshot to maintain incrementally and effitiently a snapshot - (16f55e3f) -- add a new BugExerpt that hold a subset of a bug state for efficient sorting - and retrieval (e7648996) +- introduce WithSnapshot to maintain incrementally and effitiently a snapshot (16f55e3f) +- add a new BugExerpt that hold a subset of a bug state for efficient sorting and retrieval (e7648996) - maintain, write and load from disk bug excerpts (0514edad) - add name to web app manifest. (11ad7776) - rename RootCache into MultiRepoCache (90a45b4c) @@ -1146,8 +1071,7 @@ git log --oneline 0.2.0..0.3.0 - only print once the error (6f1767d1) - various cleaning (f136bf6a) - clean outdated build tag (265ecd81) -- refactor the Pull code to have the message formating in the upper layers - (61a1173e) +- refactor the Pull code to have the message formating in the upper layers (61a1173e) - refactor to handle bug changes during Pull (6d7e79a2) - add a function to parse a status (877f3bc2) - add a function to test the matching of a query (13797c3b) @@ -1157,12 +1081,12 @@ git log --oneline 0.2.0..0.3.0 - accept a query to sort and filter the list (dd0823dd) - add an example of query (71bee1e6) - properly parse and clean qualifier with multi word (0dc70533) -- add the alias `state` for the qualifier `status` (ece9e394) +- add the alias "state" for the qualifier "status" (ece9e394) - doc & cleaning (c8239a99) - support expressing a query with flags as well (9bb980e9) - ensure that OpBase field are public and properly serialized (2dcd06d1) - resolved id by prefix using the cache instead of reading bugs (d1c5015e) -- use Esc key to quit instead of 'q' to free it for a `query` feature (30e38aab) +- use Esc key to quit instead of 'q' to free it for a "query" feature (30e38aab) - allow to change the bug query (9cbd5b4e) - AllBugs now accept a query (7b05983c) - change the OperationPack serialization format for Json (60fcfcdc) @@ -1182,11 +1106,6 @@ run the following command: git log --oneline 0.1.0..0.2.0 ``` -### Bug fixes - -- some linting trouble (df144e72) -- tests (1e9f2a9d) - ### Other changes - revamp the bug list (5edcb6c8) @@ -1198,7 +1117,7 @@ git log --oneline 0.1.0..0.2.0 - reorganize the code (2530cee1) - rework of the bug page with a timeline (1984d434) - display label changes in the timeline + cleaning evrywhere (cf9e83e7) -- add `was` on SetTitleOperation to store what the title was (a4740937) +- add "was" on SetTitleOperation to store what the title was (a4740937) - display title changes in the timeline (17aa4050) - display status change in the timeline (11b79260) - pack it (f728a02a) @@ -1213,3 +1132,93 @@ git log --oneline 0.1.0..0.2.0 - cleanup (1e8e1af6) - pack it (e076931a) - create less bugs (eaef3149) + +## 0.1.0 (2018-08-12) + +To view the full set of changes, including internal developer-centric changes, +run the following command: + +``` +git log --oneline 0.1.0 +``` + +### Documentation + +- complete the model doc now that the code is more stable (28670ff8) + +### Other changes + +- multiple go version (81e15f07) +- use a 40 char truncated sha256 hash as ID, 8 char for human reading (fd4fa96c) +- more explanation of the concept (252cdab8) +- better output (1e4562e9) +- explain planned feature (7c5c567e) +- sort commands by name (451c3b30) +- add some colors (1332a6ec) +- add a primitive graphql handler (a2a50f3d) +- replace the uuid based id with the hash of the first commit (9f04fc2f) +- Actually get the bugs from the repo (1dd5118e) +- Add flag to specify which port to listen to (8f0bb154) +- Split into multiple, smaller components (4901bdad) +- add `allBugs` to root query (50fd2943) +- Basic bug list (6d855904) +- refactor to limit abstraction leak and to have a more reusable code for the UIs (17e2ec8f) +- fix merge procedure (cbdba927) +- fix fetch not working (49c90eab) +- add shortcut functions (7c6f9ef4) +- add codegov hook (0d649346) +- directly return a connection, cleaning (c351cfd3) +- fix marshaling of label (08f03ecf) +- lazy loading for the bug relay connection (c58aa18a) +- document hack (f0f92764) +- show graphql urls (64354c7c) +- fix knot in the graphql/gqlgen usage (5b70e345) +- use an interface instead of an union for the operations for easier query (79b3d189) +- implement a first mutation (3cb0469a) +- move the mutations to a root Mutation type (e14f1b42) +- interactive and responsible list of bugs (29bb7364) +- PgUp & PgDown to pagine the bug list as well (091ac03f) +- Use the new schema (8a4e373e) +- rework new and comment command to better use the editor (eb39c5c2) +- use the editor to create a new bug (87669e0f) +- add a reusable error popup, use it for badly formated bug creation (6b012b1e) +- fix a pagination off by one (2f88c28c) +- add a view to display a bug (c875d40e) +- simplify the requests with helpers (15f28242) +- implement the missing mutations (e5a6a71b) +- some refactoring (e6a64b49) +- implement addComment and setTitle (ae1ed6c1) +- show the last edit in a dedicated column (9488467c) +- add the http handlers for read/write git blob for media in comments (ed8f7eca) +- add a text wrapping function (5c86164f) +- more work on the show bug window (ba16fc10) +- configure cross-compile + deploy on github + codecov (90ccc94a) +- now I remember why i removed codegov (597b0ea0) +- store the referenced media in their own git tree under /media, as per the doc I wrote myself (90fb85e0) +- add a Lamport clock implementation as well as a persistable one (b2f20c9a) +- update names following the change of section (84131cb5) +- pack the files only on demand (d2f5e6b9) +- run the cross compile only when deploying (593891b8) +- add a Lamport logical clock to be able to sort bugs by creation time and edit time without having to rely on a timestamp (435be2b6) +- cleanup (ca4c829e) +- fix graphql queries (b8e9e581) +- fix an out of bound panic (1017f8c6) +- add the previous title in the template when editing (ad9e35e3) +- colors in the bug table (716b859f) +- selectable bloc (f1fa169c) +- add the go report card badge (8baa220f) +- implement scrolling by selecting block in show bug (204ca0a9) +- implement scrolling with pageUp / pageDown (bf0a855f) +- support text with color escape sequence (ca31258c) +- add a version with a left padding (0da2bea1) +- colors show bug (b6087d7e) +- commit the bug when quiting the show bug window (5675299c) +- better padding for show bug (de76b6fa) +- reset the scroll between show bug window (34eea1f4) +- display status and label changes in show bug (a0d509bc) +- fix the instructions being written on in show bug (f7ef5cdb) +- properly handle color sequence code even inside a word (b96819a8) +- implement left/right navigation in show bug (f51cc4a3) +- add and remove labels (53a3d5e1) +- fix scroll bug (721ed324) +- implement push/pull (e2f4b027) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2665fa7e326834f479c2ce55205ccf38d9c5797a..0cbc72b37cc3c141a931bc5f2b35b1ac5fa6332f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,12 +8,11 @@ getting started as a contributor to this project. - [Get the source code](#get-the-source-code) - [Software requirements](#software-requirements) - - [1.0 | Install nix](#10--install-nix) - - [2.0 | Enable `nix-command` and `flakes`](#20--enable-nix-command-and-flakes) - - [3.0 | Install and configure `direnv`](#30--install-and-configure-direnv) -- [4.0 | Post-installation tasks](#40--post-installation-tasks) - - [4.1 | Open a new shell](#41--open-a-new-shell) - - [4.2 | Test the development shell](#42--test-the-development-shell) + - [Install nix](#install-nix) + - [Install and configure `direnv`](#install-and-configure-direnv) +- [3.0 | Post-installation tasks](#30--post-installation-tasks) + - [3.1 | Open a new shell](#31--open-a-new-shell) + - [3.2 | Test the development shell](#32--test-the-development-shell) - [Useful development commands](#useful-development-commands) - [Submitting changes](#submitting-changes) - [Commit messages are the source of truth](#commit-messages-are-the-source-of-truth) @@ -30,7 +29,7 @@ Clone this repository to your system in a way you're comfortable with. Below, we show a command that clones the repository using SSH, and places it in `~/code/git-bug`. -``` +```bash git clone git@github.com:git-bug/git-bug ~/code/git-bug ``` @@ -49,7 +48,7 @@ installed. It is **strongly** encouraged to use `nix` when contributing to `git-bug` to remove the "it works on my machine" class of errors, and ensure you have a smoother experience passing the CI pipelines (wrt formatting and such). -While you can manually install the [tools and packages we use](./flake.nix) and +While you can manually install the [tools and packages we use](./shell.nix) and hack on this project on your own, you will miss out on the hermeticity and standardization that our development shell provides. You may end up fighting with failing CI pipelines more often, or have to figure out how to perform @@ -70,104 +69,79 @@ to install the dependencies for the development shell. ______________________________________________________________________ -### 1.0 | Install nix +### Install nix To install `nix`, you can follow [the official instructions][install/nix]. -We recommend following the instructions for `multi-user mode` where applicable, -instead of `single-user mode`. +We recommend following the instructions for `multi-user mode` where applicable. > [!IMPORTANT] > The rest of this document assumes you have successfully installed `nix`. ______________________________________________________________________ -### 2.0 | Enable `nix-command` and `flakes` - -`nix-command` and `flakes` are two optional configuration properties that we -depend on in order to provide the development shell. You'll need to make sure -that these are enabled. - -
-NixOS - -Add the following to your system configuration: - -
-nix.settings.experimental-features = [ "nix-command" "flakes" ];
-
- -
- -
-Other - -Add the following to `~/.config/nix.conf` or `/etc/nix/nix.conf`: - -
-experimental-features = nix-command flakes
-
- -
- -> [!IMPORTANT] -> The rest of this document assume you have enabled these options. - -______________________________________________________________________ - -### 3.0 | Install and configure `direnv` +### Install and configure `direnv` [`direnv`][install/direnv] can be used to automatically activate the development shell (using [`//:.envrc`][envrc]). It can be installed either with `nix`, or independently.
-With nix (suggested for users new to nix) +With nix-env (suggested for users new to nix) -
-nix --extra-experimental-options 'flakes nix-command' profile install nixpkgs\#direnv
-
+```bash +nix-env -iA direnv +``` Next, run the following commands to apply the **optional** configuration for direnv. Be sure to change references to `~/code/git-bug` if you have cloned the repository somewhere else. +> [!NOTE] +> The above command installs direnv in a non-deterministic way on your host +> system. To update it, you'll need to run `nix-env -uA direnv`. See +> `man nix-env-upgrade` for more information, or choose to install `direnv` in +> another way that is more compatible with the approach you take for your +> system. + Create a configuration file for direnv -
touch ~/.config/direnv/direnv.toml
+```bash +mkdir -p ~/.config/direnv && touch ~/.config/direnv/direnv.toml +``` Disable the warning for shells with longer load times _This is optional, but recommended, as it helps reduce visual clutter._ -
-nix run nixpkgs\#dasel -- -r toml -f ~/.config/direnv/direnv.toml \
-  put -t int -v 0 ".global.warn_timeout"
-
+```bash +nix-shell -p dasel --run \ + 'dasel -- -r toml -f ~/.config/direnv/direnv.toml put -t int -v 0 ".global.warn_timeout"' +``` Disable printing of the environment variables that change _This is optional, but recommended, as it helps reduce visual clutter._ -
-nix run nixpkgs\#dasel -- -r toml -f ~/.config/direnv/direnv.toml \
-  put -t bool -v true ".global.hide_env_diff"
-
+```bash +nix-shell -p dasel --run \ + 'dasel -- -r toml -f ~/.config/direnv/direnv.toml put -t bool -v true ".global.hide_env_diff"' +``` Configure automatic activation of the development shell _This is optional, but strongly recommended._ -
-nix run nixpkgs\#dasel -- -r toml -f ~/.config/direnv.toml \
-  put -v "~/code/git-bug/.envrc" ".whitelist.exact[]"
-
+```bash +nix-shell -p dasel --run \ + 'dasel -- -r toml -f ~/.config/direnv.toml put -v "~/code/git-bug/.envrc" ".whitelist.exact[]"' +``` Alternatively, simply run `direnv allow` after moving into the repository for the first time. > **IMPORTANT**
If you choose not to allow the shell to be automatically -> activated, you will need to type `nix develop` every time you want to activate +> activated, you will need to type `nix-shell` every time you want to activate > it, and this will swap you into bash and change your prompt. You'll have a far > better experience allowing `direnv` to automatically manage activation and > deactivation. @@ -175,75 +149,91 @@ the first time. Configure your shell This final step is crucial -- be sure to -[configure your shell][install/direnv/shell] for direnv. +[configure your shell][install/direnv/shell] for direnv, so that it is loaded +properly on shell initialization.
Using home-manager -
-programs.direnv = {
-  enable = true;
-  nix-direnv.enable = true;
+```nix
+{
+  programs.direnv = {
+    enable = true;
+    nix-direnv.enable = true;
 
-  # one of the following, depending on your shell
-  # enableZshIntegration = true;
-  # enableBashIntegration = true;
-  # enableFishIntegration = true;
-  # enableNushellIntegration = true;
+    # one of the following, depending on your shell
+    # enableZshIntegration = true;
+    # enableBashIntegration = true;
+    # enableFishIntegration = true;
+    # enableNushellIntegration = true;
 
-  config = {
-    hide_env_diff = true;
-    warn_timeout = 0;
+    config = {
+      hide_env_diff = true;
+      warn_timeout = 0;
 
-    whitelist.exact = [ "~/code/git-bug/.envrc" ];
+      whitelist.exact = [ "~/code/git-bug/.envrc" ];
+    };
   };
 }
-
+```
______________________________________________________________________ -## 4.0 | Post-installation tasks +## 3.0 | Post-installation tasks Congratulations! If you've reached this section of the documentation, chances are that you have a working development environment for contributing to this repository. Read below for some additional tasks you should complete. -### 4.1 | Open a new shell +### 3.1 | Open a new shell In order for the installation to take effect, you will need to open a new shell. It is recommended to do this and complete the test (described below) prior to closing the shell you ran the installation script in, just in case you run into issues and need to refer to any output it provided. -### 4.2 | Test the development shell +### 3.2 | Test the development shell To test that the development shell is active, you will need to move to the repository's directory. If you installed and properly configured `direnv` for automatic activation, the shell should activate upon changing directories. -``` +```bash { test -n "$IN_NIX_SHELL" && echo "ACTIVE"; } || echo "INACTIVE" ``` If you have activated the development shell, you will see `ACTIVE` printed to -the console. If you have not, you will see `INACTIVE` printed to the console. +the console. If you have not, you will see `INACTIVE` printed to the console. If +you did configure direnv to automatically load the shell, you may need to type +`direnv allow`. If you chose to not use `direnv`, you will need to manually type +`nix-shell`. ______________________________________________________________________ ## Useful development commands -- `make build` - build `git-bug` and output the binary at `./git-bug` - - `make build/debug` - build a debugger-friendly binary -- `make install` - build `git-bug`, and install it to `$GOPATH/bin` -- `nix fmt` - format everything (configured in [`//:treefmt.nix`][treefmt]) - - `nix fmt ` to restrict the scope to given directories or files - - _see `nix fmt --help` for more information_ -- `nix flake check` to run lint/format checks and all tests defined in - `//nix/checks` +- `make build` - build `git-bug` and output the binary at `./result/bin/git-bug` +- `make build/debug` - build a debugger-friendly binary build\` for rapid + iteration, +- `nix-build -A default` - build `git-bug` for your platform and output the + binary at `./result/bin/git-bug`. You can optionally tag it with a version by + adding + `--argstr version $(git describe --match 'v*' --always --dirty --broken)`. + - add `--arg debug true` to skip the test suite and build a debugger-friendly + binary that fetches the web interface from the filesystem, and contains the + symbol table and `DWARF` debug info + - optionally tag it with a version by adding the following flag: + `--argstr version $(git describe --match 'v*' --always --dirty --broken)` +- `nix-shell --run treefmt` - format everything + - `nix-shell --run 'treefmt '` to restrict the scope to given + directories or files + - _see `nix-shell --run 'treefmt --help'` for more information_ +- `make check` to run tests and lint/format checks +- `make format` to format all files - `go generate` - generate cli documentation and shell completion files - this is automatically executed by many `make` targets, e.g. `make build` - `go test ./commands -update` - update golden files used in tests @@ -291,6 +281,10 @@ subject and body is set as such: - The body is set to the contents of the PR description, otherwise known as the first comment in the "Discussion" tab +As such, maintainers may edit your PR title and description (the initial +comment) before merging. This is to make sure commits that land in `trunk` +messages have the appropriate context. + ### Draft vs Ready Pull Requests can be marked as "ready for review", or as a "draft". Drafts are @@ -352,4 +346,3 @@ ______________________________________________________________________ [install/direnv/shell]: https://github.com/direnv/direnv/blob/trunk/docs/hook.md [install/nix]: https://nix.dev/install-nix [issue/1364]: https://github.com/git-bug/git-bug/issues/1364 -[treefmt]: ./treefmt.nix diff --git a/INSTALLATION.md b/INSTALLATION.md index d4a2f4571777fbea77054d317475688acea51777..d9c5c2f7dacf54a4de3f2e49d48dd05fd75b456d 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -51,12 +51,8 @@ package manager common to all distributions. Below, you'll find a **non-exhaustive** list of commands that use common third party tools for installing packages from the AUR. -
Using aurutils -
aur sync git-bug-bin && pacman -Syu git-bug-bin
-
- -
Using yay -
yay -S git-bug-bin
+
Using pacman +
pacman -S git-bug
### Nixpkgs @@ -79,13 +75,15 @@ environment.systemPackages = with pkgs; [
-
Using nix profile -
nix profile install nixpkgs\#git-bug
+
Temporary installation with nix shell (flake) +
+nix shell nixpkgs#git-bug
+
-
Temporary installation with nix shell +
Temporary installation with nix-shell (stable)
-nix shell nixpkgs\#git-bug
+nix-shell -p git-bug
 
@@ -123,16 +121,7 @@ You can also build `git-bug` from source, if you wish. You'll need the following dependencies: - `git` -- `go` -- `make` - -Ensure that the `go` binary directory (`$GOPATH/bin`) is in your `PATH`. It is -recommended to set this within your shell configuration file(s), such as -`~/.zprofile` or `~/.bashrc`. - -``` -export PATH=$PATH:$(go env GOROOT)/bin:$(go env GOPATH)/bin -``` +- `nix` > [!NOTE] > The commands below assume you do not want to keep the repository on disk, and @@ -141,7 +130,7 @@ export PATH=$PATH:$(go env GOROOT)/bin:$(go env GOPATH)/bin > > As a result, the repository cloned during these steps will not contain the > full history. If that is important to you, clone the repository using the -> method you prefer, check out your preferred revision, and run `make install`. +> method you prefer. **First, create a new repository on disk:** @@ -203,13 +192,14 @@ selected: git checkout REPLACE-ME -Finally, run the install target from //:Makefile: +Finally, run the build target from //:Makefile:
-make install
+make build
 
-This will build git-bug and place it in your Go binary directory. +This will build git-bug and place it at `./result/bin/git-bug`. +Move this binary file to a location in your `PATH`.
@@ -230,13 +220,14 @@ Next, check out the tree you pulled: git checkout origin/HEAD -Finally, run the install target from //:Makefile: +Finally, run the build target from //:Makefile:
-make install
+make build
 
-This will build git-bug and place it in your Go binary directory. +This will build git-bug and place it at `./result/bin/git-bug`. +Move this binary file to a location in your `PATH`.
diff --git a/Makefile b/Makefile index e613dea639f7e9c01de297261000ac4096e34487..c86a1cec68cfd2acc7fc5693be5d4c9a5441fde9 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,38 @@ -UNAME_S := $(shell uname -s) XARGS:=xargs -r -ifeq ($(UNAME_S),Darwin) +ifeq ($(shell uname -s),Darwin) XARGS:=xargs endif -SYSTEM=$(shell nix eval --impure --expr 'builtins.currentSystem' --raw 2>/dev/null || echo '') - TAG:=$(shell git describe --match 'v*' --always --dirty --broken) LDFLAGS:=-X main.version="${TAG}" all: build -.PHONY: list-checks -list-checks: - @if test -z "$(SYSTEM)"; then echo "unable to detect system. is nix installed?" && exit 1; fi - @printf "Available checks for $(SYSTEM) (run all with \`nix flake check\`):\n" - @nix flake show --json 2>/dev/null |\ - dasel -r json -w plain '.checks.x86_64-linux.keys().all()' |\ - xargs -I NAME printf '\t%-20s %s\n' "NAME" "nix build .#checks.linux.NAME" - .PHONY: build build: - go generate - go build -ldflags "$(LDFLAGS)" . + @nix-build -A default --argstr version "$(TAG)" -# produce a debugger-friendly build +# the "debug" build includes a debugger-friendly binary, and fetches the webui +# from the filesystem instead of packing it into the binary .PHONY: build/debug build/debug: - go generate - go build -ldflags "$(LDFLAGS)" -gcflags=all="-N -l" . + @nix-build -A default --argstr version "$(TAG)" --arg debug true + +.PHONY: build/without-nix +build/without-nix: + @go generate + @npm run --prefix webui build + @go run webui/pack_webui.go + @go build -ldflags "$(LDFLAGS)" . -.PHONY: install -install: - go generate - go install -ldflags "$(LDFLAGS)" . +build/debug/without-nix: + @go generate + @npm run --prefix webui build + @go build -ldflags "$(LDFLAGS)" -gcflags=all="-N -l" . -.PHONY: releases -releases: - go generate - go run github.com/mitchellh/gox@v1.0.1 -ldflags "$(LDFLAGS)" -osarch '!darwin/386' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" +.PHONY: release +release: + @nix-build -A release --argstr version "$(TAG)" .PHONY: secure secure: @@ -48,16 +42,6 @@ secure: test: go test -v -bench=. ./... -.PHONY: pack-webui -pack-webui: - npm run --prefix webui build - go run webui/pack_webui.go - -# produce a build that will fetch the web UI from the filesystem instead of from the binary -.PHONY: debug-webui -debug-webui: - go build -ldflags "$(LDFLAGS)" -tags=debugwebui - .PHONY: clean-local-bugs clean-local-bugs: git for-each-ref refs/bugs/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d diff --git a/nix/checks/spelling.nix b/ci/checks/spelling.nix similarity index 52% rename from nix/checks/spelling.nix rename to ci/checks/spelling.nix index 033b633a02ae89dc1ea793e16fa6456934f05788..337629afbd5fe626ea59dfa84155b336e4ee43d2 100644 --- a/nix/checks/spelling.nix +++ b/ci/checks/spelling.nix @@ -1,14 +1,15 @@ -{ pkgs, src }: +{ + pkgs, + src ? ./../.., +}: -pkgs.runCommand "spelling" +pkgs.runCommand "check-spelling" { inherit src; nativeBuildInputs = with pkgs; [ codespell ]; description = "Check for spelling mistakes"; } '' - pushd $src - codespell --check-hidden */** - popd - touch $out + cd "$src" + codespell --disable-colors */** | tee $out '' diff --git a/ci/default.nix b/ci/default.nix new file mode 100644 index 0000000000000000000000000000000000000000..269a0f5d64fade5ca7684e32621e1971ebe17a3a --- /dev/null +++ b/ci/default.nix @@ -0,0 +1,185 @@ +{ + pins ? import ../.npins, + pkgs ? import (import ../.npins).nixpkgs { }, + lib ? pkgs.lib, + excludes ? [ ], + src ? ( + pkgs.nix-gitignore.gitignoreRecursiveSource [ + ../.gitignore + ../webui/.gitignore + ../webui/src/.gitignore + ] ../. + ), +}: +let + checksDir = ./checks; + + fmt = + let + treefmtEval = (import pins.treefmt).evalModule pkgs { + projectRootFile = ".git-blame-ignore-revs"; + + # be a little more verbsoe to see progress + settings.verbose = 1; + + # be a little more quiet if unmatched files are encountered (by default + # this is set to info, which always emits every single unmatched file) + settings.on-unmatched = "debug"; + + # files and directories that should be excluded + settings.global.excludes = + lib.lists.unique [ + "*.graphql" + "*.png" + "*.svg" + "*.txt" + ".npins/*" + "Makefile" + "misc/completion/*/*" + "webui/node_modules/*" + "webui/build" + + # generated files + "CHANGELOG.md" + "doc/man/*.1" # via //doc:generate.go + "doc/md/*" # via //doc:generate.go + ] + ++ excludes; + + # FORMATTERS + ####################################################################### + + programs.gofmt.enable = true; + programs.shfmt.enable = true; + programs.zizmor.enable = true; + programs.nixf-diagnose.enable = true; + programs.statix.enable = true; + + programs.mdformat = { + enable = true; + + plugins = + ps: with ps; [ + # add support for github flavored markdown + mdformat-gfm + mdformat-gfm-alerts + + # add the following comment before running the formatter to + # generate a table of contents in markdown files: + # + mdformat-toc + ]; + + settings = { + end-of-line = "lf"; + number = true; + wrap = 80; + }; + }; + + programs.nixfmt = { + enable = true; + strict = true; + }; + + # programs.biome = { + # enable = true; + # settings.formatter = { + # useEditorconfig = true; + # }; + # settings.javascript.formatter = { + # quoteStyle = "single"; + # semicolons = "always"; + # }; + # settings.json.formatter.enabled = false; + # }; + # settings.formatter.biome.excludes = [ "*.min.js" ]; + + programs.keep-sorted.enable = true; + + programs.yamlfmt = { + enable = true; + + settings.formatter = { + eof_newline = true; + include_document_start = true; + retain_line_breaks_single = true; + trim_trailing_whitespace = true; + }; + }; + + settings.formatter.markdown-code-runner = { + command = lib.getExe pkgs.markdown-code-runner; + options = + let + config = pkgs.writers.writeTOML "markdown-code-runner-config" { + presets.nixfmt = { + language = "nix"; + command = [ (lib.getExe pkgs.nixfmt) ]; + }; + + presets.go = { + language = "go"; + command = [ + "${pkgs.go}/bin/gofmt" + "{file}" + ]; + input_mode = "file"; + }; + + presets.bash = { + language = "bash"; + command = [ + (lib.getExe pkgs.shfmt) + "--binary-next-line" + "--case-indent" + "--simplify" + "--space-redirects" + "-" + ]; + }; + }; + in + [ "--config=${config}" ]; + includes = [ "*.md" ]; + excludes = [ "doc/md/*" ]; + }; + }; + + fs = lib.fileset; + checkFiles = fs.toSource { + root = ../.; + fileset = fs.difference ../. (fs.maybeMissing ../.git); + }; + in + { + shell = treefmtEval.config.build.devShell; + check = treefmtEval.config.build.check checkFiles; + }; +in +{ + # the treefmt shell is exported because the treefmt package is added to the + # development shell via //:shell.nix + inherit (fmt) shell; + + # checks is an attrset built from aggregating all of the non-golang tests + # (defined in //ci/checks). these are tests for things like formatting and + # spelling. + checks = { + fmt = fmt.check; + } + // lib.listToAttrs ( + map + (file: { + name = lib.removeSuffix ".nix" file; + value = import (checksDir + "/${file}") { inherit pkgs src; }; + }) + ( + builtins.attrNames ( + lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) ( + builtins.readDir checksDir + ) + ) + ) + ); +} diff --git a/default.nix b/default.nix new file mode 100644 index 0000000000000000000000000000000000000000..7377edd248fe93886b9e233450476af6ad0ad976 --- /dev/null +++ b/default.nix @@ -0,0 +1,206 @@ +{ + pkgs ? import (import ./.npins).nixpkgs { }, + version ? builtins.null, + debug ? false, +}: +let + # releaseTargets is a list of platforms (in the nix double format) to platforms + # in the `go tool dist list` format (that GOOS and GOOARCH expect). this is + # used to generate a list of release targets, and to include/exclude tests + # when building cross-platform and native binaries. + releaseTargets = { + aarch64-embedded = "linux/arm64"; + aarch64-multiplatform = "linux/arm64"; + aarch64-windows = "windows/arm64"; + riscv64 = "linux/riscv64"; + riscv64-embedded = "linux/riscv64"; + x86_64-linux = "linux/amd64"; + x86_64-windows = "windows/amd64"; + x86_64-darwin = "darwin/amd64"; + aarch64-darwin = "darwin/arm64"; + }; + + inherit (pkgs) lib; + + buildTarget = + { + platform ? pkgs.stdenv.hostPlatform.system, + version ? builtins.null, + release ? false, + }: + let + parts = lib.strings.splitString "/" releaseTargets."${platform}"; + suffix = lib.strings.concatStringsSep "-" parts; + goos = builtins.elemAt parts 0; + goarch = builtins.elemAt parts 1; + + isNative = platform == pkgs.stdenv.hostPlatform.system; + in + # git-bug does not currently have any direct or transitive C dependencies. + # as such, we do not need to use pkgsCross, which would introduce + # additional overhead, but does properly handle setting up different + # linkers and would be required if cgo is introduced. + pkgs.buildGoModule { + name = if isNative then "git-bug" else "git-bug-${suffix}"; + + src = lib.sources.cleanSourceWith { + filter = + name: type: + let + baseName = baseNameOf (toString name); + in + !( + ( + type == "directory" + && lib.any (n: n == baseName) [ + # keep-sorted start + ".direnv" + ".git" + ".githooks.d" + ".github" + ".npins" + "nix" + "webui/node_modules" + "webui/public" + "webui/src" + "webui/types" + # keep-sorted end + ] + ) + || (lib.any (n: n == baseName) [ + # keep-sorted start + ".codespellrc" + ".editorconfig" + ".envrc" + ".envrc.local" + ".git-blame-ignore-revs" + ".gitignore" + ".gitmessage" + ".mailmap" + ".pinact.yaml" + "Makefile" + "Maskfile.md" + "cliff.toml" + "default.nix" + "git-bug" # the binary built when using the go compiler directly + "shell-hook.bash" + "shell.nix" + # keep-sorted end + ]) + # swap, backup, and temporary files + || lib.strings.hasSuffix "~" baseName + || lib.strings.match "^\\.sw[a-z]$" baseName != null + || lib.strings.match "^\\..*\\.sw[a-z]$" baseName != null + # nix-build result symlinks + || (type == "symlink" && lib.strings.hasPrefix "result" baseName) + # misc stuff (sockets and such that don't belong in the store) + || (type == "unknown") + ); + src = ./.; + }; + + vendorHash = "sha256-F5E7Xu6t3f4rDaA8izqzR6ha8EHSdiQSHdj/LlVBAj0="; + + excludedPackages = [ + # keep-sorted start + "doc" + "misc" + "tests" + # keep-sorted end + ]; + + ldflags = + lib.optionals (!debug || release) [ + # keep-sorted start + "-s" # omit the symbol table + "-w" # omit DWARF debug info + # keep-sorted end + ] + ++ lib.optionals (version != builtins.null) [ "-X main.version=${version}" ]; + + # normally, pack the web ui for builds, but for debug builds, fetch it + # from the filesystem (this is what this build tag controls) + tags = lib.optionals (debug && !release) [ "debug" ]; + + flags = lib.optionals (debug && !release) [ + # enable debugger-friendly compiler options for non-release builds + "-gcflags=all='-N -l'" + ]; + + env = { + CGO_ENABLED = 0; # disable cgo to enable static builds + }; + + preBuild = lib.strings.concatLines ( + lib.optionals (!debug) [ + # TODO: embed //webui + ] + ++ [ + # keep-sorted start + "export GOARCH=${goarch}" + "export GOOS=${goos}" + # keep-sorted end + ] + ); + + postInstall = + let + extension = lib.optionalString (goos == "windows") ".exe"; + in + lib.optionalString release '' + if test -d $out/bin/${goos}_${goarch}; then + mv \ + $out/bin/${goos}_${goarch}/git-bug* \ + $out/bin/git-bug-${suffix}${extension} + rmdir $out/bin/${goos}_${goarch} + fi + + # the host-native binary when built on linux or macos + if test -x $out/bin/git-bug; then + mv $out/bin/git-bug $out/bin/git-bug-${suffix} + fi + ''; + + nativeCheckInputs = with pkgs; [ gitMinimal ]; + + doCheck = isNative && !debug; + + # skip tests that require the network + checkFlags = + let + e2eTests = [ + "TestValidateUsername/existing_organisation" + "TestValidateUsername/existing_organisation_with_bad_case" + "TestValidateUsername/existing_username" + "TestValidateUsername/existing_username_with_bad_case" + "TestValidateUsername/non_existing_username" + "TestValidateProject/public_project" + ]; + in + [ "-skip=^${lib.concatStringsSep "$|^" e2eTests}$" ]; + + meta = { + description = "Distributed bug tracker embedded in Git"; + homepage = "https://github.com/git-bug/git-bug"; + license = lib.licenses.gpl3Plus; + }; + }; +in +{ + # build target for the current system + default = buildTarget { inherit version; }; + + # this drv builds release binaries for every platform. the output directory + # contains all of the binaries uniquely named with their platform, suitable + # for uploading as release artifacts. + release = pkgs.symlinkJoin { + name = "git-bug-release-binaries"; + paths = map ( + platform: + buildTarget { + inherit platform version; + release = true; + } + ) (builtins.attrNames releaseTargets); + }; +} diff --git a/doc/design/bridges/jira.md b/doc/design/bridges/jira.md index c3a7f29f1e56211cee2a5c3321c9e7f4e9c15801..ae3c63cb43fbe73ebe7414cdcb23a16c84e78467 100644 --- a/doc/design/bridges/jira.md +++ b/doc/design/bridges/jira.md @@ -245,15 +245,15 @@ Here is an example configuration with all optional fields set ## To-Do list -- \[0cf5c71\] Assign git-bug to jira field on import -- \[8acce9c\] Download and cache workflow representation -- \[95e3d45\] Implement workflow gui -- \[c70e22a\] Implement additional query filters for import -- \[9ecefaa\] Create JIRA mock and add REST unit tests -- \[67bf520\] Create import/export integration tests -- \[1121826\] Add unit tests for utilities -- \[0597088\] Use OS keyring for credentials -- \[d3e8f79\] Don't count on the `Total` value in paginations +- [0cf5c71] Assign git-bug to jira field on import +- [8acce9c] Download and cache workflow representation +- [95e3d45] Implement workflow gui +- [c70e22a] Implement additional query filters for import +- [9ecefaa] Create JIRA mock and add REST unit tests +- [67bf520] Create import/export integration tests +- [1121826] Add unit tests for utilities +- [0597088] Use OS keyring for credentials +- [d3e8f79] Don't count on the `Total` value in paginations ## Using CURL to poke at your JIRA's REST API @@ -271,9 +271,8 @@ curl \ /rest/auth/1/session ``` -[!NOTE] -If you have a json pretty printer installed (`sudo apt install jq`), pipe the -output through through that to make things more readable: +[!NOTE] If you have a json pretty printer installed (`sudo apt install jq`), +pipe the output through through that to make things more readable: ``` curl --silent \ diff --git a/doc/design/data-model.md b/doc/design/data-model.md index 0553ed25de22d8805ae06fbdd7cf78fdf5d87970..a6216e610f8bebc44a6d188226b2f92363c4e5ad 100644 --- a/doc/design/data-model.md +++ b/doc/design/data-model.md @@ -113,7 +113,7 @@ Instead, we are going to use Lamport clock is a simple counter of events. This logical clock gives us a partial ordering: -- if L1 \< L2, L1 happened before L2 +- if L1 < L2, L1 happened before L2 - if L1 > L2, L1 happened after L2 - if L1 == L2, we can't tell which happened first: it's a concurrent edition @@ -204,7 +204,7 @@ Here is an example of such an ordering: We can see that: - Lamport clocks respect the DAG structure -- the final `Operation` order is \[A,B,C,D,E,F\], according to those clocks +- the final `Operation` order is [A,B,C,D,E,F], according to those clocks When we have concurrent editions, we apply a secondary ordering, based on the `OperationPack`'s identifier: diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 86a33fcc63c28cb5dbea4610f6aed4dc3a8642c1..0000000000000000000000000000000000000000 --- a/flake.lock +++ /dev/null @@ -1,133 +0,0 @@ -{ - "nodes": { - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1743550720, - "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "c621e8422220273271f52058f618c94e405bb0f5", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "fmt-pkgs": { - "locked": { - "lastModified": 1744932701, - "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1746141548, - "narHash": "sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds+hc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "f02fddb8acef29a8b32f10a335d44828d7825b78", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1743296961, - "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-parts": "flake-parts", - "flake-utils": "flake-utils", - "fmt-pkgs": "fmt-pkgs", - "nixpkgs": "nixpkgs", - "treefmt-nix": "treefmt-nix" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1746216483, - "narHash": "sha256-4h3s1L/kKqt3gMDcVfN8/4v2jqHrgLIe4qok4ApH5x4=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "29ec5026372e0dec56f890e50dbe4f45930320fd", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 0a4ada0d55fc7c9306c41af1f7b947f806bd9e5e..0000000000000000000000000000000000000000 --- a/flake.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - description = "workspace configuration for git-bug"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - flake-parts.url = "github:hercules-ci/flake-parts"; - - treefmt-nix = { - url = "github:numtide/treefmt-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - # A workaround for the currently-broken mdformat packages - fmt-pkgs.url = "github:nixos/nixpkgs/b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef"; - }; - - outputs = - { nixpkgs, ... }@inputs: - let - systems = inputs.flake-utils.lib.defaultSystems; - in - inputs.flake-parts.lib.mkFlake { inherit inputs; } { - inherit systems; - - imports = [ inputs.treefmt-nix.flakeModule ]; - - perSystem = - { pkgs, system, ... }: - let - fp = inputs.fmt-pkgs.legacyPackages.${system}; - in - { - treefmt = import ./treefmt.nix { pkgs = fp; }; - - checks = pkgs.lib.attrsets.mapAttrs' (f: _: { - name = pkgs.lib.strings.removeSuffix ".nix" f; - value = import ./nix/checks/${f} { - inherit pkgs; - src = ./.; - }; - }) (pkgs.lib.attrsets.filterAttrs (_: t: t == "regular") (builtins.readDir ./nix/checks)); - - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - codespell - delve - gh - git - git-cliff - go - golangci-lint - gopls - nodejs - pinact - ]; - - shellHook = builtins.readFile ./flake-hook.bash; - }; - }; - }; -} diff --git a/main.go b/main.go index 5b7a4caa6343152182bfd32492c48987ce71ad32..29c63e4eaf1676dbc665a3dbdd0ca535648509ed 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,3 @@ -//go:generate go run doc/generate.go -//go:generate go run misc/completion/generate.go - package main import ( diff --git a/nix/checks/pinact.nix b/nix/checks/pinact.nix deleted file mode 100644 index 109bd14f839812a694c275d4ced4f0fe4d5b3e3d..0000000000000000000000000000000000000000 --- a/nix/checks/pinact.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, src }: - -pkgs.runCommand "pinact" - { - inherit src; - nativeBuildInputs = with pkgs; [ pinact ]; - } - '' - cd "$src" - pinact run --check --verify - touch "$out" - '' diff --git a/flake-hook.bash b/shell-hook.bash similarity index 100% rename from flake-hook.bash rename to shell-hook.bash diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000000000000000000000000000000000000..488092c67a23d521fe97f3b215ed867a9c0b33d3 --- /dev/null +++ b/shell.nix @@ -0,0 +1,36 @@ +let + pkgs = import (import ./.npins).nixpkgs { }; + ci.shell = (import ./ci { inherit pkgs; }).shell; +in +pkgs.mkShellNoCC { + # because we're using mkShellNoCC, we should disable CGO in order to avoid + # errors when running various go tools (e.g. go generate and go build), which + # use cgo by default. + # + # we're able to do this because git-bug does not have any direct or indirect + # dependencies on cgo. + CGO_ENABLED = 0; + + # this ensures that nix commands use the pinned nixpkgs. + NIX_PATH = builtins.concatStringsSep ":" [ "nixpkgs=${builtins.storePath pkgs.path}" ]; + + NPINS_DIRECTORY = toString ./.npins; + + inputsFrom = [ ci.shell ]; + + nativeBuildInputs = with pkgs; [ + nixVersions.latest + npins + delve + gh + gitMinimal + git-cliff + go + golangci-lint + gopls + nodejs + pinact + ]; + + shellHook = builtins.readFile ./shell-hook.bash; +} diff --git a/treefmt.nix b/treefmt.nix deleted file mode 100644 index 61fcdf6df3ad87501f1cfadf8690df5e1d692620..0000000000000000000000000000000000000000 --- a/treefmt.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ - pkgs, - excludes ? [ ], - ... -}: -{ - projectRootFile = "flake.nix"; - - programs = { - gofmt = { - enable = true; - }; - - mdformat = { - enable = true; - - package = pkgs.mdformat.withPlugins ( - p: with p; [ - # add support for github flavored markdown - mdformat-gfm - mdformat-gfm-alerts - - # add support for markdown tables - mdformat-tables - - # add the following comment before running `nix fmt` to generate a - # table of contents in markdown files: - # - mdformat-toc - ] - ); - - settings = { - end-of-line = "lf"; - number = true; - wrap = 80; - }; - }; - - nixfmt = { - enable = true; - strict = true; - }; - - prettier = { - enable = true; - - settings = { - singleQuote = true; - trailingComma = "es5"; - }; - }; - - shfmt = { - enable = true; - }; - - yamlfmt = { - enable = true; - - settings.formatter = { - eof_newline = true; - include_document_start = true; - retain_line_breaks_single = true; - trim_trailing_whitespace = true; - }; - }; - }; - - settings.global.excludes = - pkgs.lib.lists.unique [ - "*.graphql" - "*.png" - "*.svg" - "*.txt" - "doc/man/*.1" # generated via //doc:generate.go - "doc/md/*" # generated via //doc:generate.go - "misc/completion/*/*" - "Makefile" - ] - ++ excludes; - - settings.formatter = { - prettier = { - excludes = [ - "*.md" - "*.yaml" - "*.yml" - ]; - }; - }; -} diff --git a/webui/.gitignore b/webui/.gitignore index d298bed47931c5d6b09defc376c08be3a6c478f2..0bfd7234dfd34f030adb9f9bb3b91a5ba1474de9 100644 --- a/webui/.gitignore +++ b/webui/.gitignore @@ -5,15 +5,16 @@ /build # testing -/coverage +coverage/ # misc .DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local +.envrc npm-debug.log* yarn-debug.log* yarn-error.log* + +# symlinks to nix-store output dirs, created by `nix-build` +/result +/result-* diff --git a/webui/.prettierrc b/webui/.prettierrc deleted file mode 100644 index c1a6f66713166020e90a73182ca967212bd18ea3..0000000000000000000000000000000000000000 --- a/webui/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "es5" -} diff --git a/webui/Makefile b/webui/Makefile index 4f59b35a257f88076233a23c295f03e74ba1bed9..2707e3a45ab4dae08a47363ce2af207d45b17a3c 100644 --- a/webui/Makefile +++ b/webui/Makefile @@ -5,7 +5,6 @@ install: npm install test: - npm run generate npm run lint CI=true npm run test diff --git a/webui/codegen.yaml b/webui/codegen.yaml index 51ebf3ffaaa57e11456a384900c5e300a0960948..f97ac8a654a08efc3db6b99396edc5b051822954 100644 --- a/webui/codegen.yaml +++ b/webui/codegen.yaml @@ -29,7 +29,3 @@ generates: withComponent: false withHOC: false withHooks: true - -hooks: - afterAllFileWrite: - - nix fmt diff --git a/webui/debug_assets.go b/webui/debug_assets.go index ffefbcabc974706452a3a108da514c40b9e1f3a1..c1340ae3619efaf69f10078299726a1f90961b23 100644 --- a/webui/debug_assets.go +++ b/webui/debug_assets.go @@ -1,4 +1,4 @@ -//go:build debugwebui +//go:build debug package webui diff --git a/webui/default.nix b/webui/default.nix new file mode 100644 index 0000000000000000000000000000000000000000..d2f4cf57cad97a2dbaa4f0dbf052bb6def528acf --- /dev/null +++ b/webui/default.nix @@ -0,0 +1,67 @@ +{ + pkgs ? import { }, + lib ? pkgs.lib, + ... +}: +let + api-schema = pkgs.stdenv.mkDerivation { + name = "git-bug-api-schema"; + src = ../api/graphql/schema; + + installPhase = '' + cp -r $src $out + ''; + }; +in +{ + default = pkgs.buildNpmPackage { + name = "git-bug-web-ui"; + npmDepsHash = "sha256-Mut8+2kiJgeM9KnKctFttQxeq7y0VkUCgpP0zo18Gxg="; + + dontStrip = false; + + src = pkgs.nix-gitignore.gitignoreRecursiveSource [ ./.gitignore ./src/.gitignore ] ( + lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.difference ./. ( + lib.fileset.unions [ + (lib.fileset.fileFilter ( + f: + lib.any (ext: f.hasExt ext) [ + # keep-sorted start + "go" + "md" + "nix" + # keep-sorted end + ] + ) ./.) + + # keep-sorted start + ./.gitignore + ./Makefile + ./src/.gitignore + # keep-sorted end + ] + ); + } + ); + + nativeBuildInputs = with pkgs; [ go ]; + + postUnpack = '' + mkdir -p api/graphql + cp -r "${api-schema}" "api/graphql/schema" + ''; + + postInstall = '' + pwd + cp -rv build/ $out + ''; + + meta = { + description = "Web interface for git-bug, a distributed issue tracker"; + homepage = "https://github.com/git-bug/git-bug"; + license = lib.licenses.gpl3Plus; + }; + }; +} diff --git a/webui/pack_webui.go b/webui/pack_webui.go index 91e2053f3549fe6712a2feb6aaef156566d2a4b8..e5c765cf09717920d70bc6fb10e7a694def3037a 100644 --- a/webui/pack_webui.go +++ b/webui/pack_webui.go @@ -28,7 +28,7 @@ func main() { err := vfsgen.Generate(webUIAssets, vfsgen.Options{ Filename: "webui/packed_assets.go", PackageName: "webui", - BuildTags: "!debugwebui", + BuildTags: "!debug", VariableName: "WebUIAssets", }) diff --git a/webui/package.json b/webui/package.json index ab47e2effafb12c9c3a28b6ef2419bacb16a62e2..9cfa5b582e505863458d76f5e8e4bc1cec3b51fa 100644 --- a/webui/package.json +++ b/webui/package.json @@ -48,12 +48,11 @@ "typescript": "^4.9.5" }, "scripts": { - "start": "npm run generate && react-scripts start", - "build": "npm run generate && react-scripts build", - "test": "react-scripts test --env=jsdom", + "start": "graphql-codegen && react-scripts start", + "build": "graphql-codegen && react-scripts build", + "test": "graphql-codegen && react-scripts test --env=jsdom", "eject": "react-scripts eject", - "generate": "graphql-codegen", - "lint": "eslint src --ext .ts --ext .tsx --ext .js --ext .jsx --ext .graphql", + "lint": "graphql-codegen && eslint src --ext .ts --ext .tsx --ext .js --ext .jsx --ext .graphql", "clean": "rimraf src/**.generated.* src/schema.json src/gqlTypes.* src/fragmentTypes.*" }, "proxy": "http://localhost:3001",