Skip to content

feat: support macOS, Windows and arm64 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test

on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: List directory contents
run: ls -R

- name: Run Setup Coder Action
uses: ./
with:
access_url: ${{ secrets.CODER_URL }}
coder_session_token: ${{ secrets.CODER_SESSION_TOKEN }}

- name: Run Coder CLI
run: |
coder version
coder whoami
41 changes: 37 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,48 @@ inputs:
runs:
using: "composite"
steps:
- name: Download Coder binary from access URL
run: curl -fsSL $CODER_URL/bin/coder-linux-amd64 -o /usr/local/bin/coder && chmod +x /usr/local/bin/coder
- name: Download and install Coder binary (Windows)
if: runner.os == 'Windows'
run: |
if (${{ runner.arch }} -eq "ARM64") {
$ARCH = "arm64"
} else {
$ARCH = "amd64"
}
curl -fsSL ${{ inputs.access_url }}/bin/coder-windows-$ARCH.exe -o $env:USERPROFILE\AppData\Local\bin\coder.exe
echo "$env:USERPROFILE\AppData\Local\bin" >> $GITHUB_PATH
shell: pwsh

- name: Download and install Coder binary (Linux/macOS)
if: runner.os != 'Windows'
run: |
if [ "${{ runner.arch }}" == "ARM64" ]; then
ARCH="arm64"
else
ARCH="amd64"
fi
if [ "${{ runner.os }}" == "macOS" ]; then
OS="darwin"
else
OS="linux"
fi
curl -fsSL ${{ inputs.access_url }}/bin/coder-${OS}-${ARCH} -o $HOME/.local/bin/coder
chmod +x $HOME/.local/bin/coder
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Login to Coder (Windows)
if: runner.os == 'Windows'
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
shell: pwsh
env:
CODER_URL: ${{ inputs.access_url }}
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}

- name: Login to Coder
- name: Login to Coder (Linux/macOS)
if: runner.os != 'Windows'
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
shell: bash
env:
CODER_URL: ${{ inputs.access_url }}
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}
Loading