-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(linux): Move API verification to separate action
The new `api-verification` workflow runs after `deb-packaging`. Implements #10626.
- Loading branch information
1 parent
55dc824
commit f7490c0
Showing
3 changed files
with
147 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: "API Verification" | ||
on: | ||
workflow_run: | ||
workflows: [Ubuntu packaging] | ||
types: | ||
- completed | ||
|
||
env: | ||
STATUS_CONTEXT: 'API Verification' | ||
PKG_NAME: 'libkeymancore' | ||
|
||
jobs: | ||
setup_environment: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.environment_step.outputs.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@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | ||
with: | ||
path: | | ||
artifacts | ||
key: artifacts-key-${GITHUB_RUN_ID} | ||
restore-keys: artifacts-key- | ||
|
||
- name: Read environment | ||
id: environment_step | ||
run: | | ||
cat artifacts/env >> $GITHUB_OUTPUT | ||
api_verification: | ||
name: Verify API for libkeymancore.so | ||
needs: setup_environment | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set pending status on PR builds | ||
id: set_status | ||
if: needs.setup_environment.outputs.IS_TEST_BUILD == 'true' | ||
shell: bash | ||
run: | | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
/repos/$GITHUB_REPOSITORY/statuses/${{ needs.setup_environment.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@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | ||
with: | ||
ref: '${{ needs.setup_environment.outputs.GIT_SHA }}' | ||
fetch-depth: 0 | ||
|
||
- name: Install devscripts | ||
uses: ./.github/actions/apt-install | ||
with: | ||
packages: devscripts equivs | ||
|
||
- name: "Verify API for libkeymancore.so (${{ needs.setup_environment.outputs.GIT_BRANCH }}, branch ${{ needs.setup_environment.outputs.GIT_BASE_BRANCH }}, by ${{ needs.setup_environment.outputs.GIT_USER }}) - " | ||
run: | | ||
cd linux | ||
./scripts/deb-packaging.sh \ | ||
--gha \ | ||
--bin-pkg "${GITHUB_WORKSPACE}/artifacts/${PKG_NAME}_${{ needs.setup_environment.outputs.VERSION }}-1${{ needs.setup_environment.outputs.PRERELEASE_TAG }}+$(lsb_release -c -s)1_amd64.deb" \ | ||
--git-sha "${{ needs.setup_environment.outputs.GIT_SHA }}" \ | ||
--git-base "${{ needs.setup_environment.outputs.GIT_BASE }}" \ | ||
verify 2>> $GITHUB_STEP_SUMMARY | ||
- name: Archive .symbols file | ||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | ||
with: | ||
name: libkeymancore.symbols | ||
path: linux/debian/tmp/DEBIAN/symbols | ||
if: always() | ||
|
||
set_status: | ||
name: Set result status on PR builds | ||
needs: [setup_environment, api_verification] | ||
runs-on: ubuntu-latest | ||
if: ${{ always() && needs.setup_environment.outputs.IS_TEST_BUILD == 'true' }} | ||
steps: | ||
- name: Set success | ||
if: needs.api_verification.result == 'success' | ||
run: | | ||
echo "RESULT=success" >> $GITHUB_ENV | ||
echo "MSG=Package build succeeded" >> $GITHUB_ENV | ||
- name: Set cancelled | ||
if: needs.api_verification.result == 'cancelled' | ||
run: | | ||
echo "RESULT=error" >> $GITHUB_ENV | ||
echo "MSG=Package build cancelled" >> $GITHUB_ENV | ||
- name: Set failure | ||
if: needs.api_verification.result == 'failure' | ||
run: | | ||
echo "RESULT=failure" >> $GITHUB_ENV | ||
echo "MSG=Package build failed" >> $GITHUB_ENV | ||
- name: Set final status | ||
run: | | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
/repos/$GITHUB_REPOSITORY/statuses/${{ needs.setup_environment.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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters