Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bc7d1c7

Browse files
committedFeb 22, 2024·
chore: Separate installer CI tests
1 parent 8262e43 commit bc7d1c7

File tree

2 files changed

+94
-53
lines changed

2 files changed

+94
-53
lines changed
 

‎.github/workflows/installer.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: installer
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
env:
10+
SHA: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
11+
jobs:
12+
changes:
13+
runs-on: ubuntu-22.04
14+
outputs:
15+
sh: ${{ steps.filter.outputs.sh }}
16+
ps1: ${{ steps.filter.outputs.ps1 }}
17+
permissions:
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
21+
- id: filter
22+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd
23+
with:
24+
filters: |
25+
shared: &shared
26+
- '.github/workflows/installer.yml'
27+
sh:
28+
- *shared
29+
- 'assets/scripts/install*.sh'
30+
- 'internal/cmds/generate-install.sh/install.sh.tmpl'
31+
ps1:
32+
- *shared
33+
- 'assets/scripts/install.ps1'
34+
misspell:
35+
runs-on: ubuntu-22.04
36+
permissions:
37+
contents: read
38+
steps:
39+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
40+
- uses: reviewdog/action-misspell@06d6a480724fa783c220081bbc22336a78dbbe82
41+
with:
42+
locale: US
43+
test-install-sh:
44+
if: ${{ needs.changes.outputs.sh == 'true' }}
45+
strategy:
46+
matrix:
47+
os: [macos-11, ubuntu-20.04, windows-2022]
48+
needs: changes
49+
runs-on: ${{ matrix.os }}
50+
env:
51+
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
52+
steps:
53+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
54+
- name: test-${{ matrix.os }}-local
55+
shell: bash
56+
run: |
57+
rm -f ${{ env.BINARY }}
58+
sh assets/scripts/install.sh -d
59+
${{ env.BINARY }} --version
60+
- name: test-${{ matrix.os }}-url
61+
shell: bash
62+
run: |
63+
rm -f ${{ env.BINARY }}
64+
sh -c "$(curl -fsLS https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.sh)" -- -d
65+
${{ env.BINARY }} --version
66+
test-install-ps1:
67+
if: ${{ needs.changes.outputs.ps1 == 'true' }}
68+
strategy:
69+
matrix:
70+
os: [macos-11, ubuntu-20.04, windows-2022]
71+
needs: changes
72+
runs-on: ${{ matrix.os }}
73+
env:
74+
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
75+
steps:
76+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
77+
- name: test-${{ matrix.os }}-local
78+
shell: pwsh
79+
run: |
80+
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
81+
assets/scripts/install.ps1 -d
82+
${{ env.BINARY }} --version
83+
- name: test-${{ matrix.os }}-url
84+
shell: pwsh
85+
run: |
86+
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
87+
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.ps1')} -d"
88+
${{ env.BINARY }} --version

‎.github/workflows/main.yml

+6-53
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ jobs:
3737
filters: |
3838
code:
3939
- '**/*.go'
40-
- '**/*.ps1'
41-
- '**/*.tmpl'
42-
- '.github/workflows/**'
40+
- '.github/workflows/main.yml'
4341
- '.goreleaser.yaml'
4442
- 'Makefile'
43+
- 'assets/**/*.tmpl'
4544
- 'assets/docker/**'
46-
- 'assets/scripts/**'
45+
- 'assets/scripts/*.py'
46+
- 'assets/scripts/generate-commit.sh'
47+
- 'assets/scripts/stow-to-chezmoi.sh'
4748
- 'assets/vagrant/**'
49+
- 'completions/**'
4850
- 'go.*'
4951
- 'internal/**'
5052
codeql:
@@ -131,22 +133,6 @@ jobs:
131133
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
132134
run: |
133135
go test -race ./...
134-
- name: test-install.sh
135-
run: |
136-
sh assets/scripts/install.sh
137-
bin/chezmoi --version
138-
- name: test-install.ps1
139-
shell: pwsh
140-
run: |
141-
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
142-
assets/scripts/install.ps1 -d
143-
bin/chezmoi --version
144-
- name: test-install.ps1-irm
145-
shell: pwsh
146-
run: |
147-
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
148-
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
149-
bin/chezmoi --version
150136
test-oldstable-go:
151137
needs: changes
152138
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
@@ -289,24 +275,6 @@ jobs:
289275
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
290276
run: |
291277
go test -ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o002" -race -timeout=1h ./...
292-
- name: test-install.sh
293-
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
294-
run: |
295-
rm -f bin/chezmoi
296-
sh assets/scripts/install.sh
297-
bin/chezmoi --version
298-
- name: test-install.ps1
299-
shell: pwsh
300-
run: |
301-
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
302-
assets/scripts/install.ps1 -d
303-
bin/chezmoi --version
304-
- name: test-install.ps1-irm
305-
shell: pwsh
306-
run: |
307-
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
308-
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
309-
bin/chezmoi --version
310278
test-website:
311279
runs-on: ubuntu-22.04
312280
permissions:
@@ -351,21 +319,6 @@ jobs:
351319
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
352320
run: |
353321
go test -race ./...
354-
- name: test-install.ps1
355-
run: |
356-
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
357-
assets/scripts/install.ps1 -d
358-
bin/chezmoi.exe --version
359-
- name: test-install.ps1-irm
360-
run: |
361-
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
362-
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
363-
bin/chezmoi.exe --version
364-
- name: test-install.ps1-iwr
365-
run: |
366-
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
367-
iex "&{$(iwr 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
368-
bin/chezmoi.exe --version
369322
check:
370323
runs-on: ubuntu-22.04
371324
permissions:

0 commit comments

Comments
 (0)
Please sign in to comment.