Skip to content

Commit d344268

Browse files
Nixify the project (#8)
1 parent 15721c7 commit d344268

File tree

9 files changed

+141
-27
lines changed

9 files changed

+141
-27
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; https://editorconfig.org
2+
root = true
3+
4+
; default configuration
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
indent_style = unset
11+
12+
[*.nix,flake.lock]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.md]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.{yml,yaml}]
21+
indent_style = space
22+
indent_size = 2
23+
24+
25+
[*.go,go.mod,go.sum]
26+
indent_style = tab

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/ci.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/main.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: main
2+
on:
3+
pull_request:
4+
branches: [main]
5+
push:
6+
branches: [main]
7+
env:
8+
CI_NIX_STORE: ~/nix
9+
CI_NIX_FLAKE: .#default
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Setup Nix
17+
uses: cachix/install-nix-action@v20
18+
- name: Cache Nix
19+
uses: actions/cache@v3
20+
with:
21+
path: ${{ env.CI_NIX_STORE }}
22+
key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }}
23+
- name: Cache Go
24+
uses: actions/cache@v3
25+
with:
26+
key: ${{ runner.os }}-go-${{ hashfiles('go.mod', 'go.sum') }}
27+
path: |
28+
~/.cache/go-build
29+
~/go/pkg/mod
30+
- name: Test
31+
run: |
32+
nix --store ${{ env.CI_NIX_STORE }} \
33+
develop ${{ env.CI_NIX_FLAKE }} --command \
34+
go test -v -cover -race ./...
35+
lint:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
- name: Setup Nix
41+
uses: cachix/install-nix-action@v20
42+
- name: Cache Nix
43+
uses: actions/cache@v3
44+
with:
45+
path: ${{ env.CI_NIX_STORE }}
46+
key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }}
47+
- name: Lint
48+
run: |
49+
nix --store ${{ env.CI_NIX_STORE }} \
50+
develop ${{ env.CI_NIX_FLAKE }} --command \
51+
editorconfig-checker && echo "ok"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Gostman [![Go Reference](https://pkg.go.dev/badge/github.com/injustease/gostman.svg)](https://pkg.go.dev/github.com/injustease/gostman) [![ci](https://github.com/injustease/gostman/actions/workflows/ci.yml/badge.svg)](https://github.com/injustease/gostman/actions/workflows/ci.yml)
1+
# gostman [![Go Reference](https://pkg.go.dev/badge/github.com/minizilla/gostman.svg)](https://pkg.go.dev/github.com/minizilla/gostman) [![main](https://github.com/minizilla/gostman/actions/workflows/main.yaml/badge.svg)](https://github.com/minizilla/gostman/actions/workflows/main.yaml)
22

33
[Postman](https://www.postman.com/) like inside [Go](https://golang.org/) testing.
44

55
## Install
66

7-
Just import Gostman to your test package.
7+
Just import gostman to your test package.
88

99
```go
1010
import github.com/injustease/gostman
@@ -20,7 +20,7 @@ func TestMain(m *testing.M) {
2020
}
2121
```
2222

23-
*Optional*. Create Gostman environment file `.gostman.env.yml` if using variable.
23+
*Optional*. Create gostman environment file `.gostman.env.yml` if using variable.
2424

2525
```yml
2626
myenv:
@@ -62,7 +62,7 @@ func TestRequest(t *testing.T) {
6262
Leverage `go test` command to run the above requests.
6363

6464
```sh
65-
go test # run all Gostman requests in the package
65+
go test # run all gostman requests in the package
6666
go test -run Request # run all collection in the TestRequest
6767
go test -run Request/AnotherRequest # run only AnotherRequest
6868
go test -run Request -env myenv # run request and use "myenv" environment

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.0
1+
v0.1.0

examples/postman/.gostman.env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
postman:
22
username: postman
3-
password: password
3+
password: password

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
description = "Gostman - Postman nuances in Go Test";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
9+
in
10+
{
11+
devShells = forAllSystems (system:
12+
let
13+
pkgs = nixpkgs.legacyPackages.${system};
14+
in
15+
{
16+
default = pkgs.mkShell {
17+
name = "gostman";
18+
shellHook = ''
19+
git config pull.rebase true
20+
${pkgs.neo-cowsay}/bin/cowsay -f sage "Gostman - Postman nuances in Go Test"
21+
'';
22+
buildInputs = with pkgs; [
23+
editorconfig-checker
24+
go
25+
];
26+
};
27+
}
28+
);
29+
};
30+
}

0 commit comments

Comments
 (0)