Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffb078f

Browse files
author
Steven Silvester
authored
Add composite GitHub Action for Octave installation (#259)
Extracts platform-specific Octave install logic into a reusable composite action (action.yml) with an install-type input supporting ubuntu, macos, windows, and ubuntu-flatpak. Updates test.yml to use the local action.
1 parent 3804417 commit ffb078f

2 files changed

Lines changed: 57 additions & 17 deletions

File tree

.github/workflows/test.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
- name: Install uv
3333
uses: astral-sh/setup-uv@v4
3434
- name: Install octave
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install -y octave gnuplot
35+
uses: ./
36+
with:
37+
install-type: ubuntu
3838
- name: Install just
3939
uses: extractions/setup-just@v2
4040
- name: Install dependencies
@@ -59,7 +59,9 @@ jobs:
5959
- name: Install just
6060
uses: extractions/setup-just@v2
6161
- name: Install octave
62-
run: brew install octave
62+
uses: ./
63+
with:
64+
install-type: macos
6365
- name: Run test on macos
6466
run: just test
6567

@@ -74,13 +76,9 @@ jobs:
7476
- name: Install just
7577
uses: extractions/setup-just@v2
7678
- name: Install octave
77-
run: choco install octave --no-progress -y
78-
- name: Add octave to PATH
79-
shell: bash
80-
run: |
81-
octave_bin=$(find "/c/Program Files/GNU Octave" -type f -name "octave.exe" | head -1)
82-
octave_bin=$(dirname "$octave_bin")
83-
echo "$octave_bin" >> "$GITHUB_PATH"
79+
uses: ./
80+
with:
81+
install-type: windows
8482
- name: Run test on windows
8583
run: just test
8684

@@ -94,12 +92,10 @@ jobs:
9492
uses: astral-sh/setup-uv@v4
9593
- name: Install just
9694
uses: extractions/setup-just@v2
97-
- name: Install flatpak and octave via flatpak
98-
run: |
99-
sudo apt-get update
100-
sudo apt-get install -y flatpak dbus-x11
101-
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
102-
sudo flatpak install -y --noninteractive flathub org.octave.Octave
95+
- name: Install octave
96+
uses: ./
97+
with:
98+
install-type: ubuntu-flatpak
10399
- name: Install dependencies
104100
run: just install
105101
- name: Run test with flatpak octave

action.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Install Octave
2+
description: Installs Octave for the given platform type.
3+
4+
inputs:
5+
install-type:
6+
description: 'Platform install type: ubuntu, macos, windows, or ubuntu-flatpak'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Install octave (ubuntu)
13+
if: inputs.install-type == 'ubuntu'
14+
shell: bash
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y octave gnuplot
18+
19+
- name: Install octave (macos)
20+
if: inputs.install-type == 'macos'
21+
shell: bash
22+
run: brew install octave
23+
24+
- name: Install octave (windows)
25+
if: inputs.install-type == 'windows'
26+
shell: bash
27+
run: choco install octave --no-progress -y
28+
29+
- name: Add octave to PATH (windows)
30+
if: inputs.install-type == 'windows'
31+
shell: bash
32+
run: |
33+
octave_bin=$(find "/c/Program Files/GNU Octave" -type f -name "octave.exe" | head -1)
34+
octave_bin=$(dirname "$octave_bin")
35+
echo "$octave_bin" >> "$GITHUB_PATH"
36+
37+
- name: Install flatpak and octave via flatpak (ubuntu-flatpak)
38+
if: inputs.install-type == 'ubuntu-flatpak'
39+
shell: bash
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install -y flatpak dbus-x11
43+
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
44+
sudo flatpak install -y --noninteractive flathub org.octave.Octave

0 commit comments

Comments
 (0)