|
| 1 | +name: LOCI Analysis |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - loci/main-* |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | + |
| 9 | +jobs: |
| 10 | + loci: |
| 11 | + runs-on: ubuntu-24.04-arm |
| 12 | + |
| 13 | + env: |
| 14 | + # @configure: Set your loci project name or keep it empty if project name is derived from repo name |
| 15 | + LOCI_PROJECT: 'protobuf' |
| 16 | + LOCI_API_KEY: '${{ secrets.LOCI_API_KEY }}' |
| 17 | + LOCI_BACKEND_URL: '${{ vars.LOCI_BACKEND_URL }}' |
| 18 | + GH_TOKEN: ${{ secrets.MIRROR_REPOS_WRITE_PAT }} |
| 19 | + |
| 20 | + environment: ${{ vars.LOCI_ENV || 'PROD__AL_DEMO' }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + ref: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha }} |
| 28 | + |
| 29 | + - name: Compute target |
| 30 | + id: target |
| 31 | + if: github.event_name == 'push' |
| 32 | + run: | |
| 33 | + branch="${{ github.ref_name }}" |
| 34 | + sha="${branch#loci/main-}" |
| 35 | + echo "value=main@${sha}" >> "$GITHUB_OUTPUT" |
| 36 | +
|
| 37 | + - name: Compute base |
| 38 | + id: base |
| 39 | + if: github.event_name == 'pull_request' |
| 40 | + run: | |
| 41 | + git remote add upstream "https://github.com/${{ vars.UPSTREAM_REPO }}.git" 2>/dev/null || true |
| 42 | + git fetch upstream |
| 43 | + upstream_default=$(gh api "repos/${{ vars.UPSTREAM_REPO }}" --jq .default_branch) |
| 44 | + merge_base=$(git merge-base HEAD "upstream/${upstream_default}") |
| 45 | + short_sha="${merge_base:0:7}" |
| 46 | + echo "value=main@${short_sha}" >> "$GITHUB_OUTPUT" |
| 47 | +
|
| 48 | + # @configure: Install build dependencies for your project |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install -y \ |
| 53 | + cmake \ |
| 54 | + gcc \ |
| 55 | + g++ |
| 56 | + shell: bash -euo pipefail {0} |
| 57 | + |
| 58 | + # @configure: Configure your project |
| 59 | + - name: configure with CMake |
| 60 | + run: | |
| 61 | + cmake -S . -B build \ |
| 62 | + -DCMAKE_INSTALL_PREFIX=../protobuf-install \ |
| 63 | + -DCMAKE_BUILD_TYPE=Release |
| 64 | +
|
| 65 | + # @configure: Build your project binaries |
| 66 | + - name: Build |
| 67 | + run: | |
| 68 | + cmake --build build --parallel 10 |
| 69 | + cp build/protoc build/protoc-stable |
| 70 | + shell: bash -euo pipefail {0} |
| 71 | + |
| 72 | + - name: Upload |
| 73 | + uses: auroralabs-loci/loci-action@v1 |
| 74 | + with: |
| 75 | + mode: upload |
| 76 | + # @configure: List your binary paths/directories/globs |
| 77 | + binaries: | |
| 78 | + build/protoc-stable |
| 79 | + project: '${{ env.LOCI_PROJECT }}' |
| 80 | + target: ${{ steps.target.outputs.value || ''}} |
| 81 | + base: ${{ steps.base.outputs.value || '' }} |
0 commit comments