Skip to content

Commit

Permalink
Add composite action to test the setup action
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Kyle Harding <kyle@balena.io>
  • Loading branch information
klutchell committed Apr 12, 2024
1 parent c70d5e3 commit ef0988a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
22 changes: 22 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: "Test setup of balena CLI"
description: "Test setup of balena CLI composite action"
# this inputs are always provided by flowzone, so they must always be defined on the composite action
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
variables:
description: "JSON stringified object containing all the variables from the calling workflow"
required: true
runs:
using: "composite"
steps:
- name: Test setup of balena CLI
uses: ./
with:
cli-version: latest
balena-token: ${{ fromJSON(inputs.secrets).BALENA_API_KEY }}
5 changes: 5 additions & 0 deletions .github/workflows/flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ jobs:
github.event_name == 'pull_request_target'
)
secrets: inherit
with:
custom_test_matrix: >
{
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
}
13 changes: 2 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ inputs:
balena-token:
description: "balenaCloud API token to login automatically"
required: false
# balena-env:
# description: "balenaCloud environment to use"
# required: false

# Builds and then runs as separate steps as default GitHub method does not allow passing build args
runs:
Expand All @@ -27,7 +24,7 @@ runs:
Linux) echo "slug=linux" >> "${GITHUB_OUTPUT}" ;;
Windows) echo "slug=windows" >> "${GITHUB_OUTPUT}" ;;
macOS) echo "slug=macOS" >> "${GITHUB_OUTPUT}" ;;
*) echo "Unsupported OS: ${{ runner.os }} ; exit 1 ;;
*) echo "Unsupported OS: ${{ runner.os }}" ; exit 1 ;;
esac
- name: Check runner Arch
Expand All @@ -37,7 +34,7 @@ runs:
case ${{ runner.arch }} in
X64) echo "slug=x64" >> "${GITHUB_OUTPUT}" ;;
ARM64) echo "slug=arm64" >> "${GITHUB_OUTPUT}" ;;
*) echo "Unsupported Arch: ${{ runner.arch }} ; exit 1 ;;
*) echo "Unsupported Arch: ${{ runner.arch }}" ; exit 1 ;;
esac
- name: Check CLI version
Expand Down Expand Up @@ -74,12 +71,6 @@ runs:
shell: bash
run: balena version

# - name: Setup balena environment
# if: inputs.balena-env != ''
# shell: bash
# run: |
# yq '.balenaUrl = "${{ inputs.balena-env}}"' ~/.balenarc.yml

- name: Login to balenaCloud
if: inputs.balena-token != ''
shell: bash
Expand Down

0 comments on commit ef0988a

Please sign in to comment.