Skip to content

Commit ebfb0b9

Browse files
Separate out and use matrix
1 parent 4aa5a6a commit ebfb0b9

File tree

2 files changed

+89
-111
lines changed

2 files changed

+89
-111
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Install matrix (Docker)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- '**'
9+
paths-ignore:
10+
- '.github/workflows/**'
11+
workflow_dispatch:
12+
13+
jobs:
14+
docker-run-ubuntu:
15+
name: clone & docker_run (Ubuntu)
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Build image
21+
run: docker build -t open-edison:ci .
22+
- name: Run container
23+
run: |
24+
docker run -d --name edison-ci -e OPEN_EDISON_CONFIG_DIR=/app -p 3001:3001 -v ${{ github.workspace }}/config.json:/app/config.json open-edison:ci
25+
for i in {1..60}; do if curl -sf http://localhost:3001/health >/dev/null; then echo ok; break; fi; sleep 1; done
26+
- name: Health check
27+
run: curl -sf http://localhost:3001/health | tee /dev/stderr
28+
- name: Cleanup
29+
if: always()
30+
run: |
31+
docker logs edison-ci || true
32+
docker rm -f edison-ci || true
33+
34+
docker-run-macos:
35+
name: clone & docker_run (macOS, self-hosted) [DISABLED]
36+
# Disabled by default: GitHub-hosted macOS runners cannot run Docker due to lack of nested virtualization.
37+
# See: https://github.com/marketplace/actions/setup-docker-on-macos
38+
if: ${{ false }}
39+
runs-on: [self-hosted, macos]
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
- name: Install colima and docker (experimental)
44+
run: |
45+
brew update
46+
brew install colima docker
47+
colima start --cpu 2 --memory 4 --disk 10
48+
- name: Build image
49+
run: docker build -t open-edison:ci .
50+
- name: Run container
51+
run: |
52+
docker run -d --name edison-ci -e OPEN_EDISON_CONFIG_DIR=/app -p 3001:3001 -v ${{ github.workspace }}/config.json:/app/config.json open-edison:ci
53+
for i in {1..60}; do if curl -sf http://localhost:3001/health >/dev/null; then echo ok; break; fi; sleep 1; done
54+
- name: Health check
55+
run: curl -sf http://localhost:3001/health | tee /dev/stderr
56+
- name: Cleanup
57+
if: always()
58+
run: |
59+
docker logs edison-ci || true
60+
docker rm -f edison-ci || true
61+
colima stop || true
62+
63+

.github/workflows/install-matrix.yaml

