-
Notifications
You must be signed in to change notification settings - Fork 11
131 lines (125 loc) · 4.33 KB
/
push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Push
on:
push:
branches:
- main
jobs:
gen-diff:
name: Codegen Diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: make generate man
- run: git diff --exit-code
lint:
name: Lint
needs: gen-diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false
- run: echo "GOLANGCI_LINT_VERSION=$(go list -m -f '{{.Version}}' github.com/golangci/golangci-lint)" >> $GITHUB_ENV
- uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
test:
name: Test
needs: lint
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: make test
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: echo "GORELEASER_VERSION=$(go list -m -f '{{.Version}}' github.com/goreleaser/goreleaser)" >> $GITHUB_ENV
- uses: goreleaser/goreleaser-action@v5
with:
version: ${{ env.GORELEASER_VERSION }}
args: build --snapshot
- uses: actions/upload-artifact@v3
with:
path: |
dist/darwin_darwin_amd64_v1/axiom
dist/linux_linux_amd64_v1/axiom
dist/windows_windows_amd64_v1/axiom.exe
binary-integration:
name: Binary integration
needs: build
strategy:
max-parallel: 2
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest
include:
- os: macos-latest
goos: darwin
- os: ubuntu-latest
goos: linux
# - os: windows-latest
# goos: windows
runs-on: ${{ matrix.os }}
env:
AXIOM_TOKEN: ${{ secrets.TESTING_DEV_TOKEN }}
AXIOM_URL: ${{ secrets.TESTING_DEV_API_URL }}
AXIOM_ORG_ID: ${{ secrets.TESTING_DEV_ORG_ID }}
AXIOM_DATASET: cli-test-${{ github.run_id }}-${{ matrix.goos }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Test (Unix)
if: matrix.goos == 'darwin' || matrix.goos == 'linux'
run: |
chmod +x artifact/${{ matrix.goos }}_${{ matrix.goos }}_amd64_v1/axiom
mv artifact/${{ matrix.goos }}_${{ matrix.goos }}_amd64_v1/axiom /usr/local/bin/axiom
axiom version -I
axiom dataset create -n=${{ env.AXIOM_DATASET }} -d="CLI Integration test"
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.json.gz -t=json -e=gzip -l=workflow:push
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.ndjson.gz -t=ndjson -e=gzip -l=workflow:push
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.csv.gz -t=csv -e=gzip -l=workflow:push
gunzip testdata/logs.*.gz
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.json -f=testdata/logs.ndjson -f=testdata/logs.csv -l=workflow:push
axiom dataset list
axiom query "['${{ env.AXIOM_DATASET }}']"
- name: Test (Windows)
if: matrix.goos == 'windows'
run: |
chmod +x artifact/${{ matrix.goos }}_${{ matrix.goos }}_amd64_v1/axiom.exe
mv artifact/${{ matrix.goos }}_${{ matrix.goos }}_amd64_v1/axiom.exe C:/Windows/System32/axiom.exe
axiom version -I
gunzip testdata/logs.*.gz
axiom dataset create -n=${{ env.AXIOM_DATASET }} -d="CLI Integration test"
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.json -l=workflow:push
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.ndjson -l=workflow:push
axiom ingest ${{ env.AXIOM_DATASET }} -f=testdata/logs.csv -l=workflow:push
axiom dataset list
axiom query "['${{ env.AXIOM_DATASET }}']"
- name: Cleanup
if: always()
run: axiom dataset delete -f ${{ env.AXIOM_DATASET }}