|
8 | 8 | permissions: |
9 | 9 | contents: write |
10 | 10 |
|
11 | | -# Cancel in-progress runs for the same tag |
12 | 11 | concurrency: |
13 | 12 | group: release-${{ github.ref }} |
14 | 13 | cancel-in-progress: true |
15 | 14 |
|
16 | 15 | jobs: |
17 | | - build: |
18 | | - name: Build (${{ matrix.target }}) |
19 | | - runs-on: ${{ matrix.os }} |
20 | | - strategy: |
21 | | - fail-fast: false |
22 | | - matrix: |
23 | | - include: |
24 | | - - target: x86_64-linux |
25 | | - os: ubuntu-latest |
26 | | - - target: aarch64-linux |
27 | | - os: ubuntu-latest |
28 | | - - target: x86_64-macos |
29 | | - os: macos-latest |
30 | | - - target: aarch64-macos |
31 | | - os: macos-latest |
32 | | - |
| 16 | + test: |
| 17 | + name: Pre-release Tests |
| 18 | + runs-on: ubuntu-latest |
33 | 19 | steps: |
34 | | - - name: Checkout |
35 | | - uses: actions/checkout@v4 |
36 | | - |
37 | | - - name: Install Nix |
38 | | - uses: DeterminateSystems/nix-installer-action@main |
39 | | - |
40 | | - - name: Nix cache |
41 | | - uses: DeterminateSystems/magic-nix-cache-action@main |
42 | | - |
43 | | - - name: Cache Zig build artifacts |
44 | | - uses: actions/cache@v4 |
45 | | - with: |
46 | | - path: | |
47 | | - .zig-cache |
48 | | - ~/.cache/zig |
49 | | - key: zig-release-${{ matrix.target }}-${{ hashFiles('build.zig', 'build.zig.zon', 'src/**') }} |
50 | | - restore-keys: | |
51 | | - zig-release-${{ matrix.target }}- |
52 | | -
|
53 | | - - name: Build |
54 | | - run: nix develop .#ci --command zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }} |
55 | | - |
56 | | - - name: Create tarball |
57 | | - run: tar -czf elaztic-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C zig-out/bin elaztic |
58 | | - |
59 | | - - name: Upload artifact |
60 | | - uses: actions/upload-artifact@v4 |
61 | | - with: |
62 | | - name: elaztic-${{ matrix.target }} |
63 | | - path: elaztic-${{ github.ref_name }}-${{ matrix.target }}.tar.gz |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: DeterminateSystems/nix-installer-action@main |
| 22 | + - uses: DeterminateSystems/magic-nix-cache-action@main |
| 23 | + - name: Run unit tests |
| 24 | + run: nix develop .#ci --command zig build test --summary all |
| 25 | + - name: Start OpenSearch |
| 26 | + run: nix develop .#ci --command es-start |
| 27 | + - name: Run smoke tests |
| 28 | + run: nix develop .#ci --command zig build test-smoke --summary all |
| 29 | + env: |
| 30 | + ES_URL: http://localhost:9200 |
| 31 | + - name: Run integration tests |
| 32 | + run: nix develop .#ci --command zig build test-integration --summary all |
| 33 | + env: |
| 34 | + ES_URL: http://localhost:9200 |
| 35 | + - name: Stop OpenSearch |
| 36 | + if: always() |
| 37 | + run: nix develop .#ci --command es-stop |
64 | 38 |
|
65 | 39 | release: |
66 | 40 | name: Create Release |
67 | | - needs: build |
| 41 | + needs: test |
68 | 42 | runs-on: ubuntu-latest |
69 | 43 | permissions: |
70 | 44 | contents: write |
71 | | - |
72 | 45 | steps: |
73 | | - - name: Download all artifacts |
74 | | - uses: actions/download-artifact@v4 |
75 | | - with: |
76 | | - pattern: elaztic-* |
77 | | - merge-multiple: true |
78 | | - |
| 46 | + - uses: actions/checkout@v4 |
79 | 47 | - name: Create GitHub Release |
80 | 48 | uses: softprops/action-gh-release@v2 |
81 | 49 | with: |
82 | | - files: elaztic-*.tar.gz |
83 | 50 | generate_release_notes: true |
84 | 51 | draft: false |
85 | 52 | prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }} |
0 commit comments