name: CI on: push: pull_request: jobs: linux: strategy: fail-fast: false matrix: compiler: [gcc, clang] image: [ubuntu-20.04, ubuntu-22.04] 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 \ YACC="$(which bison) -y" make cp jq jq-${{ env.SUFFIX }} - 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-${{ env.SUFFIX }} 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 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 run: | autoreconf -fi ./configure --disable-dependency-tracking \ --disable-silent-rules \ --disable-maintainer-mode \ --disable-valgrind \ --with-oniguruma=builtin \ YACC="$(brew --prefix)/opt/bison/bin/bison -y" make cp jq jq-${{ env.SUFFIX }} - 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-${{ env.SUFFIX }} 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 cp jq.exe jq-${{ env.SUFFIX }}.exe - name: Test shell: msys2 {0} run: | make -j3 SUBDIRS= 'TESTS=tests/mantest tests/jqtest tests/onigtest tests/base64test' check make SUBDIRS= TESTS=tests/optionaltest check || true make SUBDIRS= TRACE_TESTS=1 TESTS=tests/shtest check || true - 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-${{ env.SUFFIX }}.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: | gh release create $TAG_NAME --draft --title "jq ${TAG_NAME#v}" --generate-notes gh release upload $TAG_NAME --clobber artifacts/jq-*/*