|
13 | 13 | - v[0-9]+.[0-9]+.[0-9]+
|
14 | 14 |
|
15 | 15 | env:
|
| 16 | + ZIG_VERSION: 0.13.0 |
| 17 | + GLIBC_VERSION: 2.17 |
16 | 18 | BIN_DIR: ${{ github.workspace }}/bin
|
17 |
| - MINIMUM_CMAKE_VERSION: '3.28' |
18 | 19 |
|
19 |
| -# Build on the oldest supported images, so we have broader compatibility |
20 |
| -# Build with gcc-10 to prevent triggering #14150 (default is still gcc-9 on 20.04) |
| 20 | +# Build with zig cc so we can target glibc 2.17, so we have broader compatibility |
21 | 21 | jobs:
|
22 | 22 | linux:
|
23 |
| - runs-on: ubuntu-20.04 |
24 |
| - env: |
25 |
| - CC: gcc-10 |
| 23 | + runs-on: ubuntu-latest |
26 | 24 | outputs:
|
27 | 25 | version: ${{ steps.build.outputs.version }}
|
28 |
| - container: |
29 |
| - image: ubuntu:18.04 |
30 |
| - options: --privileged # Privileged mode is needed to load fuse module. |
31 | 26 | steps:
|
32 |
| - - name: Prepare container |
| 27 | + - name: Install deps from apt |
33 | 28 | run: |
|
34 |
| - apt-get update |
35 |
| - apt-get install -y software-properties-common |
36 |
| - add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-10. |
37 |
| - add-apt-repository -y ppa:git-core/ppa # For git>=2.18. |
38 |
| - apt-get update |
39 |
| - apt-get install -y git gcc-10 |
40 |
| - apt-get install -y fuse libfuse2 # For linuxdeploy. |
| 29 | + sudo apt-get update |
| 30 | + sudo apt-get install -y fuse libfuse2 # For linuxdeploy. |
| 31 | + sudo apt-get install -y build-essential curl gettext ninja-build unzip cmake |
| 32 | + sudo apt-get install -y xz-utils # To extract zig |
41 | 33 | # Workaround for https://github.com/actions/checkout/issues/766.
|
42 | 34 | git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
| 35 | +
|
43 | 36 | - if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly'
|
44 | 37 | uses: actions/checkout@v3
|
45 | 38 | with:
|
46 | 39 | repository: 'neovim/neovim'
|
47 | 40 | ref: ${{ github.event.inputs.tag_name }}
|
48 | 41 | fetch-depth: 0
|
| 42 | + |
49 | 43 | - if: github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
|
50 | 44 | uses: actions/checkout@v3
|
51 | 45 | with:
|
52 | 46 | repository: 'neovim/neovim'
|
53 | 47 | fetch-depth: 0
|
54 |
| - - run: | |
55 |
| - apt-get update |
56 |
| - apt-get install -y build-essential curl gettext ninja-build unzip |
| 48 | + |
| 49 | + # zig cc with -02 implicitly adds -DNDEBUG so remove this from the generator flags |
| 50 | + # Not needed for 0.10.1+ : https://github.com/neovim/neovim/pull/29599 |
| 51 | + - name: Patch Neovim |
| 52 | + run: sed -i '/APPEND gen_cflags -O2/d' src/nvim/CMakeLists.txt || true |
57 | 53 |
|
58 | 54 | - name: Add "$BIN_DIR" to path
|
59 |
| - run: echo "$BIN_DIR" >> $GITHUB_PATH |
| 55 | + run: | |
| 56 | + mkdir -p "$BIN_DIR" |
| 57 | + echo "$BIN_DIR" >> $GITHUB_PATH |
60 | 58 |
|
61 |
| - # TODO(dundargoc): this is very hacky. We only need to install cmake version |
62 |
| - # that is at least the minimum cmake version, but for some reason the |
63 |
| - # cmake releases didn't work as described. |
64 |
| - - name: Install cmake |
| 59 | + - name: Install Zig |
65 | 60 | run: |
|
66 |
| - apt-get install -y cmake # Install cmake only for cpack, the cmake version itself is too old |
67 |
| - curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "https://cmake.org/files/v${MINIMUM_CMAKE_VERSION}/cmake-${MINIMUM_CMAKE_VERSION}.0-linux-x86_64.sh" |
68 |
| - mkdir -p "$BIN_DIR" /opt/cmake-custom |
69 |
| - chmod a+x /tmp/cmake-installer.sh |
70 |
| - /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license |
71 |
| - ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake" |
72 |
| - cmake_version="$(cmake --version | head -1)" |
73 |
| - echo "$cmake_version" | grep -qF "cmake version $MINIMUM_CMAKE_VERSION.0" || { |
74 |
| - echo "Unexpected CMake version: $cmake_version" |
75 |
| - exit 1 |
76 |
| - } |
| 61 | + curl -O https://ziglang.org/builds/zig-linux-$(arch)-$ZIG_VERSION.tar.xz |
| 62 | + tar -xf zig-linux-$(arch)-$ZIG_VERSION.tar.xz |
| 63 | + rm -rf zig-linux-$(arch)-$ZIG_VERSION.tar.xz |
| 64 | + ln -s $(pwd)/zig-linux-$(arch)-$ZIG_VERSION/zig $BIN_DIR/zig |
| 65 | +
|
| 66 | + # Include -lunwind so luajit can be linked |
| 67 | + # Include -g0 to strip debug info by default. |
| 68 | + # Note: Cmake should override this for debug builds by appending -g |
| 69 | + echo 'exec zig cc -target $(arch)-linux-gnu.${GLIBC_VERSION} -lunwind -g0 "$@"' > $BIN_DIR/zigcc |
| 70 | + chmod +x $BIN_DIR/zigcc |
77 | 71 |
|
78 | 72 | - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
|
79 | 73 | run: |
|
80 | 74 | echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV
|
81 | 75 | echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV
|
| 76 | +
|
82 | 77 | - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
|
83 | 78 | run: |
|
84 | 79 | echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV
|
85 | 80 | echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV
|
| 81 | +
|
86 | 82 | - name: appimage
|
| 83 | + env: |
| 84 | + CC: zigcc |
87 | 85 | run: ./scripts/genappimage.sh ${APPIMAGE_TAG}
|
88 | 86 | - run: cpack --config build/CPackConfig.cmake
|
| 87 | + |
89 | 88 | - uses: actions/upload-artifact@v3
|
90 | 89 | with:
|
91 | 90 | name: appimage
|
92 | 91 | path: |
|
93 | 92 | build/bin/nvim.appimage
|
94 | 93 | build/bin/nvim.appimage.zsync
|
95 | 94 | retention-days: 1
|
| 95 | + |
96 | 96 | - uses: actions/upload-artifact@v3
|
97 | 97 | with:
|
98 | 98 | name: nvim-linux64
|
99 | 99 | path: |
|
100 | 100 | build/nvim-linux64.tar.gz
|
101 | 101 | build/nvim-linux64.deb
|
102 | 102 | retention-days: 1
|
| 103 | + |
103 | 104 | - name: Export version
|
104 | 105 | id: build
|
105 | 106 | run: |
|
@@ -127,31 +128,44 @@ jobs:
|
127 | 128 |
|
128 | 129 | - if: github.event_name == 'workflow_dispatch'
|
129 | 130 | run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
| 131 | + |
130 | 132 | - if: github.event_name == 'schedule'
|
131 | 133 | run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
|
| 134 | + |
132 | 135 | - if: github.event_name == 'push'
|
133 | 136 | run: |
|
134 | 137 | TAG_NAME=${{ github.ref }}
|
135 | 138 | echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
|
136 |
| - - if: env.TAG_NAME == 'nightly' |
137 |
| - run: | |
138 |
| - (echo 'SUBJECT=Nvim development (prerelease) build'; |
139 |
| - echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV |
140 |
| - gh release delete nightly --yes || true |
141 |
| - git push origin :nightly || true |
142 |
| - - if: env.TAG_NAME != 'nightly' |
143 |
| - run: | |
144 |
| - (echo 'SUBJECT=Nvim release build'; |
145 |
| - echo 'PRERELEASE=') >> $GITHUB_ENV |
146 |
| - gh release delete stable --yes || true |
147 |
| - git push origin :stable || true |
| 139 | +
|
148 | 140 | - name: Publish release
|
149 | 141 | env:
|
150 | 142 | NVIM_VERSION: ${{ needs.linux.outputs.version }}
|
151 | 143 | DEBUG: api
|
152 | 144 | run: |
|
| 145 | + if [ "$TAG_NAME" == "nightly" ]; then |
| 146 | + SUBJECT='Nvim development (prerelease) build' |
| 147 | + PRERELEASE='--prerelease' |
| 148 | + else |
| 149 | + SUBJECT='Nvim release build' |
| 150 | + PRERELEASE= |
| 151 | + fi |
153 | 152 | envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
|
154 |
| - if [ "$TAG_NAME" != "nightly" ]; then |
155 |
| - gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-linux64/* appimage/* |
| 153 | +
|
| 154 | + if [ "$TAG_NAME" == "nightly" ]; then |
| 155 | + git push origin :nightly || true |
| 156 | + else |
| 157 | + gh release delete stable --yes || true |
| 158 | + git push origin :stable || true |
| 159 | + gh release create stable \ |
| 160 | + --notes-file "$RUNNER_TEMP/notes.md" \ |
| 161 | + --title "$SUBJECT" \ |
| 162 | + --target $GITHUB_SHA \ |
| 163 | + nvim-linux64/* appimage/* |
156 | 164 | fi
|
157 |
| - gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-linux64/* appimage/* |
| 165 | +
|
| 166 | + gh release delete $TAG_NAME --yes || true |
| 167 | + gh release create $TAG_NAME $PRERELEASE \ |
| 168 | + --notes-file "$RUNNER_TEMP/notes.md" \ |
| 169 | + --title "$SUBJECT" \ |
| 170 | + --target $GITHUB_SHA \ |
| 171 | + nvim-linux64/* appimage/* |
0 commit comments