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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build and Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
skip_tests:
description: Skip test job
type: boolean
default: false
env:
GNOMON_SKIP_LINT_CHECKS: "1"
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
jobs:
test:
name: Run Tests
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_tests }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --all-features
build:
name: Build ${{ matrix.target }}
needs: test
if: ${{ always() && (needs.test.result == 'success' || needs.test.result == 'skipped') }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# MacOS ARM (Apple Silicon) - GH Actions uses M1
- os: macos-14
target: aarch64-apple-darwin
artifact_name: convert_genome
asset_name: convert_genome-macos-arm64
cpu: apple-m1
# MacOS Intel - use macos-15-intel which runs on Intel hardware
- os: macos-15-intel
target: x86_64-apple-darwin
artifact_name: convert_genome
asset_name: convert_genome-macos-intel
cpu: x86-64-v3
# Linux x86_64 (ubuntu-22.04 for wider glibc compatibility)
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
artifact_name: convert_genome
asset_name: convert_genome-linux-x64
cpu: x86-64-v3
# Linux ARM64
- os: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: convert_genome
asset_name: convert_genome-linux-arm64
cpu: neoverse-n1
# Windows x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: convert_genome.exe
asset_name: convert_genome-windows-x64
cpu: x86-64-v3
# Windows ARM64 (native ARM runner)
- os: windows-11-arm
target: aarch64-pc-windows-msvc
artifact_name: convert_genome.exe
asset_name: convert_genome-windows-arm64
cpu: cortex-a76
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Remove local cargo config
shell: bash
run: rm -f .cargo/config.toml
- name: Build
shell: bash
env:
GNOMON_SKIP_LINT_CHECKS: "1"
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}"
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ${{ matrix.asset_name }}
tar -czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.asset_name }}
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Copy-Item target/${{ matrix.target }}/release/${{ matrix.artifact_name }} -Destination ${{ matrix.asset_name }}.exe
Compress-Archive -Path ${{ matrix.asset_name }}.exe -DestinationPath ${{ matrix.asset_name }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: |
${{ matrix.asset_name }}.tar.gz
${{ matrix.asset_name }}.zip
if-no-files-found: error
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Generate release tag
id: tag
run: echo "release_tag=v$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
name: Release ${{ steps.tag.outputs.release_tag }}
files: artifacts/**/*