8000 Add CI workflow with OS-specific Coder setup · coder/setup-action@4277773 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4277773

Browse files
committed
Add CI workflow with OS-specific Coder setup
- Introduce a GitHub Actions workflow to run tests on multiple OSs. - Add conditional steps for downloading Coder binaries based on OS. - Include architecture-specific handling for Linux and macOS. - Adjust path settings and shell usage for Windows compatibility.
1 parent 70cabd9 commit 4277773

File tree

2 files changed

+55
-5
lines changed

2 files changed

+55
-5
lines changed

.github/workflows/test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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, windows-latest, macos-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: ./action.yaml
22+
with:
23+
access_url: "https://coder.example.com"
24+
coder_session_token: "dummy_token"

action.yaml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,41 @@ 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 Coder binary from access URL (Windows)
21+
if: runner.os == 'Windows'
22+
run: |
23+
curl -fsSL ${{ inputs.access_url }}/bin/coder-windows-amd64.exe -o $env:USERPROFILE\AppData\Local\bin\coder.exe
24+
echo "$env:USERPROFILE\AppData\Local\bin" >> $GITHUB_PATH
25+
shell: pwsh
26+
27+
- name: Download Coder binary from access URL (Linux)
28+
if: runner.os == 'Linux'
29+
run: |
30+
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
31+
ARCH="arm64"
32+
else
33+
ARCH="amd64"
34+
fi
35+
curl -fsSL ${{ inputs.access_url }}/bin/coder-linux-$ARCH -o $HOME/.local/bin/coder
36+
chmod +x $HOME/.local/bin/coder
37+
echo "$HOME/.local/bin" >> $GITHUB_PATH
38+
shell: bash
39+
40+
- name: Download Coder binary from access URL (macOS)
41+
if: runner.os == 'macOS'
42+
run: |
43+
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
44+
ARCH="arm64"
45+
else
46+
ARCH="amd64"
47+
fi
48+
curl -fsSL ${{ inputs.access_url }}/bin/coder-darwin-$ARCH -o $HOME/.local/bin/coder
49+
chmod +x $HOME/.local/bin/coder
2250
shell: bash
23-
env:
24-
CODER_URL: ${{ inputs.access_url }}
2551

2652
- name: Login to Coder
27-
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
2853
shell: bash
54+
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
2955
env:
3056
CODER_URL: ${{ inputs.access_url }}
3157
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}

0 commit comments

Comments
 (0)
0