Skip to content

Commit

Permalink
fix: fix non-linux release builds (#7)
Browse files Browse the repository at this point in the history
* fix: fix arch env variables during build

* fix: only run e2e tests on linux

* fix: disable window build

* refactor: add go version and cgo env vars

* feat: see what happens with cgo disabled

* chore: cleanup debug config

* fix: fix condition for e2e tests

* fix: fix path of binary in e2e test

* debug: show tree in ci

* docs: update README

* fix: fix e2e test

---------

Co-authored-by: Sebastian <olastor@users.noreply.github.com>
  • Loading branch information
olastor and olastor authored Apr 28, 2024
1 parent caf883e commit c32d2b0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
pull_request:
branches: [ "main" ]

env:
GO_VERSION: '>=1.21'
CGO_ENABLED: 0

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -19,35 +23,23 @@ jobs:
- {GOOS: linux, GOARCH: arm64}
- {GOOS: darwin, GOARCH: amd64}
- {GOOS: darwin, GOARCH: arm64}
- {GOOS: windows, GOARCH: amd64}
# - {GOOS: windows, GOARCH: amd64} TODO: figure out how to fix build
- {GOOS: freebsd, GOARCH: amd64}
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Build
run: |
VERSION="$(git describe --tags --always)"
go build -ldflags "-X main.Version=$VERSION" -v ./cmd/...
go-version: ${{ env.GO_VERSION }}

- name: Test
run: go test -v ./...

- name: Test E2E
run: |
export GOBIN="$HOME/.local/bin/"
go install github.com/rogpeppe/go-internal/cmd/testscript@v1.12.0
go install filippo.io/age/cmd/...@latest
cp age-plugin-sss "$HOME/.local/bin/age-plugin-sss"
testscript ./testdata/*.txt
- name: Package
run: |
VERSION="$(git describe --tags --always)"
go build -ldflags "-X main.Version=$VERSION" -v ./cmd/...
DIR="$(mktemp -d)"
mkdir "$DIR/age-plugin-sss"
cp LICENSE "$DIR/age-plugin-sss"
Expand All @@ -59,10 +51,22 @@ jobs:
tar -cvzf "age-plugin-sss-$VERSION-$GOOS-$GOARCH.tar.gz" -C "$DIR" age-plugin-sss
fi
env:
CGO_ENABLED: ${{ env.CGO_ENABLED }}
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GOARM: ${{ matrix.GOARM }}

- name: Test E2E
if: matrix.GOOS == 'linux' && matrix.GOARCH == 'amd64'
run: |
export GOBIN="$HOME/.local/bin/"
go build -v ./cmd/...
go install github.com/rogpeppe/go-internal/cmd/testscript@v1.12.0
go install filippo.io/age/cmd/...@latest
cp age-plugin-sss "$HOME/.local/bin/age-plugin-sss"
testscript ./testdata/*.txt
rm age-plugin-sss
- name: Upload workflow artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@

### Download/Install Binary

Go to the [release page](https://github.com/olastor/age-plugin-sss/releases/) and download the correct binary for your architecture. Unpack it and move it to a directory in your `$PATH`.
Download a the latest binary from the [release page](https://github.com/olastor/age-plugin-sss/releases). Copy the binary to your `$PATH` (preferably in `$(which age)`) and make sure it's executable.

You can also use the following script for installation:

- Installs binary to `~/.local/bin/age-plugin-sss` (change to your preferred directory)
- Make sure to adjust `OS` and `ARCH` if needed (`OS=darwin ARCH=arm64` for Apple Silicon, `OS=darwin ARCH=amd64` for older Macs)

```bash
cd "$(mktemp -d)"
VERSION=v0.2.4 OS=linux ARCH=amd64; curl -L "https://github.com/olastor/age-plugin-sss/releases/download/$VERSION/age-plugin-sss-$VERSION-$OS-$ARCH.tar.gz" -o age-plugin-sss.tar.gz
tar -xzf age-plugin-sss.tar.gz
mv age-plugin-sss/age-plugin-sss ~/.local/bin
```

Please note that Windows builds are currently not enabled, but if you need them please open a new issue and I'll try to look into it.

### Build from source

Expand Down

0 comments on commit c32d2b0

Please sign in to comment.