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 6763ec6

Browse files
committedFeb 21, 2024·
chore: Separate installer CI tests
1 parent 8262e43 commit 6763ec6

File tree

6 files changed

+93
-52
lines changed

6 files changed

+93
-52
lines changed
 

‎.github/workflows/installer.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
sh:
26+
- 'assets/scripts/install*.sh'
27+
- 'internal/cmds/generate-install.sh/install.sh.tmpl'
28+
ps1:
29+
- 'assets/scripts/install.ps1'
30+
misspell:
31+
runs-on: ubuntu-22.04
32+
permissions:
33+
contents: read
34+
steps:
35+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
36+
- uses: reviewdog/action-misspell@06d6a480724fa783c220081bbc22336a78dbbe82
37+
with:
38+
locale: US
39+
test-install-sh:
40+
if: ${{ needs.changes.outputs.sh == 'true' }}
41+
strategy:
42+
matrix:
43+
os: [macos-11, ubuntu-20.04, windows-2022]
44+
needs: changes
45+
runs-on: ${{ matrix.os }}
46+
env:
47+
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
48+
steps:
49+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
50+
- name: test-${{ matrix.os }}-local
51+
shell: bash
52+
run: |
53+
rm -f ${{ env.BINARY }}
54+
sh assets/scripts/install.sh -d
55+
${{ env.BINARY }} --version
56+
- name: test-${{ matrix.os }}-url
57+
shell: bash
58+
run: |
59+
rm -f ${{ env.BINARY }}
60+
sh -c "$(curl -fsLS https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.sh)" -- -d
61+
${{ env.BINARY }} --version
62+
test-install-ps1:
63+
if: ${{ needs.changes.outputs.ps1 == 'true' }}
64+
strategy:
65+
matrix:
66+
os: [macos-11, ubuntu-20.04, windows-2022]
67+
needs: changes
68+
runs-on: ${{ matrix.os }}
69+
env:
70+
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
71+
steps:
72+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
73+
- name: test-${{ matrix.os }}-local
74+
shell: pwsh
75+
run: |
76+
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
77+
assets/scripts/install.ps1 -d
78+
${{ env.BINARY }} --version
79+
- name: test-${{ matrix.os }}-url
80+
shell: pwsh
81+
run: |
82+
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
83+
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.ps1')} -d"
84+
${{ env.BINARY }} --version

‎.github/workflows/main.yml

+5-52
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ jobs:
3737
filters: |
3838
code:
3939
- '**/*.go'
40-
- '**/*.ps1'
41-
- '**/*.tmpl'
4240
- '.github/workflows/**'
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:

‎assets/scripts/install-local-bin.sh

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎assets/scripts/install.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Move-Item -Path $tempBinaryPath -Destination $binary -Force
258258
Write-Information "installed ${binary}"
259259

260260
Invoke-CleanUp $tempDir
261+
# done
261262

262263
if (($null -ne $ChezmoiArgs) -and ($ChezmoiArgs.Count -gt 0)) {
263264
& $binary $ChezmoiArgs

‎assets/scripts/install.sh

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎internal/cmds/generate-install.sh/install.sh.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,5 @@ log_crit() {
327327
printf 'critical %s\n' "${*}" 1>&2
328328
}
329329

330+
# main
330331
main "${@}"

0 commit comments

Comments
 (0)
Please sign in to comment.