Skip to content

Commit

Permalink
chore: Separate installer CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenhilton committed Feb 22, 2024
1 parent 5201ddc commit 0d6c4c2
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 53 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: installer
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
SHA: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
jobs:
changes:
runs-on: ubuntu-22.04
outputs:
sh: ${{ steps.filter.outputs.sh }}
ps1: ${{ steps.filter.outputs.ps1 }}
permissions:
contents: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: filter
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd
with:
filters: |
shared: &shared
- '.github/workflows/installer.yml'
sh:
- *shared
- 'assets/scripts/install*.sh'
- 'internal/cmds/generate-install.sh/install.sh.tmpl'
ps1:
- *shared
- 'assets/scripts/install.ps1'
misspell:
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: reviewdog/action-misspell@06d6a480724fa783c220081bbc22336a78dbbe82
with:
locale: US
test-install-sh:
if: ${{ needs.changes.outputs.sh == 'true' }}
strategy:
matrix:
os: [macos-11, ubuntu-20.04, windows-2022]
needs: changes
runs-on: ${{ matrix.os }}
env:
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: test-${{ matrix.os }}-local
shell: bash
run: |
rm -f ${{ env.BINARY }}
sh assets/scripts/install.sh -d
${{ env.BINARY }} --version
- name: test-${{ matrix.os }}-url
shell: bash
run: |
rm -f ${{ env.BINARY }}
sh -c "$(curl -fsLS https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.sh)" -- -d
${{ env.BINARY }} --version
test-install-ps1:
if: ${{ needs.changes.outputs.ps1 == 'true' }}
strategy:
matrix:
os: [macos-11, ubuntu-20.04, windows-2022]
needs: changes
runs-on: ${{ matrix.os }}
env:
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: test-${{ matrix.os }}-local
shell: pwsh
run: |
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
assets/scripts/install.ps1 -d
${{ env.BINARY }} --version
- name: test-${{ matrix.os }}-url
shell: pwsh
run: |
if (Test-Path -Path ${{ env.BINARY }}) { Remove-Item -Force ${{ env.BINARY }} }
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ env.SHA }}/assets/scripts/install.ps1')} -d"
${{ env.BINARY }} --version
59 changes: 6 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ jobs:
filters: |
code:
- '**/*.go'
- '**/*.ps1'
- '**/*.tmpl'
- '.github/workflows/**'
- '.github/workflows/main.yml'
- '.goreleaser.yaml'
- 'Makefile'
- 'assets/**/*.tmpl'
- 'assets/docker/**'
- 'assets/scripts/**'
- 'assets/scripts/*.py'
- 'assets/scripts/generate-commit.sh'
- 'assets/scripts/stow-to-chezmoi.sh'
- 'assets/vagrant/**'
- 'completions/**'
- 'go.*'
- 'internal/**'
codeql:
Expand Down Expand Up @@ -131,22 +133,6 @@ jobs:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
run: |
go test -race ./...
- name: test-install.sh
run: |
sh assets/scripts/install.sh
bin/chezmoi --version
- name: test-install.ps1
shell: pwsh
run: |
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
assets/scripts/install.ps1 -d
bin/chezmoi --version
- name: test-install.ps1-irm
shell: pwsh
run: |
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
bin/chezmoi --version
test-oldstable-go:
needs: changes
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
Expand Down Expand Up @@ -289,24 +275,6 @@ jobs:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
run: |
go test -ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o002" -race -timeout=1h ./...
- name: test-install.sh
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
run: |
rm -f bin/chezmoi
sh assets/scripts/install.sh
bin/chezmoi --version
- name: test-install.ps1
shell: pwsh
run: |
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
assets/scripts/install.ps1 -d
bin/chezmoi --version
- name: test-install.ps1-irm
shell: pwsh
run: |
if (Test-Path -Path bin/chezmoi) { Remove-Item -Force bin/chezmoi }
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
bin/chezmoi --version
test-website:
runs-on: ubuntu-22.04
permissions:
Expand Down Expand Up @@ -351,21 +319,6 @@ jobs:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
run: |
go test -race ./...
- name: test-install.ps1
run: |
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
assets/scripts/install.ps1 -d
bin/chezmoi.exe --version
- name: test-install.ps1-irm
run: |
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
iex "&{$(irm 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
bin/chezmoi.exe --version
- name: test-install.ps1-iwr
run: |
if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe }
iex "&{$(iwr 'https://raw.githubusercontent.com/twpayne/chezmoi/${{ github.event.pull_request.head.sha }}/assets/scripts/install.ps1')} -d"
bin/chezmoi.exe --version
check:
runs-on: ubuntu-22.04
permissions:
Expand Down

0 comments on commit 0d6c4c2

Please sign in to comment.