pkg/cli/term: Fix Windows "Quick Edit Mode" being disabled #1776
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
defaults: | |
run: | |
# PowerShell's behavior for -flag=value is undesirable, so run all commands with bash. | |
shell: bash | |
jobs: | |
test: | |
# The default name will include the "go-version-is" parameter below, which | |
# is derived from go-version and redundant, so we supply an explicit | |
# templated name. | |
name: Run tests (${{ matrix.os }}, ${{ matrix.go-version }}) | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
go-version: [1.23.x] | |
go-version-is: [new] | |
include: | |
# Test old supported Go version | |
- os: ubuntu | |
go-version: 1.22.x | |
go-version-is: [old] | |
env: | |
ELVISH_TEST_TIME_SCALE: 20 | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
# autocrlf is problematic for fuzz testdata. | |
- name: Turn off autocrlf | |
if: matrix.os == 'windows' | |
run: git config --global core.autocrlf false | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Test with race detection | |
run: | | |
go test -race ./... | |
cd website; go test -race ./... | |
- name: Generate unit test coverage | |
if: matrix.go-version-is == 'new' | |
run: go test -coverprofile=cover-unit.txt -coverpkg=./pkg/... ./pkg/... | |
- name: Generate E2E test coverage | |
if: matrix.go-version-is == 'new' | |
run: | | |
mkdir cover-e2e | |
GOCOVERDIR=$PWD/cover-e2e go test -count 1 ./e2e | |
go tool covdata textfmt -i cover-e2e -o cover-e2e.txt | |
- name: Save test coverage | |
if: matrix.go-version-is == 'new' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cover-${{ matrix.os == 'ubuntu' && 'linux' || matrix.os }} | |
path: cover-*.txt | |
emulated_tests: | |
name: Run tests (emulated ${{ matrix.go-arch }}) | |
strategy: | |
matrix: | |
go-arch: [riscv64, s390x] | |
env: | |
ELVISH_TEST_TIME_SCALE: 20 | |
GOARCH: ${{ matrix.go-arch }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up emulator | |
run: | | |
sudo apt update | |
sudo apt install binfmt-support qemu-user-static | |
update-binfmts --display | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
- name: Test with emulator | |
run: | | |
go test ./... | |
cd website; go test ./... | |
# The purpose of running benchmarks in GitHub Actions is primarily to ensure | |
# that the benchmark code runs and doesn't crash. GitHub Action runners don't | |
# have a stable enough environment to produce reliable benchmark numbers. | |
benchmark: | |
name: Run benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
- name: Run benchmarks | |
run: go test -bench=. -run='^$' ./... | |
upload-coverage: | |
name: Upload test coverage | |
strategy: | |
matrix: | |
ostype: [linux, macos, windows] | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download test coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: cover-${{ matrix.ostype }} | |
- name: Upload unit test coverage to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./cover-unit.txt | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ${{ matrix.ostype }},unit | |
- name: Upload E2E test coverage to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./cover-e2e.txt | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ${{ matrix.ostype }},e2e | |
checks: | |
name: Run checks | |
# Most checks do not rely on the OS, but some (like check-gen) do. To ensure | |
# maximal coverage, we run all of the checks on the three main OSes. | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
# autocrlf is problematic for check-fmt-go. | |
- name: Turn off autocrlf | |
if: matrix.os == 'windows' | |
run: git config --global core.autocrlf false | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install tools | |
run: | | |
go install golang.org/x/tools/cmd/stringer@latest | |
go install golang.org/x/tools/cmd/goimports@latest | |
# Keep the versions of staticcheck and codespell in sync with docs/workflows.md | |
go install honnef.co/go/tools/cmd/[email protected] | |
pip install codespell==2.3.0 | |
- name: Run checks | |
run: make all-checks | |
check-rellinks: | |
name: Check relative links in website | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependency | |
run: pip3 install beautifulsoup4 | |
- name: Check relative links | |
run: make -C website check-rellinks |