-
Notifications
You must be signed in to change notification settings - Fork 38
CI: Build debian packages and run autopackage tests #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5b1713b
CI: Add workflow to build debian package as part of build
3v1n0 d3c221d
CI: Add workflow to run autopkgtests on the previously built deb package
3v1n0 a35b553
CI/build-deb: reuse desktop actions to run autopkgtests
3v1n0 a2abdb9
debian/tests/run-tests: Try to use the backported go version
3v1n0 f1bd88c
CI/build-deb: Use a matrix to run package builds in latest LTS and devel
3v1n0 3fd53e7
ci: Only run autpkgtests on main, on tags and if a debian file is mod…
3v1n0 628967f
debian/changelog: Drop trailing whitespace
3v1n0 2a78294
debian/copyright: Drop superflus files patterns
3v1n0 0642fbb
build-deb: Lock the cargo-filterer-version to the noble one
3v1n0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,126 @@ | ||
| name: Build debian packages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - "*" | ||
| pull_request: | ||
|
|
||
| env: | ||
| UBUNTU_VERSIONS: | | ||
| ["noble", "devel"] | ||
| CARGO_VENDOR_FILTERER_VERSION: 0.5.16 | ||
|
|
||
| jobs: | ||
| define-versions: | ||
| name: Define build versions | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| ubuntu-versions: ${{ env.UBUNTU_VERSIONS }} | ||
| steps: | ||
| - run: 'true' | ||
|
|
||
| build-deb-package: | ||
| name: Build ubuntu package | ||
| runs-on: ubuntu-latest | ||
| needs: define-versions | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ubuntu-version: ${{ fromJSON(needs.define-versions.outputs.ubuntu-versions) }} | ||
| outputs: | ||
| run-id: ${{ github.run_id }} | ||
| pkg-src-changes: ${{ env.PKG_SOURCE_CHANGES }} | ||
|
|
||
| steps: | ||
| - name: Checkout authd code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build debian packages and sources | ||
| uses: canonical/desktop-engineering/gh-actions/common/build-debian@main | ||
| with: | ||
| docker-image: ubuntu:${{ matrix.ubuntu-version }} | ||
| extra-source-build-deps: | | ||
| ca-certificates | ||
| git | ||
| libssl-dev | ||
| extra-source-build-script: | | ||
| cargo install --locked --root=/usr \ | ||
| cargo-vendor-filterer@${{ env.CARGO_VENDOR_FILTERER_VERSION }} | ||
| command -v cargo-vendor-filterer | ||
|
|
||
| check-modified-files: | ||
| name: Check modified files | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build-deb-package | ||
| outputs: | ||
| list: ${{ fromJSON(steps.git-diff.outputs.modified_files) }} | ||
|
|
||
| steps: | ||
| - name: Checkout authd code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 100 | ||
|
|
||
| - id: git-diff | ||
| name: Check modified files | ||
| run: | | ||
| set -ue | ||
|
|
||
| base_ref=${{ github.event.pull_request.base.sha }} | ||
| if [ -z "${base_ref}" ]; then | ||
| base_ref=${{ github.event.before }} | ||
| fi | ||
| if [ -z "${base_ref}" ]; then | ||
| base_ref=$(git log --root --reverse -n1 --format=%H) | ||
| fi | ||
|
|
||
| # Build a JSON array of modified paths. | ||
| modified_files=$(git diff --name-only "${base_ref}" HEAD | \ | ||
| while read line; do | ||
| jq -n --arg path "$line" '$path' | ||
| done | jq -n '. |= [inputs]') | ||
| echo "${modified_files}" | ||
|
|
||
| escaped_json=$(echo "${modified_files}" | jq '.| tostring') | ||
| echo "modified_files=${escaped_json}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| run-autopkgtests: | ||
| name: Run autopkgtests | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - define-versions | ||
| - build-deb-package | ||
| - check-modified-files | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ubuntu-version: ${{ fromJSON(needs.define-versions.outputs.ubuntu-versions) }} | ||
|
|
||
| # Run autopkgtests only on: | ||
| # - Push events to main | ||
| # - When a file in the debian subdir is modified | ||
| # - When this file is modified | ||
| # - On new tags | ||
| # - On github release | ||
| if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || | ||
|
didrocks marked this conversation as resolved.
|
||
| contains(needs.check-modified-files.outputs.list, 'debian/') || | ||
| contains(needs.check-modified-files.outputs.list, '.github/workflows/build-deb.yaml') || | ||
| startsWith(github.ref, 'refs/tags/') || | ||
| github.event_name == 'release' }} | ||
|
|
||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| run-id: ${{ needs.build-deb-package.outputs.run-id }} | ||
| merge-multiple: true | ||
|
3v1n0 marked this conversation as resolved.
|
||
|
|
||
| - name: Run autopkgtests | ||
| uses: canonical/desktop-engineering/gh-actions/common/run-autopkgtest@main | ||
| with: | ||
| lxd-image: ubuntu:${{ matrix.ubuntu-version }} | ||
| source-changes: ${{ needs.build-deb-package.outputs.pkg-src-changes }} | ||
This file contains hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -eu | ||
|
|
||
| debian_path=$(dirname "$0") | ||
| backported_go_version=$(grep-dctrl -s Build-Depends -n - "${debian_path}"/control | \ | ||
| sed -n "s,.*\bgolang-\([0-9.]\+\)\b.*,\1,p") | ||
|
|
||
| if [ -n "${backported_go_version}" ]; then | ||
| echo "/usr/lib/go-${backported_go_version}/bin" | ||
| fi |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.