Skip to content

Commit 8785256

Browse files
committed
Add workflow to test install script
In addition to being fairly complex and convoluted, the install script has a fragile reliance on the release page HTML having a specific format. It also relies on the file being available at a specific path on the Arduino download server, which is subject to change.
1 parent 7a54ccf commit 8785256

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/test-install.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Test install script
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/test-install.yml"
7+
- "etc/install.sh"
8+
pull_request:
9+
paths:
10+
- ".github/workflows/test-install.yml"
11+
- "etc/install.sh"
12+
schedule:
13+
# Run every day at 03:00 UTC to catch breakage caused by external events
14+
- cron: "0 3 * * *"
15+
# workflow_dispatch event allows the workflow to be triggered manually.
16+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
17+
workflow_dispatch:
18+
19+
env:
20+
TOOL_NAME: arduino-lint # The executable's file name
21+
22+
jobs:
23+
default:
24+
strategy:
25+
fail-fast: false
26+
27+
matrix:
28+
os:
29+
- ubuntu-latest
30+
- windows-latest
31+
- macos-latest
32+
33+
runs-on: ${{ matrix.os }}
34+
35+
steps:
36+
- name: Checkout local repository
37+
uses: actions/checkout@v2
38+
39+
- name: Run script with defaults
40+
shell: sh
41+
run: |
42+
"${{ github.workspace }}/etc/install.sh"
43+
44+
- name: Verify installation
45+
run: |
46+
"${PWD}/bin/${{ env.TOOL_NAME }}" --version
47+
48+
bindir:
49+
strategy:
50+
fail-fast: false
51+
52+
matrix:
53+
os:
54+
- ubuntu-latest
55+
- windows-latest
56+
- macos-latest
57+
58+
runs-on: ${{ matrix.os }}
59+
60+
steps:
61+
- name: Set install path environment variable
62+
run: |
63+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
64+
echo "BINDIR=${{ runner.temp }}/custom-installation-folder" >> "$GITHUB_ENV"
65+
66+
- name: Checkout local repository
67+
uses: actions/checkout@v2
68+
69+
- name: Run script with custom install location
70+
shell: sh
71+
run: |
72+
mkdir --parents "$BINDIR"
73+
"${{ github.workspace }}/etc/install.sh"
74+
75+
- name: Verify installation
76+
run: |
77+
"${BINDIR}/${{ env.TOOL_NAME }}" --version
78+
79+
version:
80+
strategy:
81+
fail-fast: false
82+
83+
matrix:
84+
os:
85+
- ubuntu-latest
86+
- windows-latest
87+
- macos-latest
88+
89+
runs-on: ${{ matrix.os }}
90+
91+
env:
92+
VERSION: "1.0.0"
93+
94+
steps:
95+
- name: Checkout local repository
96+
uses: actions/checkout@v2
97+
98+
- name: Run script with version argument
99+
shell: sh
100+
run: |
101+
"${{ github.workspace }}/etc/install.sh" "${{ env.VERSION }}"
102+
103+
- name: Verify installation
104+
shell: bash
105+
run: |
106+
"${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep --fixed-strings "${{ env.VERSION }}"

0 commit comments

Comments
 (0)