bat-extras/.github/actions/install-dependencies/action.yaml
Ethan P 90bb604d74
ci: Add GitHub Actions test workflow
This will eventually replace CircleCI.
2022-07-29 15:55:51 -07:00

88 lines
2.5 KiB
YAML

name: 'Install dependencies'
description: 'Installs all the dependencies needed.'
inputs:
build:
description: 'Install build dependencies.'
required: false
default: true
test:
description: 'Install test dependencies.'
required: true
default: false
version_bat:
description: 'The version of bat to install.'
required: false
default: "latest"
version_ripgrep:
description: 'The version of ripgrep to install.'
required: false
default: "latest"
runs:
using: "composite"
steps:
- name: Create directories
shell: bash
run: |
test -d "${RUNNER_TEMP}/bin" || mkdir -p "${RUNNER_TEMP}/bin"
test -d "${RUNNER_TEMP}/dl" || mkdir -p "${RUNNER_TEMP}/dl"
- name: Install shfmt (build dependency)
shell: bash
if: ${{ env.ACT || inputs.build == 'true' }}
run: |
curl \
--silent \
--location \
--output "${RUNNER_TEMP}/bin/shfmt" \
"https://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_amd64"
chmod +x "${RUNNER_TEMP}/bin/shfmt"
- name: Download bat (test dependency)
uses: dsaltares/fetch-gh-release-asset@1.0.0
if: ${{ env.ACT || inputs.test == 'true' }}
with:
file: "bat-v[0-9\\.]+-x86_64-unknown-linux-gnu.tar.gz"
repo: "sharkdp/bat"
# version: "${{ inputs.version_bat || "latest" }}"
regex: true
target: ".dl/"
- name: Install bat
shell: bash
if: ${{ env.ACT || inputs.test == 'true' }}
run: |
tar -xf \
"${{ github.workspace }}/.dl"/bat-*.tar.* \
-C "${{ runner.temp }}/dl/"
find "${{ runner.temp }}/dl" \
-type f -iname "bat" \
-exec mv {} "${RUNNER_TEMP}/bin/" \;
- name: Download ripgrep (test dependency)
uses: dsaltares/fetch-gh-release-asset@1.0.0
if: ${{ env.ACT || inputs.test == 'true' }}
with:
file: "ripgrep_[0-9\\.]+_amd64.deb"
repo: "BurntSushi/ripgrep"
# version: "${{ inputs.version_ripgrep || "latest" }}"
regex: true
target: ".dl/"
- name: Install ripgrep
shell: bash
if: ${{ env.ACT || inputs.test == 'true' }}
run: |
dpkg-deb -x \
"${{ github.workspace }}/.dl"/ripgrep_*.deb \
"${{ runner.temp }}/dl/"
find "${{ runner.temp }}/dl" \
-type f -iname "rg" \
-exec mv {} "${{ runner.temp }}/bin/" \;