From 5ce85eaf30a9b93cb376ee438a159c77ffc8e598 Mon Sep 17 00:00:00 2001 From: Dimi Kot Date: Tue, 27 Feb 2024 23:48:22 -0800 Subject: [PATCH] Add action.yml and self-test Pull Request: https://github.com/dimikot/ci-storage/pull/1 (main) --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ action.yml | 34 +++++++++++++--------------------- 2 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9b40524 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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: "" diff --git a/action.yml b/action.yml index 4abdc05..722fb41 100644 --- a/action.yml +++ b/action.yml @@ -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.' @@ -30,21 +30,13 @@ 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: ./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}', env.GITHUB_RUN_ID, env.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" || "" }}