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
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; https://editorconfig.org
root = true

; default configuration
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = unset

[*.nix,flake.lock]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 2

[*.{yml,yaml}]
indent_style = space
indent_size = 2


[*.go,go.mod,go.sum]
indent_style = tab
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: main
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
CI_NIX_STORE: ~/nix
CI_NIX_FLAKE: .#default
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Nix
uses: cachix/install-nix-action@v20
- name: Cache Nix
uses: actions/cache@v3
with:
path: ${{ env.CI_NIX_STORE }}
key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }}
- name: Cache Go
uses: actions/cache@v3
with:
key: ${{ runner.os }}-go-${{ hashfiles('go.mod', 'go.sum') }}
path: |
~/.cache/go-build
~/go/pkg/mod
- name: Test
run: |
nix --store ${{ env.CI_NIX_STORE }} \
develop ${{ env.CI_NIX_FLAKE }} --command \
go test -v -cover -race ./...
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Nix
uses: cachix/install-nix-action@v20
- name: Cache Nix
uses: actions/cache@v3
with:
path: ${{ env.CI_NIX_STORE }}
key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }}
- name: Lint
run: |
nix --store ${{ env.CI_NIX_STORE }} \
develop ${{ env.CI_NIX_FLAKE }} --command \
editorconfig-checker && echo "ok"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 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)
# 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)

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

## Install

Just import Gostman to your test package.
Just import gostman to your test package.

```go
import github.com/injustease/gostman
Expand All @@ -20,7 +20,7 @@ func TestMain(m *testing.M) {
}
```

*Optional*. Create Gostman environment file `.gostman.env.yml` if using variable.
*Optional*. Create gostman environment file `.gostman.env.yml` if using variable.

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

```sh
go test # run all Gostman requests in the package
go test # run all gostman requests in the package
go test -run Request # run all collection in the TestRequest
go test -run Request/AnotherRequest # run only AnotherRequest
go test -run Request -env myenv # run request and use "myenv" environment
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.0
v0.1.0
2 changes: 1 addition & 1 deletion examples/postman/.gostman.env.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
postman:
username: postman
password: password
password: password
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
description = "Gostman - Postman nuances in Go Test";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = { self, nixpkgs }:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in
{
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
name = "gostman";
shellHook = ''
git config pull.rebase true
${pkgs.neo-cowsay}/bin/cowsay -f sage "Gostman - Postman nuances in Go Test"
'';
buildInputs = with pkgs; [
editorconfig-checker
go
];
};
}
);
};
}