<commit_before>stages:
- test
- build

before_script:
- mkdir -p $GOPATH/src/github.com/RaveNoX
- ln -s $(pwd) $GOPATH/src/github.com/RaveNoX/go-jsoncommentstrip
- cd $GOPATH/src/github.com/RaveNoX/go-jsoncommentstrip
- go get
- (cd cmd/jsoncommentstrip && go get)

after_script:
- rm $GOPATH/src/github.com/RaveNoX/go-jsoncommentstrip

format:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: test
    script:
    - go get -u golang.org/x/tools/cmd/goimports
    # If formatted is different than committed, exit with error    
    - (if [ "$(goimports -l ./)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);

test:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: test
    script:
    - go test -cover -v ./...

compile-linux:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: build
    variables:
        GOOS: linux
        GOARCH: amd64
    script:
    - mkdir -p artifacts
    - go build -o artifacts/jsoncommentstrip ./cmd/jsoncommentstrip 
    artifacts:
        paths:
        - artifacts/*

compile-windows:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: build
    variables:
        GOOS: windows
        GOARCH: amd64
    script:
    - mkdir -p artifacts
    - go build -o artifacts/jsoncommentstrip.exe ./cmd/jsoncommentstrip 
    artifacts:
        paths:
        - artifacts/*

compile-darwin:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: build
    variables:
        GOOS: darwin
        GOARCH: amd64
    script:
    - mkdir -p artifacts
    - go build -o artifacts/jsoncommentstrip ./cmd/jsoncommentstrip 
    artifacts:
        paths:
        - artifacts/*<commit_msg>Optimize CI script<commit_after>variables:    
    GOPROJ: "github.com/RaveNoX/go-jsoncommentstrip"

stages:
- test
- build

before_script:
- mkdir -p $GOPATH/src/$GOPROJ
- rmdir $GOPATH/src/$GOPROJ
- ln -s $(pwd) $GOPATH/src/$GOPROJ
#- cd $GOPATH/src/$GOPROJ/
#- go get -u github.com/golang/dep/cmd/dep
#- dep ensure -v

cache:
    key: "${CI_COMMIT_REF_SLUG}"
    paths:
    - vendor/**

format:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: test
    script:
    - go get -u golang.org/x/tools/cmd/goimports
    # If formatted is different than committed, exit with error    
    - (if [ "$(goimports -l ./)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);

test:
    tags:
    - docker
    - linux
    image: golang:latest
    stage: test
    script:
    - go test -cover -v ./...

build:
    stage: build
    tags:
    - docker
    - linux
    image: golang:latest
    script:
    - mkdir -p artifacts        
    - echo "Building for Linux"
    - GOOS=linux GOARCH=amd64 go build -o artifacts/jsoncommentstrip ./cmd/jsoncommentstrip
    - echo "Building for MacOS (darwin)"
    - GOOS=darwin GOARCH=amd64 go build -o artifacts/jsoncommentstrip_darwin ./cmd/jsoncommentstrip
    - echo "Building for Windows"
    - GOOS=windows GOARCH=amd64 go build -o artifacts/jsoncommentstrip.exe ./cmd/jsoncommentstrip
    artifacts:
        paths:
        - artifacts/*
{'fraction_non_alphanumeric': 0.11479591836734694, 'fraction_numerical': 0.00510204081632653, 'mean_word_length': 2.1591137965760323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1593336', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1070, 'n_words': 275}