Skip to content

Commit 2d23e04

Browse files
ci: Add integration tests (#33)
* ci: Add integration tests * Add missing data file * Reference correct file * Ensure bucket exists * Run minio in the backgroud * Rename release workflow * Fix line break in docker command * Checkout code before runnin minio * Add s3 region
1 parent 2041db1 commit 2d23e04

File tree

5 files changed

+114
-79
lines changed

5 files changed

+114
-79
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
on: {}
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
# run only against tags
6+
tags:
7+
- '*'
8+
9+
permissions:
10+
contents: write
11+
212
jobs:
3-
releases-matrix:
4-
name: Release Go Binaries
13+
goreleaser:
514
runs-on: ubuntu-latest
6-
strategy:
7-
matrix:
8-
include:
9-
- goos: linux
10-
goarch: "386"
11-
- goos: linux
12-
goarch: "amd64"
13-
- goos: linux
14-
goarch: "arm64"
15-
- goos: darwin
16-
goarch: "amd64"
17-
- goos: darwin
18-
goarch: "arm64"
19-
- goos: windows
20-
goarch: "386"
21-
- goos: windows
22-
goarch: "amd64"
2315
steps:
24-
- name: Checkout code
16+
- name: Checkout
2517
uses: actions/checkout@v3
26-
- name: Release binaries
27-
uses: wangyoucao577/go-release-action@v1.36
2818
with:
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
goos: ${{ matrix.goos }}
31-
goarch: ${{ matrix.goarch }}
32-
goversion: "1.20"
33-
project_path: ./
34-
binary_name: target-jsonl-blob
35-
compress_assets: false
19+
fetch-depth: 0
20+
21+
- run: git fetch --force --tags
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version: 1.19
27+
cache: true
28+
29+
- name: Run GoReleaser
30+
uses: goreleaser/goreleaser-action@v4
31+
with:
32+
distribution: goreleaser
33+
version: latest
34+
args: release --clean --skip-validate --debug
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/releasev2.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
name: Test
2+
23
on:
34
pull_request: {}
45
push:
56
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
612
jobs:
713
test:
814
strategy:
@@ -11,13 +17,67 @@ jobs:
1117
os: [ubuntu-latest, macos-latest, windows-latest]
1218
runs-on: ${{ matrix.os }}
1319
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v3
16-
- name: Install Go
17-
uses: actions/setup-go@v3
18-
with:
19-
go-version: ${{ matrix.go-version }}
20-
cache: true
21-
cache-dependency-path: go.sum
22-
- name: Test
23-
run: go test ./... -cover
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
- name: Install Go
23+
uses: actions/setup-go@v3
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
cache: true
27+
cache-dependency-path: go.sum
28+
- name: Test
29+
run: go test ./... -cover
30+
31+
integration-test:
32+
name: Integration test - ${{ matrix.fs }}
33+
strategy:
34+
matrix:
35+
include:
36+
- fs: local
37+
config:
38+
bucket: file://./output/my-bucket
39+
- fs: s3
40+
config:
41+
bucket: s3://my-bucket?endpoint=http://127.0.0.1:9000&disableSSL=true&s3ForcePathStyle=true&region=us-west-1
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v3
46+
47+
- name: Start MinIO
48+
if: ${{ matrix.fs == 's3' }}
49+
run: >
50+
docker run -d
51+
--name minio
52+
-p 9000:9000
53+
-p 9090:9090
54+
-v $PWD/output:/data
55+
-e "MINIO_REGION_NAME=eu-west-1"
56+
-e "MINIO_ROOT_USER=minioadmin"
57+
-e "MINIO_ROOT_PASSWORD=minioadmin"
58+
quay.io/minio/minio server /data --console-address ":9090"
59+
60+
- name: Install Go
61+
uses: actions/setup-go@v3
62+
with:
63+
go-version: 1.20.x
64+
cache: true
65+
cache-dependency-path: go.sum
66+
67+
- name: Build
68+
run: |
69+
go build
70+
./target-jsonl-blob --version
71+
72+
- name: Write config
73+
run: |
74+
echo '${{ toJSON(matrix.config) }}' > config.json
75+
76+
- run: mkdir output/my-bucket
77+
78+
- name: Test
79+
env:
80+
AWS_ACCESS_KEY_ID: minioadmin
81+
AWS_SECRET_ACCESS_KEY: minioadmin
82+
run: |
83+
./target-jsonl-blob --config config.json --input resources/data/data.jsonl

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
*.json
33
!*.example.*
44

5-
# Data files
6-
**/*.jsonl
7-
85
# Binaries for programs and plugins
96
target-jsonl-blob
107
*.exe

resources/data/data.jsonl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{"type": "BAD"}
2+
{"type": "SCHEMA", "stream": "test", "schema": {"properties": {"id": "integer"}}}
3+
{"type": "RECORD", "stream": "test", "record": {"id": 1}, "time_extracted": "2022-01-01T00:00:00Z"}
4+
{"type": "RECORD", "stream": "test", "record": {"id": 2}, "time_extracted": "2022-01-01T00:00:00Z"}
5+
{"type": "STATE", "value": {"bookmark": "2022-01-01"}}
6+
{"type": "SCHEMA", "stream": "test2", "schema": {"properties": {"name": "string"}}}
7+
{"type": "RECORD", "stream": "test2", "record": {"name": "A"}}
8+
{"type": "RECORD", "stream": "test2", "record": {"name": "B"}}
9+
{"type": "STATE", "value": {"test": "2022-01-01", "test2": "2022-02-01"}}
10+
{"type": "SCHEMA", "stream": "test", "schema": {"properties": {"id": "integer"}}}
11+
{"type": "RECORD", "stream": "test", "record": {"id": 3}}
12+
{"type": "RECORD", "stream": "test", "record": {"id": 4}}
13+
{"type": "STATE", "value": {"test": "2022-03-01", "test2": "2022-02-01"}}

0 commit comments

Comments
 (0)