From 0d6c4c2b841ccfcb3207992c0869c6e1063e1412 Mon Sep 17 00:00:00 2001 From: Braden Hilton Date: Wed, 21 Feb 2024 00:16:45 +0000 Subject: [PATCH] chore: Separate installer CI tests --- .github/workflows/installer.yml | 88 +++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 59 +++------------------- 2 files changed, 94 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/installer.yml diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml new file mode 100644 index 00000000000..d8ccbae6c49 --- /dev/null +++ b/.github/workflows/installer.yml @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c1743f26ad..efc1b517c69 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -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' @@ -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: @@ -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: