mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 16:35:33 +00:00
121 lines
4.6 KiB
YAML
121 lines
4.6 KiB
YAML
name: "API Verification"
|
|
on:
|
|
workflow_run:
|
|
workflows: [Ubuntu packaging]
|
|
types:
|
|
- completed
|
|
|
|
env:
|
|
STATUS_CONTEXT: 'API Verification'
|
|
PKG_NAME: 'libkeymancore'
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
jobs:
|
|
api_verification:
|
|
name: Verify API for libkeymancore*.so
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
KEYMAN_VERSION: ${{ steps.environment_step.outputs.KEYMAN_VERSION }}
|
|
PRERELEASE_TAG: ${{ steps.environment_step.outputs.PRERELEASE_TAG }}
|
|
GIT_SHA: ${{ steps.environment_step.outputs.GIT_SHA }}
|
|
GIT_BASE: ${{ steps.environment_step.outputs.GIT_BASE }}
|
|
IS_TEST_BUILD: ${{ steps.environment_step.outputs.IS_TEST_BUILD }}
|
|
GIT_BRANCH: ${{ steps.environment_step.outputs.GIT_BRANCH }}
|
|
GIT_BASE_BRANCH: ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}
|
|
GIT_USER: ${{ steps.environment_step.outputs.GIT_USER }}
|
|
|
|
steps:
|
|
- name: Restore artifacts
|
|
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: |
|
|
artifacts
|
|
key: artifacts-key-${{ github.event.workflow_run.id }}
|
|
restore-keys: artifacts-key-
|
|
|
|
- name: Read environment
|
|
id: environment_step
|
|
run: |
|
|
cat artifacts/env >> $GITHUB_OUTPUT
|
|
|
|
- name: Set pending status on PR builds
|
|
id: set_status
|
|
if: steps.environment_step.outputs.IS_TEST_BUILD == 'true'
|
|
shell: bash
|
|
run: |
|
|
gh api \
|
|
--method POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
/repos/$GITHUB_REPOSITORY/statuses/${{ steps.environment_step.outputs.GIT_SHA }} \
|
|
-f state='pending' \
|
|
-f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
|
|
-f description='API verification started' \
|
|
-f context="$STATUS_CONTEXT"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
|
with:
|
|
ref: '${{ steps.environment_step.outputs.GIT_SHA }}'
|
|
fetch-depth: 0
|
|
clean: false
|
|
path: ${{ github.workspace }}/keyman/
|
|
|
|
- name: Install devscripts
|
|
uses: ./keyman/.github/actions/apt-install
|
|
with:
|
|
packages: devscripts equivs
|
|
|
|
- name: "Verify API for libkeymancore*.so (${{ steps.environment_step.outputs.GIT_BRANCH }}, branch ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}, by ${{ steps.environment_step.outputs.GIT_USER }})"
|
|
run: |
|
|
echo "Verify API for libkeymancore*.so (${{ steps.environment_step.outputs.GIT_BRANCH }}, branch ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}, by ${{ steps.environment_step.outputs.GIT_USER }}):" >> $GITHUB_STEP_SUMMARY
|
|
|
|
BIN_PACKAGE=$(ls "${GITHUB_WORKSPACE}/artifacts/" | grep "${PKG_NAME}[0-9]*_${{ steps.environment_step.outputs.KEYMAN_VERSION }}-1${{ steps.environment_step.outputs.PRERELEASE_TAG }}+$(lsb_release -c -s)1_amd64.deb")
|
|
cd ${{ github.workspace }}/keyman/linux
|
|
./scripts/deb-packaging.sh \
|
|
--gha \
|
|
--bin-pkg "${GITHUB_WORKSPACE}/artifacts/${BIN_PACKAGE}" \
|
|
--git-sha "${{ steps.environment_step.outputs.GIT_SHA }}" \
|
|
--git-base "${{ steps.environment_step.outputs.GIT_BASE }}" \
|
|
verify 2>> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Archive .symbols file
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: libkeymancore.symbols
|
|
path: ${{ github.workspace }}/keyman/linux/debian/tmp/DEBIAN/symbols
|
|
if: always()
|
|
|
|
set_status:
|
|
name: Set result status on PR builds
|
|
needs: [api_verification]
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() && needs.api_verification.outputs.IS_TEST_BUILD == 'true' }}
|
|
steps:
|
|
- name: Set success
|
|
if: needs.api_verification.result == 'success'
|
|
run: |
|
|
echo "RESULT=success" >> $GITHUB_ENV
|
|
echo "MSG=API verification succeeded" >> $GITHUB_ENV
|
|
|
|
- name: Set cancelled
|
|
if: needs.api_verification.result == 'cancelled'
|
|
run: |
|
|
echo "RESULT=error" >> $GITHUB_ENV
|
|
echo "MSG=API verification cancelled" >> $GITHUB_ENV
|
|
|
|
- name: Set failure
|
|
if: needs.api_verification.result == 'failure'
|
|
run: |
|
|
echo "RESULT=failure" >> $GITHUB_ENV
|
|
echo "MSG=API verification failed" >> $GITHUB_ENV
|
|
|
|
- name: Set final status
|
|
run: |
|
|
gh api \
|
|
--method POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
/repos/$GITHUB_REPOSITORY/statuses/${{ needs.api_verification.outputs.GIT_SHA }} \
|
|
-f state="$RESULT" \
|
|
-f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
|
|
-f description="$MSG" \
|
|
-f context="$STATUS_CONTEXT"
|