diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000000..cee68b4eeaa7b7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build + +on: [push, pull_request] + +# Cancel in-progress runs for the same branch/PR to avoid wasting resources. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build (ubuntu-latest) + runs-on: ubuntu-latest + permissions: + contents: read + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get -q update + sudo apt-get -q -y install \ + make gcc ccache libssl-dev libcurl4-openssl-dev libexpat-dev \ + zlib1g-dev gettext libpcre2-dev + + - name: Restore build cache + uses: actions/cache@v4 + with: + path: ${{ env.CCACHE_DIR }} + key: ccache-build-${{ github.ref_name }}-${{ github.run_id }} + restore-keys: | + ccache-build-${{ github.ref_name }}- + ccache-build- + + - name: Build + run: | + export PATH="/usr/lib/ccache:$PATH" + ccache --zero-stats + make + ccache --show-stats + + - name: Smoke test + run: | + ./git --version + ./git init --bare /tmp/smoke-test-repo + + - name: Run tests + run: | + export PATH="/usr/lib/ccache:$PATH" + make test + + - name: Print test failures + if: failure() + run: ci/print-test-failures.sh + + - name: Upload failed tests' directories + if: failure() && env.FAILED_TEST_ARTIFACTS != '' + uses: actions/upload-artifact@v5 + with: + name: failed-tests + path: ${{ env.FAILED_TEST_ARTIFACTS }}