Skip to content

Commit 9329882

Browse files
committed
workflows.
1 parent 9e36ca1 commit 9329882

2 files changed

Lines changed: 173 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
fmt-check:
11+
name: Format Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: mlugg/setup-zig@v2
16+
with:
17+
version: 0.15.2
18+
- name: Check formatting
19+
run: zig fmt --check src/ tests/ bench/ build.zig
20+
21+
unit-tests:
22+
name: Unit Tests (${{ matrix.os }})
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest, macos-latest]
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: mlugg/setup-zig@v2
31+
with:
32+
version: 0.15.2
33+
- name: Run unit tests
34+
run: zig build test --summary all
35+
36+
smoke-tests:
37+
name: Smoke Tests
38+
runs-on: ubuntu-latest
39+
services:
40+
opensearch:
41+
image: opensearchproject/opensearch:2
42+
ports:
43+
- 9200:9200
44+
env:
45+
discovery.type: single-node
46+
plugins.security.disabled: "true"
47+
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "Admin1234!"
48+
options: >-
49+
--health-cmd "curl -sf http://localhost:9200/_cluster/health || exit 1"
50+
--health-interval 10s
51+
--health-timeout 5s
52+
--health-retries 20
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: mlugg/setup-zig@v2
56+
with:
57+
version: 0.15.2
58+
- name: Run smoke tests
59+
run: zig build test-smoke --summary all
60+
env:
61+
ES_URL: http://localhost:9200
62+
63+
integration-tests:
64+
name: Integration Tests
65+
runs-on: ubuntu-latest
66+
needs: [unit-tests]
67+
services:
68+
opensearch:
69+
image: opensearchproject/opensearch:2
70+
ports:
71+
- 9200:9200
72+
env:
73+
discovery.type: single-node
74+
plugins.security.disabled: "true"
75+
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "Admin1234!"
76+
options: >-
77+
--health-cmd "curl -sf http://localhost:9200/_cluster/health || exit 1"
78+
--health-interval 10s
79+
--health-timeout 5s
80+
--health-retries 20
81+
steps:
82+
- uses: actions/checkout@v4
83+
- uses: mlugg/setup-zig@v2
84+
with:
85+
version: 0.15.2
86+
- name: Run integration tests
87+
run: zig build test-integration --summary all
88+
env:
89+
ES_URL: http://localhost:9200
90+
91+
build-check:
92+
name: Build Check (${{ matrix.os }})
93+
runs-on: ${{ matrix.os }}
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
os: [ubuntu-latest, macos-latest]
98+
steps:
99+
- uses: actions/checkout@v4
100+
- uses: mlugg/setup-zig@v2
101+
with:
102+
version: 0.15.2
103+
- name: Build (ReleaseSafe)
104+
run: zig build -Doptimize=ReleaseSafe

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.target }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- target: x86_64-linux
20+
os: ubuntu-latest
21+
- target: aarch64-linux
22+
os: ubuntu-latest
23+
- target: x86_64-macos
24+
os: macos-latest
25+
- target: aarch64-macos
26+
os: macos-latest
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Zig
33+
uses: mlugg/setup-zig@v2
34+
with:
35+
version: 0.15.2
36+
37+
- name: Build
38+
run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }}
39+
40+
- name: Create tarball
41+
run: tar -czf elaztic-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C zig-out/bin elaztic
42+
43+
- name: Upload artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: elaztic-${{ matrix.target }}
47+
path: elaztic-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
48+
49+
release:
50+
name: Release
51+
needs: build
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: write
55+
56+
steps:
57+
- name: Download artifacts
58+
uses: actions/download-artifact@v4
59+
with:
60+
pattern: elaztic-*
61+
merge-multiple: true
62+
63+
- name: Create GitHub Release
64+
uses: softprops/action-gh-release@v2
65+
with:
66+
files: elaztic-*.tar.gz
67+
generate_release_notes: true
68+
draft: false
69+
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}

0 commit comments

Comments
 (0)