Skip to content

Commit 33954bf

Browse files
authored
Release Surge 2.0 (#17)
Release Surge 2.0
2 parents bf73e56 + af38232 commit 33954bf

File tree

15 files changed

+17111
-16133
lines changed

15 files changed

+17111
-16133
lines changed

.github/workflows/build.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, 'release/**' ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-linux:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install dependencies
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y gcc make zlib1g-dev
19+
20+
- name: Build nauty
21+
run: |
22+
curl -L -o nauty2_9_3.tar.gz https://users.cecs.anu.edu.au/~bdm/nauty/nauty2_9_3.tar.gz
23+
tar xzf nauty2_9_3.tar.gz
24+
cd nauty2_9_3
25+
./configure && make
26+
27+
- name: Build surge
28+
working-directory: src
29+
run: |
30+
make surge \
31+
NAUTY=${{ github.workspace }}/nauty2_9_3 \
32+
NAUTYLIB=${{ github.workspace }}/nauty2_9_3 \
33+
CCOPT="-O3"
34+
35+
- name: Test surge
36+
working-directory: src
37+
run: |
38+
./surge -help 2>&1 | head -3
39+
./surge -u C6H6
40+
./surge -u C4H10
41+
42+
- name: Build canonsdf
43+
working-directory: src
44+
run: |
45+
make canonsdf \
46+
NAUTY=${{ github.workspace }}/nauty2_9_3 \
47+
NAUTYLIB=${{ github.workspace }}/nauty2_9_3 \
48+
CCOPT="-O3"
49+
50+
- name: Upload Linux binary
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: surge-linux-x86_64
54+
path: src/surge
55+
56+
build-macos:
57+
strategy:
58+
matrix:
59+
include:
60+
- os: macos-14
61+
arch: arm64
62+
- os: macos-15
63+
arch: arm64-m15
64+
runs-on: ${{ matrix.os }}
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install nauty
69+
run: brew install nauty
70+
71+
- name: Create nauty library symlink
72+
run: |
73+
NAUTY_LIB=$(brew --prefix nauty)/lib
74+
ln -sf "$NAUTY_LIB/libnautyL1.a" "$NAUTY_LIB/nautyL1.a"
75+
76+
- name: Build surge
77+
working-directory: src
78+
run: |
79+
make surge \
80+
NAUTY=$(brew --prefix nauty)/include/nauty \
81+
NAUTYLIB=$(brew --prefix nauty)/lib \
82+
CCOPT="-O3"
83+
84+
- name: Test surge
85+
working-directory: src
86+
run: |
87+
./surge -help 2>&1 | head -3
88+
./surge -u C6H6
89+
./surge -u C4H10
90+
91+
- name: Upload macOS binary
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: surge-macos-${{ matrix.arch }}
95+
path: src/surge
96+
97+
build-windows:
98+
runs-on: windows-latest
99+
defaults:
100+
run:
101+
shell: msys2 {0}
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- uses: msys2/setup-msys2@v2
106+
with:
107+
msystem: UCRT64
108+
install: >-
109+
mingw-w64-ucrt-x86_64-gcc
110+
make
111+
mingw-w64-ucrt-x86_64-zlib
112+
curl
113+
tar
114+
115+
- name: Build nauty
116+
run: |
117+
curl -L -o nauty2_9_3.tar.gz https://users.cecs.anu.edu.au/~bdm/nauty/nauty2_9_3.tar.gz
118+
tar xzf nauty2_9_3.tar.gz
119+
cd nauty2_9_3
120+
./configure && make
121+
122+
- name: Build surge
123+
working-directory: src
124+
run: |
125+
make surge \
126+
NAUTY=$(cygpath -u "$GITHUB_WORKSPACE")/nauty2_9_3 \
127+
NAUTYLIB=$(cygpath -u "$GITHUB_WORKSPACE")/nauty2_9_3 \
128+
CCOPT="-O3"
129+
130+
- name: Test surge
131+
working-directory: src
132+
run: |
133+
./surge.exe -help 2>&1 | head -3
134+
./surge.exe -u C6H6
135+
./surge.exe -u C4H10
136+
137+
- name: Upload Windows binary
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: surge-windows-x86_64
141+
path: src/surge.exe

.github/workflows/release.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-release:
10+
strategy:
11+
matrix:
12+
include:
13+
- os: ubuntu-latest
14+
artifact: surge-linux-x86_64
15+
binary: surge
16+
- os: macos-14
17+
artifact: surge-macos-arm64
18+
binary: surge
19+
- os: windows-latest
20+
artifact: surge-windows-x86_64
21+
binary: surge.exe
22+
runs-on: ${{ matrix.os }}
23+
defaults:
24+
run:
25+
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Setup MSYS2 (Windows only)
30+
if: matrix.os == 'windows-latest'
31+
uses: msys2/setup-msys2@v2
32+
with:
33+
msystem: UCRT64
34+
install: >-
35+
mingw-w64-ucrt-x86_64-gcc
36+
make
37+
mingw-w64-ucrt-x86_64-zlib
38+
curl
39+
tar
40+
41+
- name: Install dependencies (Linux)
42+
if: matrix.os == 'ubuntu-latest'
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y gcc make zlib1g-dev
46+
47+
- name: Install nauty (macOS)
48+
if: startsWith(matrix.os, 'macos')
49+
run: |
50+
brew install nauty
51+
NAUTY_LIB=$(brew --prefix nauty)/lib
52+
ln -sf "$NAUTY_LIB/libnautyL1.a" "$NAUTY_LIB/nautyL1.a"
53+
54+
- name: Build nauty from source (Linux/Windows)
55+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
56+
run: |
57+
curl -L -o nauty2_9_3.tar.gz https://users.cecs.anu.edu.au/~bdm/nauty/nauty2_9_3.tar.gz
58+
tar xzf nauty2_9_3.tar.gz
59+
cd nauty2_9_3
60+
./configure && make
61+
62+
- name: Build surge (Linux/Windows)
63+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
64+
working-directory: src
65+
run: |
66+
make surge \
67+
NAUTY=$(cygpath -u "$GITHUB_WORKSPACE" 2>/dev/null || echo "$GITHUB_WORKSPACE")/nauty2_9_3 \
68+
NAUTYLIB=$(cygpath -u "$GITHUB_WORKSPACE" 2>/dev/null || echo "$GITHUB_WORKSPACE")/nauty2_9_3 \
69+
CCOPT="-O3"
70+
71+
- name: Build surge (macOS)
72+
if: startsWith(matrix.os, 'macos')
73+
working-directory: src
74+
run: |
75+
make surge \
76+
NAUTY=$(brew --prefix nauty)/include/nauty \
77+
NAUTYLIB=$(brew --prefix nauty)/lib \
78+
CCOPT="-O3"
79+
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.artifact }}
84+
path: src/${{ matrix.binary }}
85+
86+
create-release:
87+
needs: build-release
88+
runs-on: ubuntu-latest
89+
permissions:
90+
contents: write
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Download all artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: artifacts
98+
99+
- name: Package binaries
100+
run: |
101+
cd artifacts
102+
for dir in */; do
103+
name="${dir%/}"
104+
cd "$name"
105+
chmod +x * 2>/dev/null || true
106+
tar czf "../${name}.tar.gz" *
107+
cd ..
108+
done
109+
110+
- name: Create Release
111+
uses: softprops/action-gh-release@v2
112+
with:
113+
name: "Surge ${{ github.ref_name }}"
114+
draft: true
115+
generate_release_notes: false
116+
body: |
117+
## Surge 2.0
118+
119+
A fast open-source chemical graph generator.
120+
121+
### What's New in 2.0
122+
- **64-bit word size**: Supports larger molecular structures
123+
- **Aromaticity detection** (`-R`): Filter duplicate Kekule structures under carbon-ring aromaticity
124+
- **Hexagon restrictions** (`-h#`, `-h#:#`): Control 6-membered cycle counts
125+
- **Carbon 6-ring restrictions** (`-C#`, `-C#:#`): Limit carbon-only 6-membered rings
126+
- **Improved summary reporting**
127+
128+
### Installation
129+
Download the binary for your platform below, or build from source (see README).
130+
131+
### Binaries
132+
- `surge-linux-x86_64.tar.gz` - Linux (x86_64)
133+
- `surge-macos-arm64.tar.gz` - macOS (Apple Silicon)
134+
- `surge-windows-x86_64.tar.gz` - Windows (x86_64, built with MSYS2)
135+
files: |
136+
artifacts/*.tar.gz
137+
doc/surge2_0.pdf

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ dkms.conf
5353

5454
# Editor backup files
5555
*~
56+
57+
# Surge binaries
58+
surge
59+
surge_[0-9]
60+
canonsdf

Dockerfile

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
1-
FROM ubuntu:21.04
1+
FROM alpine:3.21 AS builder
22

3-
RUN apt-get update && \
4-
apt-get -y install curl gcc make zlib1g-dev && \
5-
apt-get -y clean && \
6-
rm -rf \
7-
/var/lib/apt/lists/* \
8-
/usr/share/doc \
9-
/usr/share/doc-base \
10-
/usr/share/man \
11-
/usr/share/locale \
12-
/usr/share/zoneinfo
13-
WORKDIR /root
14-
RUN curl -o nauty27r3.tar.gz http://users.cecs.anu.edu.au/~bdm/nauty/nauty27r3.tar.gz \
15-
&& tar xzvf nauty27r3.tar.gz \
16-
&& cd nauty27r3 \
17-
&& ./configure && make
18-
ENV NAUTY_HOME=/root/nauty27r3
19-
COPY src/surge.c $NAUTY_HOME
20-
COPY src/Makefile /root
21-
WORKDIR $NAUTY_HOME
22-
RUN ln -s /root/nauty27r3 /root/nauty
23-
RUN make -f ../Makefile clean ; make -f ../Makefile surge
3+
RUN apk add --no-cache build-base curl zlib-dev
244

25-
FROM ubuntu:21.04
5+
WORKDIR /build
266

27-
RUN apt-get update && \
28-
apt-get -y install curl time gnupg zlib1g && \
29-
apt-get -y clean && \
30-
rm -rf \
31-
/var/lib/apt/lists/* \
32-
/usr/share/doc \
33-
/usr/share/doc-base \
34-
/usr/share/man \
35-
/usr/share/locale \
36-
/usr/share/zoneinfo
37-
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y
7+
# Download and build nauty
8+
RUN curl -L -o nauty2_9_3.tar.gz https://users.cecs.anu.edu.au/~bdm/nauty/nauty2_9_3.tar.gz \
9+
&& tar xzf nauty2_9_3.tar.gz \
10+
&& cd nauty2_9_3 \
11+
&& ./configure && make -j4
3812

39-
COPY --from=0 /root/nauty27r3/surge /usr/bin
13+
# Copy source and build surge (static linking for minimal runtime image)
14+
COPY src/ /build/src/
15+
WORKDIR /build/src
16+
RUN make surge \
17+
NAUTY=/build/nauty2_9_3 \
18+
NAUTYLIB=/build/nauty2_9_3 \
19+
CCOPT="-O3 -static"
20+
21+
# Minimal runtime image (~9MB)
22+
FROM alpine:3.21
23+
24+
COPY --from=builder /build/src/surge /usr/local/bin/surge
25+
26+
ENTRYPOINT ["surge"]

0 commit comments

Comments
 (0)