Skip to content

Commit

Permalink
Add action.yml and self-test
Browse files Browse the repository at this point in the history
Pull Request: #1 (main)
  • Loading branch information
dimikot committed Feb 28, 2024
1 parent 1cd6d75 commit 3a2943f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 21 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "CI Full Run"
on:
pull_request:
branches:
- main
- grok/*/*
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test store
uses: ./
with:
action: "store"
storage-host: ""
- name: Test load
uses: ./
with:
action: "load"
storage-host: ""
35 changes: 14 additions & 21 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ inputs:
description: "What to do (store or load)."
required: true
storage-host:
description: "Storage host in the format [user@]host; it must have password-free SSH key access. If not set, uses CI_STORAGE_HOST environment variable. Must not be empty eventually."
required: false
description: "Storage host in the format [user@]host; it must have password-free SSH key access."
required: true
storage-dir:
description: "Storage directory on the remote host. If not set, uses CI_STORAGE_DIR environment variable. If still empty, uses the ci-storage tool default ~/ci-storage."
description: "Storage directory on the remote host. If not set, uses the ci-storage tool default ~/ci-storage."
required: false
storage-max-age-sec:
description: "Remove slots created earlier than this many seconds ago. If not set, uses CI_STORAGE_MAX_AGE_SEC environment variable. If still empty, uses the ci-storage tool default 4 hours."
description: "Remove slots created earlier than this many seconds ago. If not set, uses the ci-storage tool default 4 hours."
required: false
slot-id:
description: 'Id of the slot to store to or load from; use "*" to load a random most recent slot. If empty, uses "$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" value.'
Expand All @@ -30,21 +30,14 @@ runs:
using: "composite"
steps:
- name: Run ci-storage ${{ inputs.action }}
run: ci-storage \
--storage-host="$CI_STORAGE_HOST" \
--storage-dir="$CI_STORAGE_DIR" \
--storage-max-age-sec="$CI_STORAGE_MAX_AGE_SEC" \
--slot-id="$SLOT_ID" \
--local-dir="$LOCAL_DIR" \
--exclude="$EXCLUDE" \
$VERBOSE \
"${{ inputs.action }}"
run: >
pwd && ./ci-storage
--storage-host="${{ inputs.storage-host || '' }}"
--storage-dir="${{ inputs.storage-dir || '' }}"
--storage-max-age-sec="${{ inputs.storage-max-age-sec || '' }}"
--slot-id="${{ inputs.slot-id || format('{0}-{1}', github.run_id, github.run_attempt) }}"
--local-dir="${{ inputs.local-dir || '.' }}"
--exclude="${{ inputs.exclude || '' }}"
${{ inputs.verbose && '--verbose' || '' }}
${{ inputs.action }}
shell: bash
env:
CI_STORAGE_HOST: ${{ inputs.storage-host || env.CI_STORAGE_HOST || "" }}
CI_STORAGE_DIR: ${{ inputs.storage-dir || env.CI_STORAGE_DIR || "" }}
CI_STORAGE_MAX_AGE_SEC: ${{ inputs.storage-max-age-sec || env.CI_STORAGE_MAX_AGE_SEC || "" }}
SLOT_ID: ${{ inputs.slot-id || format("{0}-{1}", env.GITHUB_RUN_ID, env.GITHUB_RUN_ATTEMPT) }}
LOCAL_DIR: ${{ inputs.local-dir || "." }}
EXCLUDE: ${{ inputs.exclude || "" }}
VERBOSE: ${{ inputs.verbose && "--verbose" || "" }}

0 comments on commit 3a2943f

Please sign in to comment.