-
Notifications
You must be signed in to change notification settings - Fork 4
143 lines (123 loc) · 5 KB
/
releases.yml
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
---
name: Release
# Do this on every tagged commit
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -C target-cpu=native
jobs:
build-linux-release:
name: Build release for Linux
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install -y \
tzdata \
build-essential \
pkg-config \
cmake \
curl \
git \
libz-dev \
software-properties-common \
;
# This comes from software-properties-common, and is only necessary
# to install gcc-12. Remove this when we use a newer ubuntu image.
# https://stackoverflow.com/a/67453352
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update -y
sudo apt install -y gcc-11 g++-11
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-11 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11
gcc --version
g++ --version
gcov --version
# Compile cfitsio from source to get its static library.
curl https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.3.0.tar.gz -O
tar -xvf cfitsio-4.3.0.tar.gz && rm cfitsio-4.3.0.tar.gz && cd cfitsio-4.3.0
CFLAGS="-fPIE -O3 -march=x86-64-v2" ./configure --enable-reentrant --disable-curl --enable-sse2 --enable-ssse3 --libdir=/usr/lib/x86_64-linux-gnu/
sudo make -j install
env:
DEBIAN_FRONTEND: noninteractive
- name: Install CUDA
uses: Jimver/[email protected]
with:
cuda: '12.2.0'
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build and Tar
run: |
curl https://raw.githubusercontent.com/HDFGroup/hdf5/develop/COPYING -o COPYING-hdf5
curl https://raw.githubusercontent.com/liberfa/erfa/master/LICENSE -o LICENSE-erfa
curl https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/License.txt -o LICENSE-cfitsio
cp .github/workflows/releases-readme.md README.md
# Build with our recently-built static cfitsio
export CFITSIO_STATIC=1
# Don't build against the host CPU
rm .cargo/config.toml
# Don't make it look like the git tree is dirty because we aren't
# building against the host CPU
perl -0777 -pe 's/let dirty = .*\n.*\n.*\n.*/let dirty = "";/' src/cli/mod.rs
for ARCH in {2,3}; do
echo "Building x86-64-v${ARCH}"
export CFLAGS="-march=x86-64-v${ARCH}"
export CXXFLAGS="-march=x86-64-v${ARCH}"
export RUSTFLAGS="-C target-cpu=x86-64-v${ARCH}"
# Use --no-default-features to disable plotting; it's too hard to make this portable.
cargo build --profile production --locked --no-default-features --features=hdf5-static
mv target/production/hyperdrive .
tar -acvf mwa_hyperdrive-$(git describe --tags)-Linux-x86-64-v${ARCH}.tar.gz \
LICENSE COPYING-hdf5 LICENSE-erfa LICENSE-cfitsio README.md \
hyperdrive
cargo build --profile production --locked --no-default-features --features=hdf5-static,cuda
mv target/production/hyperdrive .
tar -acvf mwa_hyperdrive-$(git describe --tags)-Linux-x86-64-v${ARCH}-CUDA-double.tar.gz \
LICENSE COPYING-hdf5 LICENSE-erfa LICENSE-cfitsio LICENSE-NVIDIA README.md \
hyperdrive
cargo build --profile production --locked --no-default-features --features=hdf5-static,cuda,gpu-single
mv target/production/hyperdrive .
tar -acvf mwa_hyperdrive-$(git describe --tags)-Linux-x86-64-v${ARCH}-CUDA-single.tar.gz \
LICENSE COPYING-hdf5 LICENSE-erfa LICENSE-cfitsio LICENSE-NVIDIA README.md \
hyperdrive
cargo clean
done
- name: Upload tarball
uses: actions/upload-artifact@v2
with:
name: linux.tar.gz
path: "*.tar.gz"
if-no-files-found: error
create-release:
name: Create a new release
runs-on: ubuntu-latest
needs: build-linux-release
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v2
with:
name: linux.tar.gz
- name: Provide new release asset
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
*.tar.gz