2023-07-02 10:48:26 -07:00
|
|
|
name: CI
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
2023-07-04 16:00:25 +09:00
|
|
|
- "jq-*"
|
2023-07-02 10:48:26 -07:00
|
|
|
pull_request:
|
2023-07-03 08:46:35 +09:00
|
|
|
|
2023-07-02 10:48:26 -07:00
|
|
|
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 }}
|
2023-07-03 08:46:35 +09:00
|
|
|
SUFFIX: linux-${{ matrix.image }}-${{ matrix.compiler }}
|
2023-07-02 10:48:26 -07:00
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Install packages
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -qq
|
2023-07-03 21:05:21 +09:00
|
|
|
sudo apt-get install -y automake autoconf
|
2023-07-02 10:48:26 -07:00
|
|
|
- name: Build
|
|
|
|
run: |
|
2023-07-03 21:05:21 +09:00
|
|
|
autoreconf -i
|
2023-07-04 16:00:04 +09:00
|
|
|
./configure \
|
2023-07-03 21:05:21 +09:00
|
|
|
--disable-docs \
|
2023-07-02 10:48:26 -07:00
|
|
|
--disable-maintainer-mode \
|
|
|
|
--disable-valgrind \
|
|
|
|
--with-oniguruma=builtin \
|
2023-07-03 21:05:21 +09:00
|
|
|
${{ matrix.configure_flag }}
|
2023-07-02 10:48:26 -07:00
|
|
|
make
|
2023-07-03 08:46:35 +09:00
|
|
|
strip jq
|
2023-07-02 10:48:26 -07:00
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
make check
|
2023-07-03 21:05:21 +09:00
|
|
|
git diff --exit-code
|
2023-07-02 10:48:26 -07:00
|
|
|
- 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
|
2023-07-03 08:46:35 +09:00
|
|
|
path: jq
|
|
|
|
|
2023-07-02 10:48:26 -07:00
|
|
|
macos:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
compiler: [gcc, clang]
|
|
|
|
image: [macos-11, macos-12, macos-13]
|
|
|
|
runs-on: ${{ matrix.image }}
|
|
|
|
env:
|
|
|
|
CC: ${{ matrix.compiler }}
|
2023-07-03 08:46:35 +09:00
|
|
|
SUFFIX: macos-${{ matrix.image }}-${{ matrix.compiler }}
|
2023-07-02 10:48:26 -07:00
|
|
|
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
|
2023-07-03 21:05:21 +09:00
|
|
|
brew install autoconf automake libtool
|
2023-07-02 10:48:26 -07:00
|
|
|
- name: Build
|
|
|
|
run: |
|
2023-07-03 21:05:21 +09:00
|
|
|
autoreconf -i
|
2023-07-04 16:00:04 +09:00
|
|
|
./configure \
|
2023-07-03 21:05:21 +09:00
|
|
|
--disable-docs \
|
2023-07-02 10:48:26 -07:00
|
|
|
--disable-maintainer-mode \
|
|
|
|
--disable-valgrind \
|
|
|
|
--with-oniguruma=builtin \
|
|
|
|
--enable-static \
|
2023-07-03 21:05:21 +09:00
|
|
|
--enable-all-static
|
2023-07-02 10:48:26 -07:00
|
|
|
make
|
2023-07-03 08:46:35 +09:00
|
|
|
strip jq
|
2023-07-02 10:48:26 -07:00
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
make check
|
2023-07-03 21:05:21 +09:00
|
|
|
git diff --exit-code
|
2023-07-02 10:48:26 -07:00
|
|
|
- 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
|
2023-07-03 08:46:35 +09:00
|
|
|
path: jq
|
|
|
|
|
2023-07-02 10:48:26 -07:00
|
|
|
windows:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
compiler: [gcc]
|
|
|
|
image: [windows-2019, windows-2022]
|
|
|
|
runs-on: ${{ matrix.image }}
|
|
|
|
env:
|
|
|
|
CC: ${{ matrix.compiler }}
|
2023-07-03 08:46:35 +09:00
|
|
|
SUFFIX: windows-${{ matrix.image }}-${{ matrix.compiler }}
|
2023-07-02 10:48:26 -07:00
|
|
|
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
|
|
|
|
- name: Build
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
2023-07-03 21:05:21 +09:00
|
|
|
autoreconf -i
|
2023-07-04 16:00:04 +09:00
|
|
|
./configure \
|
2023-07-03 21:05:21 +09:00
|
|
|
--disable-docs \
|
2023-07-02 10:48:26 -07:00
|
|
|
--disable-maintainer-mode \
|
|
|
|
--disable-valgrind \
|
|
|
|
--with-oniguruma=builtin \
|
|
|
|
--disable-shared \
|
|
|
|
--enable-static \
|
2023-07-03 21:05:21 +09:00
|
|
|
--enable-all-static
|
2023-07-02 10:48:26 -07:00
|
|
|
make
|
2023-07-03 08:46:35 +09:00
|
|
|
strip jq.exe
|
2023-07-02 10:48:26 -07:00
|
|
|
- name: Test
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
|
|
|
make check
|
2023-07-03 21:05:21 +09:00
|
|
|
git diff --exit-code --ignore-submodules
|
2023-07-02 10:48:26 -07:00
|
|
|
- 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
|
2023-07-03 08:46:35 +09:00
|
|
|
path: jq.exe
|
|
|
|
|
2023-07-03 21:05:21 +09:00
|
|
|
dist:
|
|
|
|
runs-on: ubuntu-latest
|
2023-07-05 04:33:57 +09:00
|
|
|
if: startsWith(github.ref, 'refs/tags/jq-')
|
2023-07-03 21:05:21 +09:00
|
|
|
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
|
|
|
|
- name: Create dist
|
|
|
|
run: |
|
|
|
|
autoreconf -i
|
2023-07-04 16:00:04 +09:00
|
|
|
./configure \
|
2023-07-03 21:05:21 +09:00
|
|
|
--disable-docs \
|
|
|
|
--disable-maintainer-mode \
|
|
|
|
--disable-valgrind \
|
|
|
|
--with-oniguruma=builtin
|
|
|
|
make dist dist-zip
|
|
|
|
git diff --exit-code
|
|
|
|
- name: Upload Artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: jq-dist
|
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 7
|
|
|
|
path: |
|
|
|
|
jq-*.tar.gz
|
|
|
|
jq-*.zip
|
|
|
|
|
2023-07-05 04:33:57 +09:00
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
if: startsWith(github.ref, 'refs/tags/jq-')
|
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Docker metadata
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
id: metadata
|
|
|
|
with:
|
|
|
|
images: ghcr.io/${{ github.repository }}
|
|
|
|
tags: type=match,pattern=jq-(.*),group=1,value=${{ github.ref_name }}
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and release Docker image
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
provenance: false
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
|
|
|
|
tags: ${{ steps.metadata.outputs.tags }}
|
|
|
|
labels: ${{ steps.metadata.outputs.labels }}
|
|
|
|
|
2023-07-02 10:48:26 -07:00
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-07-05 04:33:57 +09:00
|
|
|
needs: [linux, macos, windows, dist, docker]
|
|
|
|
if: startsWith(github.ref, 'refs/tags/jq-')
|
2023-07-02 10:48:26 -07:00
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- 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
|
2023-07-03 21:05:21 +09:00
|
|
|
cp artifacts/jq-dist/jq-* release/
|
2023-07-05 04:33:57 +09:00
|
|
|
gh release create "$TAG_NAME" --draft --title "jq ${TAG_NAME#jq-}" --generate-notes
|
|
|
|
gh release upload "$TAG_NAME" --clobber release/jq-*
|