Release pipeline (#2620)

* Release pipeline

* Group CI builds for different OSes into `ci.yml`.
* Add release job to release `jq` when tag is in the format of v*.
* Use `clang` as the only compiler on CI.
* Provide extensible matrix for future cross-compile builds, e.g.
  for https://github.com/jqlang/jq/pull/2618.

* Locate bison for Windows build

* Also install flex for Windows build

* Add matrix to test all available GH Actions images

* Enable all tests for Windows

* Run `brew update-reset` when `brew update` fails

`brew update` can fail for "Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!"

Ref: https://github.com/owenthereal/jq/actions/runs/5432314910/jobs/9879266028#step:3:19

* Select gcc binaries to release

* Only enable CI when push to master & tag

* Try out statick build

* No need to enforce the same `AM_INIT_AUTOMAKE` version for MacOS

* Disable static build for ubuntu-20.04

See https://github.com/jqlang/jq/pull/2620#discussion_r1248936822
This commit is contained in:
Owen Ou authored and GitHub committed 2023-07-02 10:48:26 -07:00
1 parent f88c4e5888
commit 44a0f3448a
4 files changed
+224 -177

No files matched your search

+224
View File
@@ -0,0 +1,224 @@
name: CI
on:
push:
branches:
- master
tags:
- "v*"
pull_request:
jobs:
linux:
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
image: [ubuntu-20.04, ubuntu-22.04]
include:
- compiler: gcc
image: ubuntu-20.04
configure_flag: ''
- compiler: gcc
image: ubuntu-22.04
configure_flag: --enable-static --enable-all-static
- compiler: clang
image: ubuntu-20.04
configure_flag: ''
- compiler: clang
image: ubuntu-22.04
configure_flag: --enable-static --enable-all-static
runs-on: ${{ matrix.image }}
env:
CC: ${{ matrix.compiler }}
SUFFIX: linux-${{ matrix.image}}-${{ matrix.compiler }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update -qq
sudo apt-get install -y \
automake \
autoconf \
bison \
flex \
gdb \
python3
- name: Build
run: |
autoreconf -fi
./configure --disable-dependency-tracking \
--disable-silent-rules \
--disable-maintainer-mode \
--disable-valgrind \
--with-oniguruma=builtin \
${{ matrix.configure_flag }} \
YACC="$(which bison) -y"
make
- name: Test
run: |
make check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ env.SUFFIX }}
if-no-files-found: error
retention-days: 7
path: |
jq
macos:
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
image: [macos-11, macos-12, macos-13]
runs-on: ${{ matrix.image }}
env:
CC: ${{ matrix.compiler }}
SUFFIX: macos-${{ matrix.image}}-${{ matrix.compiler }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
# brew update sometimes fails with "Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!"
brew update || brew update-reset
brew install \
autoconf \
automake \
libtool \
flex \
bison
- name: Build
run: |
autoreconf -fi
./configure --disable-dependency-tracking \
--disable-silent-rules \
--disable-maintainer-mode \
--disable-valgrind \
--with-oniguruma=builtin \
--enable-static \
--enable-all-static \
YACC="$(brew --prefix)/opt/bison/bin/bison -y"
make
- name: Test
run: |
make check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ env.SUFFIX }}
if-no-files-found: error
retention-days: 7
path: |
jq
windows:
strategy:
fail-fast: false
matrix:
compiler: [gcc]
image: [windows-2019, windows-2022]
runs-on: ${{ matrix.image }}
env:
CC: ${{ matrix.compiler }}
SUFFIX: windows-${{ matrix.image}}-${{ matrix.compiler }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
git
clang
autoconf
automake
libtool
bison
flex
- name: Build
shell: msys2 {0}
run: |
autoreconf -fi
./configure --disable-dependency-tracking \
--disable-silent-rules \
--disable-maintainer-mode \
--disable-valgrind \
--with-oniguruma=builtin \
--disable-shared \
--enable-static \
--enable-all-static \
YACC="$(which bison) -y"
make
- name: Test
shell: msys2 {0}
run: |
make check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ env.SUFFIX }}
retention-days: 7
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ env.SUFFIX }}
if-no-files-found: error
retention-days: 7
path: |
jq.exe
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [linux, macos, windows]
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Merge built artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload release
env:
TAG_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir release
cp artifacts/jq-linux-ubuntu-22.04-gcc/jq release/jq-linux-amd64
cp artifacts/jq-macos-macos-13-gcc/jq release/jq-macos-amd64
cp artifacts/jq-windows-windows-2022-gcc/jq.exe release/jq-windows-amd64.exe
gh release create $TAG_NAME --draft --title "jq ${TAG_NAME#v}" --generate-notes
gh release upload $TAG_NAME --clobber release/jq-*
-70
View File
@@ -1,70 +0,0 @@
name: Linux Build
on:
push:
branches:
- master
pull_request:
jobs:
linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [linux-clang, linux-gcc]
include:
- name: linux-clang
os: ubuntu-22.04
compiler: clang
cflags: ''
- name: linux-gcc
os: ubuntu-22.04
compiler: gcc
cflags: '-Wnonnull'
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
sudo apt-get update -qq
sudo apt-get install -y \
automake \
autoconf \
bison \
flex \
gdb \
python3 \
valgrind
- name: Build
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
autoreconf -fi
rm src/lexer.c src/lexer.h
rm src/parser.c src/parser.h
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE
make -j4
make dist
- name: Test
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
ulimit -c unlimited
make -j4 check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ matrix.name }}
path: |
jq
-62
View File
@@ -1,62 +0,0 @@
name: macOS Build
on:
push:
branches:
- master
pull_request:
jobs:
macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [macos-12-clang, macos-13-clang]
include:
- name: macos-12-clang
os: macos-12
compiler: clang
- name: macos-13-clang
os: macos-13
compiler: clang
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install packages
run: |
brew update
brew install autoconf automake libtool flex bison
sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
- name: Build
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
autoreconf -fi
rm src/lexer.c src/lexer.h
rm src/parser.c src/parser.h
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(brew --prefix)/opt/bison/bin/bison -y" $COVERAGE
make -j4
make dist
- name: Test
env:
CC: ${{ matrix.compiler }}
MAKEVARS: ${{ matrix.makevars }}
run: |
ulimit -c unlimited
make -j4 check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ matrix.name }}
path: |
jq
-45
View File
@@ -1,45 +0,0 @@
name: Windows Build
on:
push:
branches:
- master
pull_request:
jobs:
windows:
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
git
clang
autoconf
automake
libtool
p7zip
- shell: msys2 {0}
run: |
autoreconf -fiv
./configure --disable-valgrind --with-oniguruma=builtin --disable-shared --enable-static --enable-all-static
make -j4
make SUBDIRS= "TESTS=tests/mantest tests/jqtest tests/onigtest tests/base64test" check
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs
path: |
test-suite.log
tests/*.log
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-windows
path: |
jq.exe