Skip to content

Commit

Permalink
Build gitql using go build (#96)
Browse files Browse the repository at this point in the history
* Compile gitql with go-git support

* Build gitql using go build
  • Loading branch information
filhodanuvem authored Oct 4, 2020
1 parent 1f5ad69 commit beebd12
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 289 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ jobs:

- name: Run tests
run: |
make test
go test -v ./...
- name: Build linux
env:
GOPATH: /home/runner/work/cloudson/go
TARGET_OS_ARCH: linux/amd64
run: |
make build
go build .
./gitql -v
- uses: actions/upload-artifact@master
name: Generating artifact
Expand All @@ -56,17 +53,11 @@ jobs:

- name: Run tests
run: |
make test
go test -v ./...
- name: Build mac
env:
TARGET_OS_ARCH: darwin/amd64
run: |
brew install pkg-config
export PKG_CONFIG_PATH=${PWD}/libgit2/install/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
make build-dynamic || true
go build .
./gitql -v
- uses: actions/upload-artifact@master
name: Generating artifact
Expand All @@ -89,14 +80,11 @@ jobs:

- name: Run tests
run: |
make test
go test -v ./...
- name: Build windows
env:
TARGET_OS_ARCH: windows/amd64
run: |
choco install ninja vcredist2017
make build
go build .
.\gitql.exe -v
- uses: actions/upload-artifact@master
Expand Down
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,10 @@ See more [here](https://asciinema.org/a/97094)

## Requirements
- Go
- cmake
- pkg-config

## How to install

We support static compiling for linux and windows platform (amd64), so you can access the [releases page](https://github.com/cloudson/gitql/releases) and just grab the binary. If you want to compile itself follow the instructions below:

### linux/amd64

Read the dockerfile to understand the whole process.

### darwin/amd64

We **do not** support yet static compiling. You need to have pkg-config as dependencies, so after install that, run

```bash
# Inside this repository folder
export PKG_CONFIG_PATH=${PWD}/libgit2/install/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
make build-dynamic
```

### windows/amd64

You need a C compiler, Cmake and Ninja installed. Using chocolately it should be easy

```bash
choco install cmake ninja vcredist2017
set PATH=%HOMEDRIVE%\mingw64\bin;%PATH%
make build
```

You can always take a look in our [github actions file](./.github/workflows/ci.yml) to understand
how we build it in the ci server. If even after try [the binaries](https://github.com/cloudson/gitql/releases) or either compile yourself you couldn't use that. Open an issue.
You can access the [releases page](https://github.com/cloudson/gitql/releases) and just grab the binary. If you want to compile itself just run `go build .`.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/pkg/errors"
)

const Version = "Gitql 2.0.0"
const Version = "Gitql 2.1.0"

type Gitql struct {
Path string `short:"p" default:"."`
Expand Down
39 changes: 0 additions & 39 deletions install-libgit2.sh

This file was deleted.

172 changes: 0 additions & 172 deletions install.sh

This file was deleted.

0 comments on commit beebd12

Please sign in to comment.