Lines changed: 26 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
uvx-macos:
15-
name: direct uvx (macOS)
16-
runs-on: macos-14
14+
uvx:
15+
name: direct uvx (${{ matrix.os }})
16+
strategy:
17+
matrix:
18+
os: [macos-14, ubuntu-24.04]
19+
runs-on: ${{ matrix.os }}
1720
steps:
1821
- name: Checkout
1922
uses: actions/checkout@v4
@@ -23,41 +26,32 @@ jobs:
2326
run: |
2427
uvx open-edison --help
2528
26-
uvx-ubuntu:
27-
name: direct uvx (Ubuntu)
28-
runs-on: ubuntu-24.04
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v4
32-
- name: Setup Open Edison
33-
uses: ./.github/actions/setup
34-
- name: direct uvx smoke (PyPI)
35-
run: |
36-
uvx open-edison --help
37-
38-
curl-installer-ubuntu:
39-
name: curl|bash installer (Ubuntu)
40-
runs-on: ubuntu-24.04
41-
steps:
42-
- name: Curl installer smoke
43-
shell: bash
44-
run: |
45-
set -euxo pipefail
46-
curl -fsSL https://raw.githubusercontent.com/Edison-Watch/open-edison/main/curl_pipe_bash.sh | bash -s -- -h
47-
48-
curl-installer-macos:
49-
name: curl|bash installer (macOS)
50-
runs-on: macos-14
29+
curl-installer:
30+
name: curl|bash installer (${{ matrix.os }})
31+
strategy:
32+
matrix:
33+
os: [macos-14, ubuntu-24.04]
34+
runs-on: ${{ matrix.os }}
5135
steps:
5236
- name: Curl installer smoke
5337
shell: bash
5438
run: |
5539
set -euxo pipefail
56-
curl -fsSL https://raw.githubusercontent.com/Edison-Watch/open-edison/main/curl_pipe_bash.sh | bash -s -- -h
40+
REPO="${{ github.repository }}"
41+
REF="${{ github.ref_name }}"
42+
if [ "${{ github.event_name }}" = "pull_request" ]; then
43+
REPO="${{ github.event.pull_request.head.repo.full_name }}"
44+
REF="${{ github.event.pull_request.head.ref }}"
45+
fi
46+
echo "Using repo $REPO @ $REF"
47+
curl -fsSL "https://raw.githubusercontent.com/${REPO}/${REF}/curl_pipe_bash.sh" | bash -s -- -h
5748
58-
clone-make-run-ubuntu:
59-
name: clone & make run (Ubuntu)
60-
runs-on: ubuntu-24.04
49+
clone-make-run:
50+
name: clone & make run (${{ matrix.os }})
51+
strategy:
52+
matrix:
53+
os: [macos-14, ubuntu-24.04]
54+
runs-on: ${{ matrix.os }}
6155
steps:
6256
- name: Checkout
6357
uses: actions/checkout@v4
@@ -87,84 +81,5 @@ jobs:
8781
run: |
8882
if [ -f server.pid ]; then kill $(cat server.pid) || true; fi
8983
90-
clone-make-run-macos:
91-
name: clone & make run (macOS)
92-
runs-on: macos-14
93-
steps:
94-
- name: Checkout
95-
uses: actions/checkout@v4
96-
- name: Setup Open Edison
97-
uses: ./.github/actions/setup
98-
- name: Setup Node
99-
uses: actions/setup-node@v4
100-
with:
101-
node-version: '20'
102-
cache: 'npm'
103-
cache-dependency-path: frontend/package-lock.json
104-
- name: make setup
105-
run: make setup
106-
- name: Start server
107-
run: |
108-
set -euxo pipefail
109-
make run &
110-
echo $! > server.pid
111-
for i in {1..60}; do
112-
if curl -sf http://localhost:3001/health >/dev/null; then
113-
echo "server healthy"; break; fi; sleep 1; done
114-
- name: Health check
115-
run: curl -sf http://localhost:3001/health | tee /dev/stderr
116-
- name: Stop server
117-
if: always()
118-
run: |
119-
if [ -f server.pid ]; then kill $(cat server.pid) || true; fi
120-
121-
docker-run-ubuntu:
122-
name: clone & docker_run (Ubuntu)
123-
runs-on: ubuntu-24.04
124-
steps:
125-
- name: Checkout
126-
uses: actions/checkout@v4
127-
- name: Build image
128-
run: docker build -t open-edison:ci .
129-
- name: Run container
130-
run: |
131-
docker run -d --name edison-ci -e OPEN_EDISON_CONFIG_DIR=/app -p 3001:3001 -v ${{ github.workspace }}/config.json:/app/config.json open-edison:ci
132-
for i in {1..60}; do if curl -sf http://localhost:3001/health >/dev/null; then echo ok; break; fi; sleep 1; done
133-
- name: Health check
134-
run: curl -sf http://localhost:3001/health | tee /dev/stderr
135-
- name: Cleanup
136-
if: always()
137-
run: |
138-
docker logs edison-ci || true
139-
docker rm -f edison-ci || true
140-
141-
docker-run-macos:
142-
name: clone & docker_run (macOS, self-hosted) [DISABLED]
143-
# Disabled by default: GitHub-hosted macOS runners cannot run Docker due to lack of nested virtualization.
144-
# See: https://github.com/marketplace/actions/setup-docker-on-macos
145-
if: ${{ false }}
146-
runs-on: [self-hosted, macos]
147-
steps:
148-
- name: Checkout
149-
uses: actions/checkout@v4
150-
- name: Install colima and docker (experimental)
151-
run: |
152-
brew update
153-
brew install colima docker
154-
colima start --cpu 2 --memory 4 --disk 10
155-
- name: Build image
156-
run: docker build -t open-edison:ci .
157-
- name: Run container
158-
run: |
159-
docker run -d --name edison-ci -e OPEN_EDISON_CONFIG_DIR=/app -p 3001:3001 -v ${{ github.workspace }}/config.json:/app/config.json open-edison:ci
160-
for i in {1..60}; do if curl -sf http://localhost:3001/health >/dev/null; then echo ok; break; fi; sleep 1; done
161-
- name: Health check
162-
run: curl -sf http://localhost:3001/health | tee /dev/stderr
163-
- name: Cleanup
164-
if: always()
165-
run: |
166-
docker logs edison-ci || true
167-
docker rm -f edison-ci || true
168-
colima stop || true
16984
17085

0 commit comments

Comments
 (0)