Skip to content

Commit

Permalink
ci: merge build and smoke-test into one workflow (#175)
Browse files Browse the repository at this point in the history
Signed-off-by: Lincoln Wallace <[email protected]>
  • Loading branch information
locnnil authored Aug 26, 2024
1 parent 6e33ea2 commit 9fd6878
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 41 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

42 changes: 29 additions & 13 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
name: Smoke Test

on:
workflow_run:
workflows: ["Build"]
types:
- completed
push:
branches: [ main ]
pull_request:
# Manual trigger
workflow_dispatch:

defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build
uses: snapcore/action-build@v1
id: snapcraft
with:
snapcraft-args: snap --output docker_${{ github.run_id}}.snap

- name: Upload
uses: actions/upload-artifact@v4
with:
name: docker_${{ github.run_id}}.snap
path: ${{ steps.snapcraft.outputs.snap }}

smoke-test:
needs: build
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get the artifact
uses: dawidd6/action-download-artifact@v6
- name: Download artifact
uses: actions/download-artifact@v4
with:
workflow_search: true
name: docker_[0-9]+.snap
name_is_regexp: true
name: docker_${{ github.run_id }}.snap

- name: Prep
run: |
Expand All @@ -44,9 +62,7 @@ jobs:
- name: Install
run: |
# dawidd6/action-download-artifact action creates a directory when the name is given as a RegExp
cd ./docker_*.snap
sudo snap install --dangerous ./docker_*.snap
sudo snap install --dangerous ./docker_${{ github.run_id }}.snap
# it will immediately be failing to start, so let's head that off as quickly as we can
sudo snap stop --disable docker.dockerd
Expand Down

0 comments on commit 9fd6878

Please sign in to comment.