Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ on:
branches: [master, develop]

jobs:
treefmt:
name: Run treefmt
environment: cachix # for secrets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v14.1
- uses: cachix/cachix-action@v10
with:
name: wire-server
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install treefmt and nixpkgs-fmt (without pulling in all of dev-env)
run: nix-env -if nix/default.nix -iA pkgs.treefmt pkgs.nixpkgs-fmt pkgs.shellcheck
- name: Run treefmt
run: treefmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This github action is unnecessary, as linters already run make lint-all here: https://github.com/zinfra/cailleach/blob/ab3a921c7a6cc903c0d1d578040e05a566c84bfa/wire-server-private/ci/pipelines/jobs/linters.dhall#L40-L60

please remove this github actions block. Also, we agreed to not introduce more github actions if not strictly necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep these 20 lines of yaml.

  • They're not a big maintenance burden, as it simply invokes treefmt after installing the dependencies.
  • Very quick feedback (40 seconds)
  • No requirement to log into concourse, so useful feedback for external contributors

It would be a different thing if we'd start to model complicated logic in GH actions, but this simply executes a script to give semi-instant feedback.

It looks like Concourse also does it, because it's invoked in the lint-all target from the Makefile, but it's way less accessible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it spams emails and re-does something that is already done, giving twice the amount of linting feedback for the same issue. To me, this is just noise and unnecessary. Maybe someone else has an opinion here also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change if GH actions should send you emails on failure in your notification settings:

image


build-docs:
name: Build docs
environment: cachix
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ghcid:

# Used by CI
.PHONY: lint-all
lint-all: formatc hlint-check-all shellcheck check-local-nix-derivations
lint-all: formatc hlint-check-all check-local-nix-derivations treefmt

.PHONY: hlint-check-all
hlint-check-all:
Expand Down Expand Up @@ -171,9 +171,9 @@ add-license:
@echo ""
@echo "you might want to run 'make formatf' now to make sure ormolu is happy"

.PHONY: shellcheck
shellcheck:
./hack/bin/shellcheck.sh
.PHONY: treefmt
treefmt:
treefmt

