Compare commits

...

7 Commits

Author SHA1 Message Date
ddf83eb33b Add missing newline to created env files (#133) 2021-03-04 20:35:31 +11:00
f562099a43 Add renovate.json (#124)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-11-11 15:36:58 +11:00
c49ef66cd3 Fix release name 2020-11-11 15:35:55 +11:00
c142d16052 Try a different github action 2020-11-11 15:30:39 +11:00
4e2d182c9a Add action to publish binaries on each release (#125) 2020-11-11 15:15:18 +11:00
65218afbaa Add a go.mod file (#123) 2020-11-11 14:54:56 +11:00
aa035a1808 Non amd tests (#122)
* Add non-amd64 tests

* Try shifting env around

* Update input to match action

* Include git

* Comment out IBM Z for now and quieten apt-get
2020-11-11 12:54:49 +11:00
5 changed files with 86 additions and 3 deletions

View File

@ -3,9 +3,10 @@ name: CI
on: [push]
jobs:
build:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go: [ '1.15', '1.14' ]
os: [ ubuntu-latest, macOS-latest, windows-latest ]
@ -17,3 +18,45 @@ jobs:
with:
go-version: ${{ matrix.go }}
- run: go test
test-non-amd64:
strategy:
fail-fast: false
matrix:
arch:
# For some reasons this is segfaulting on go env
# - name: IBM Z and LinuxONE
# architecture: "s390x"
- name: POWER8
architecture: "ppc64le"
runs-on: ubuntu-latest
name: Test on ${{ matrix.arch.name }}
steps:
- uses: actions/checkout@v2
- uses: uraimo/run-on-arch-action@master
with:
arch: ${{ matrix.arch.architecture }}
distro: ubuntu20.04
env: | # YAML pipe
GOARCH: ${{ matrix.arch.architecture }}
CGO_ENABLED: 0
run: |
apt-get update
apt-get install -q -y curl wget git
latestGo=$(curl "https://golang.org/VERSION?m=text")
wget "https://dl.google.com/go/${latestGo}.linux-${GOARCH}.tar.gz"
rm -f $(which go)
rm -rf /usr/local/go
tar -C /usr/local -xzf "${latestGo}.linux-${GOARCH}.tar.gz"
export PATH=/usr/local/go/bin:$PATH
printf "Using go at: $(which go)\n"
printf "Go version: $(go version)\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
go get -insecure -v -t -d ./...
go test ./...
cd ./cmd/godotenv
go build -trimpath -ldflags="-w -s" -v

32
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,32 @@
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Assets
jobs:
build:
name: Upload Release Assets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Generate build files
uses: thatisuday/go-cross-build@v1
with:
platforms: 'linux/amd64, linux/ppc64le, darwin/amd64, windows/amd64'
package: 'cmd/godotenv'
name: 'godotenv'
compress: 'true'
dest: 'dist'
- name: Publish Binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: Release ${{ github.ref }}
tag: ${{ github.ref }}
file: dist/*
file_glob: true
overwrite: true

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/joho/godotenv
go 1.12

View File

@ -157,7 +157,7 @@ func Write(envMap map[string]string, filename string) error {
return err
}
defer file.Close()
_, err = file.WriteString(content)
_, err = file.WriteString(content + "\n")
if err != nil {
return err
}

5
renovate.json Normal file
View File

@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}