Skip to content

Commit fe772d8

Browse files
committed
Add test workflow and improve Coder binary setup
- Introduce a GitHub Actions workflow for testing on push and PR. - Improve Coder binary setup to support both ARM64 and AMD64. - Ensure binaries are installed in local bin directory. - Update path configuration to include Coder binary location.
1 parent 70cabd9 commit fe772d8

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

.github/workflows/test.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest]
15+
arch: [amd64, arm64]
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Run Setup Coder Action
21+
uses: ./
22+
with:
23+
access_url: ${{ secrets.CODER_URL }}
24+
coder_session_token: ${{ secrets.CODER_SESSION_TOKEN }}
25+
26+
- name: Run Coder CLI
27+
run: coder whoami

action.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,23 @@ inputs:
1717
runs:
1818
using: "composite"
1919
steps:
20-
- name: Download Coder binary from access URL
21-
run: curl -fsSL $CODER_URL/bin/coder-linux-amd64 -o /usr/local/bin/coder && chmod +x /usr/local/bin/coder
20+
- name: Download and install Coder binary
21+
run: |
22+
if [ "${{ runner.arch }}" == "ARM64" ]; then
23+
ARCH="arm64"
24+
else
25+
ARCH="amd64"
26+
fi
27+
mkdir -p $HOME/.local/bin
28+
curl -fsSL ${{ inputs.access_url }}/bin/coder-linux-${ARCH} -o $HOME/.local/bin/coder
29+
chmod +x $HOME/.local/bin/coder
30+
echo "$HOME/.local/bin" >> $GITHUB_PATH
31+
$HOME/.local/bin/coder version
2232
shell: bash
23-
env:
24-
CODER_URL: ${{ inputs.access_url }}
2533

2634
- name: Login to Coder
2735
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
2836
shell: bash
2937
env:
3038
CODER_URL: ${{ inputs.access_url }}
31-
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}
39+
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}

0 commit comments

Comments
 (0)