Skip to content

Commit

Permalink
feat: add test builds of the snap on pull_request events (#64)
Browse files Browse the repository at this point in the history
* feat: add test-build-snap.yaml to do test builds on the snap on pull_request events
* docs: add comments in build/release workflows to alert developers about duplication
  • Loading branch information
ca-scribner authored Jun 17, 2024
1 parent 0423da4 commit 8d645ba
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-snap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Build and release the snap on merge to main
#
# test-build-snap.yaml duplicates some of this workflow's logic. If modifying this workflow, ensure
# that test-build-snap.yaml is also updated
name: Release Snap

on:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/test-build-snap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Build the snap on pull_request to ensure the snap is buildable before merge to main
#
# This workflow duplicates some of the logic from release-snap.yaml. If modifying this workflow,
# ensure that release-snap.yaml is also updated
name: Test Build Snap

on:
pull_request:

env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
LAUNCHPAD_TOKEN: ${{ secrets.LAUNCHPAD_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# snapcraft remote-build requires a full clone
fetch-depth: 0

- name: Setup LXD
uses: canonical/[email protected]
with:
channel: latest/stable

- name: Install dependencies
run: |
sudo snap install --classic --channel edge snapcraft
# Setup Launchpad credentials
mkdir -p ~/.local/share/snapcraft
echo -e "$LAUNCHPAD_TOKEN" >> ~/.local/share/snapcraft/launchpad-credentials
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
- name: Build Snap (remote)
run: snapcraft remote-build --launchpad-accept-public-upload

0 comments on commit 8d645ba

Please sign in to comment.