diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0a177e..4be9cbb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,11 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/action.yml b/action.yml index 65a2ff5..7323c5c 100644 --- a/action.yml +++ b/action.yml @@ -12,27 +12,18 @@ inputs: runs: using: composite steps: - - name: Setup Jelly CLI (Linux x86_64) - if: runner.os == 'Linux' + - name: Setup Jelly CLI (Unix-like) + if: runner.os == 'Linux' || runner.os == 'macOS' shell: bash env: GITHUB_TOKEN: ${{ inputs.token }} INPUT_VERSION: ${{ inputs.version }} - run: | - set -e - if [ $INPUT_VERSION = latest ]; then - version=$(gh api repos/Jelly-RDF/cli/releases/latest -q .tag_name); - else - version=$INPUT_VERSION; - if [ ${version:0:1} != 'v' ]; then version="v$version"; fi - fi - wget -O /opt/jelly-cli "https://github.com/Jelly-RDF/cli/releases/download/$version/jelly-cli-linux-x86_64" - chmod +x /opt/jelly-cli - echo '/opt' >> $GITHUB_PATH - - - name: Setup Jelly CLI (Other) - if: runner.os != 'Linux' - shell: bash - run: | - echo "::error::Support for platforms other than Linux x86_64 is not yet implemented" - exit 1 + run: $GITHUB_ACTION_PATH/unix-like.sh + + - name: Setup Jelly CLI (Windows) + if: runner.os == 'Windows' + shell: pwsh + env: + GITHUB_TOKEN: ${{ inputs.token }} + INPUT_VERSION: ${{ inputs.version }} + run: '& $env:GITHUB_ACTION_PATH\windows.ps1' diff --git a/unix-like.sh b/unix-like.sh new file mode 100755 index 0000000..ed197c5 --- /dev/null +++ b/unix-like.sh @@ -0,0 +1,20 @@ +set -e +if [ $INPUT_VERSION = latest ]; then + version=$(gh api repos/Jelly-RDF/cli/releases/latest -q .tag_name); +else + version=$INPUT_VERSION; + if [ ${version:0:1} != 'v' ]; then version="v$version"; fi +fi +if [ $RUNNER_OS = 'Linux' ]; then + osname="linux"; +else + osname="mac"; +fi +arch=$(uname -m) +if [ $arch = "aarch64" ]; then + arch="arm64" +fi +mkdir "$RUNNER_TOOL_CACHE/jelly-cli" +wget -O "$RUNNER_TOOL_CACHE/jelly-cli/jelly-cli" "https://github.com/Jelly-RDF/cli/releases/download/$version/jelly-cli-$osname-$arch" +chmod +x "$RUNNER_TOOL_CACHE/jelly-cli/jelly-cli" +echo "$RUNNER_TOOL_CACHE/jelly-cli" >> $GITHUB_PATH \ No newline at end of file diff --git a/windows.ps1 b/windows.ps1 new file mode 100644 index 0000000..8a6aa5d --- /dev/null +++ b/windows.ps1 @@ -0,0 +1,14 @@ +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' +Set-StrictMode -Version Latest + +if ($env:INPUT_VERSION -eq "latest") { + $version=(gh api repos/Jelly-RDF/cli/releases/latest -q .tag_name) +} elseif ($env:INPUTVERSION.StartsWith("v")) { + $version=$env:INPUTVERSION +} else { + $version="v" + $env:INPUTVERSION +} +New-Item $env:RUNNER_TOOL_CACHE\jelly-cli -ItemType Directory -Force +Invoke-WebRequest https://github.com/Jelly-RDF/cli/releases/download/$version/jelly-cli-windows-x86_64.exe -OutFile $env:RUNNER_TOOL_CACHE\jelly-cli\jelly-cli.exe +Add-Content $env:GITHUB_PATH $env:RUNNER_TOOL_CACHE\jelly-cli \ No newline at end of file