Skip to content

Commit 643bffa

Browse files
committed
[skip changelog] 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 bf0d1b4 commit 643bffa

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

.github/workflows/test-install.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
shell: bash
46+
run: |
47+
"${PWD}/bin/${{ env.TOOL_NAME }}" --version
48+
49+
bindir:
50+
strategy:
51+
fail-fast: false
52+
53+
matrix:
54+
os:
55+
- ubuntu-latest
56+
- windows-latest
57+
- macos-latest
58+
59+
runs-on: ${{ matrix.os }}
60+
61+
steps:
62+
- name: Set install path environment variable
63+
shell: bash
64+
run: |
65+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
66+
echo "BINDIR=${{ runner.temp }}/custom-installation-folder" >> "$GITHUB_ENV"
67+
68+
- name: Checkout local repository
69+
uses: actions/checkout@v2
70+
71+
- name: Run script with custom install location
72+
shell: sh
73+
run: |
74+
mkdir -p "${{ env.BINDIR }}"
75+
"${{ github.workspace }}/etc/install.sh"
76+
77+
- name: Verify installation
78+
shell: bash
79+
run: |
80+
"${{ env.BINDIR }}/${{ env.TOOL_NAME }}" --version
81+
82+
version:
83+
strategy:
84+
fail-fast: false
85+
86+
matrix:
87+
os:
88+
- ubuntu-latest
89+
- windows-latest
90+
- macos-latest
91+
92+
runs-on: ${{ matrix.os }}
93+
94+
env:
95+
VERSION: "1.0.0"
96+
97+
steps:
98+
- name: Checkout local repository
99+
uses: actions/checkout@v2
100+
101+
- name: Run script with version argument
102+
shell: sh
103+
run: |
104+
"${{ github.workspace }}/etc/install.sh" "${{ env.VERSION }}"
105+
106+
- name: Verify installation
107+
shell: bash
108+
run: |
109+
"${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep --fixed-strings "${{ env.VERSION }}"

0 commit comments

Comments
 (0)