#################################
## docker targets
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/treefmt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use treefmt to ensure consistent formatting of .nix files, use for shellcheck too (#2831)
5 changes: 4 additions & 1 deletion hack/bin/generate-local-nix-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "$cabalFiles" \

# shellcheck disable=SC2016
echo "$cabalFiles" \
| xargs -I {} bash -c 'cd $(dirname {}); cabal2nix . --no-hpack --extra-arguments gitignoreSource | sed "s/.\/./gitignoreSource .\/./g" >> default.nix'
| xargs -I {} bash -c 'cd $(dirname {}); cabal2nix . --no-hpack --extra-arguments gitignoreSource | sed "s/.\/./gitignoreSource .\/./g" >> default.nix; nixpkgs-fmt default.nix &> /dev/null'

overridesFile="$ROOT_DIR/nix/local-haskell-packages.nix"

Expand All @@ -30,3 +30,6 @@ cat "$warningFile" <(echo "{ gitignoreSource }: hsuper: hself: {") > "$overrides
echo "$cabalFiles" \
| xargs -I {} bash -c 'name=$(basename {} | sed "s|.cabal||"); echo " $name = hself.callPackage $(realpath --relative-to='"$ROOT_DIR/nix"' "$(dirname {})")/default.nix { inherit gitignoreSource; };"' >> "$overridesFile"
echo "}" >> "$overridesFile"

# ensure the file is formatted
nixpkgs-fmt "$overridesFile" &> /dev/null
50 changes: 0 additions & 50 deletions hack/bin/shellcheck.sh

This file was deleted.

92 changes: 77 additions & 15 deletions libs/api-bot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,89 @@
# This file is generated by running hack/bin/generate-local-nix-packages.sh and
# must be regenerated whenever local packages are added or removed, or
# dependencies are added or removed.
{ mkDerivation, aeson, ansi-terminal, api-client, async, attoparsec
, base, base64-bytestring, bilge, bytestring, bytestring-conversion
, cereal, containers, cryptobox-haskell, cryptonite, exceptions
, filepath, gitignoreSource, HaskellNet, HaskellNet-SSL
, http-client, imports, iso639, lib, memory, metrics-core, mime
, monad-control, mwc-random, optparse-applicative, resource-pool
, stm, text, time, tinylog, transformers-base, types-common
, unordered-containers, uuid, vector
{ mkDerivation
, aeson
, ansi-terminal
, api-client
, async
, attoparsec
, base
, base64-bytestring
, bilge
, bytestring
, bytestring-conversion
, cereal
, containers
, cryptobox-haskell
, cryptonite
, exceptions
, filepath
, gitignoreSource
, HaskellNet
, HaskellNet-SSL
, http-client
, imports
, iso639
, lib
, memory
, metrics-core
, mime
, monad-control
, mwc-random
, optparse-applicative
, resource-pool
, stm
, text
, time
, tinylog
, transformers-base
, types-common
, unordered-containers
, uuid
, vector
}:
mkDerivation {
pname = "api-bot";
version = "0.4.2";
src = gitignoreSource ./.;
libraryHaskellDepends = [
aeson ansi-terminal api-client async attoparsec base
base64-bytestring bilge bytestring bytestring-conversion cereal
containers cryptobox-haskell cryptonite exceptions filepath
HaskellNet HaskellNet-SSL http-client imports iso639 memory
metrics-core mime monad-control mwc-random optparse-applicative
resource-pool stm text time tinylog transformers-base types-common
unordered-containers uuid vector
aeson
ansi-terminal
api-client
async
attoparsec
base
base64-bytestring
bilge
bytestring
bytestring-conversion
cereal
containers
cryptobox-haskell
cryptonite
exceptions
filepath
HaskellNet
HaskellNet-SSL
http-client
imports
iso639
memory
metrics-core
mime
monad-control
mwc-random
optparse-applicative
resource-pool
stm
text
time
tinylog
transformers-base
types-common
unordered-containers
uuid
vector
];
description = "(Internal) API automation around wire-client";
license = lib.licenses.agpl3Only;
Expand Down
63 changes: 54 additions & 9 deletions libs/api-client/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,67 @@
# This file is generated by running hack/bin/generate-local-nix-packages.sh and
# must be regenerated whenever local packages are added or removed, or
# dependencies are added or removed.
{ mkDerivation, aeson, async, base, bilge, bytestring
, bytestring-conversion, connection, cookie, data-default-class
, errors, exceptions, gitignoreSource, http-client, http-types
, imports, lib, mime, retry, text, time, tinylog, transformers
, types-common, unliftio, unordered-containers, uuid, websockets
{ mkDerivation
, aeson
, async
, base
, bilge
, bytestring
, bytestring-conversion
, connection
, cookie
, data-default-class
, errors
, exceptions
, gitignoreSource
, http-client
, http-types
, imports
, lib
, mime
, retry
, text
, time
, tinylog
, transformers
, types-common
, unliftio
, unordered-containers
, uuid
, websockets
, wire-api
}:
mkDerivation {
pname = "api-client";
version = "0.4.2";
src = gitignoreSource ./.;
libraryHaskellDepends = [
aeson async base bilge bytestring bytestring-conversion connection
cookie data-default-class errors exceptions http-client http-types
imports mime retry text time tinylog transformers types-common
unliftio unordered-containers uuid websockets wire-api
aeson
async
base
bilge
bytestring
bytestring-conversion
connection
cookie
data-default-class
errors
exceptions
http-client
http-types
imports
mime
retry
text
time
tinylog
transformers
types-common
unliftio
unordered-containers
uuid
websockets
wire-api
];
description = "(Internal) Wire HTTP API Client";
license = lib.licenses.agpl3Only;
Expand Down
56 changes: 47 additions & 9 deletions libs/bilge/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,59 @@
# This file is generated by running hack/bin/generate-local-nix-packages.sh and
# must be regenerated whenever local packages are added or removed, or
# dependencies are added or removed.
{ mkDerivation, aeson, ansi-terminal, base, bytestring
, case-insensitive, cookie, errors, exceptions, gitignoreSource
, http-client, http-types, imports, lens, lib, monad-control, mtl
, text, tinylog, transformers-base, types-common, unliftio
, uri-bytestring, wai, wai-extra
{ mkDerivation
, aeson
, ansi-terminal
, base
, bytestring
, case-insensitive
, cookie
, errors
, exceptions
, gitignoreSource
, http-client
, http-types
, imports
, lens
, lib
, monad-control
, mtl
, text
, tinylog
, transformers-base
, types-common
, unliftio
, uri-bytestring
, wai
, wai-extra
}:
mkDerivation {
pname = "bilge";
version = "0.22.0";
src = gitignoreSource ./.;
libraryHaskellDepends = [
aeson ansi-terminal base bytestring case-insensitive cookie errors
exceptions http-client http-types imports lens monad-control mtl
text tinylog transformers-base types-common unliftio uri-bytestring
wai wai-extra
aeson
ansi-terminal
base
bytestring
case-insensitive
cookie
errors
exceptions
http-client
http-types
imports
lens
monad-control
mtl
text
tinylog
transformers-base
types-common
unliftio
uri-bytestring
wai
wai-extra
];
description = "Library for composing HTTP requests";
license = lib.licenses.agpl3Only;
Expand Down
Loading