51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: https://github.com/actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
files="$(gofmt -l cmd/dataxl/*.go)"
|
|
if [ -n "$files" ]; then
|
|
echo "gofmt is required:"
|
|
echo "$files"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run tests
|
|
run: go test ./...
|
|
|
|
- name: Build
|
|
run: go build ./cmd/dataxl
|
|
|
|
- name: Smoke test
|
|
run: |
|
|
./dataxl -from yaml -to tsv -i examples/people.yaml > /tmp/people.tsv
|
|
grep -q 'user.name' /tmp/people.tsv
|
|
./dataxl -from tsv -to json < /tmp/people.tsv > /tmp/people.json
|
|
grep -q '"name": "Alice"' /tmp/people.json
|