mirror of
https://github.com/tiennm99/serena.git
synced 2026-09-18 22:24:10 +00:00
109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
name: Tests on CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
cpu:
|
|
name: Tests on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
python-version: ["3.11"]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "${{ matrix.python-version }}"
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '>=1.17.0'
|
|
# Add Go bin directory to PATH for this workflow
|
|
# GITHUB_PATH is a special file that GitHub Actions uses to modify PATH
|
|
# Writing to this file adds the directory to the PATH for subsequent steps
|
|
- name: Install gopls
|
|
shell: bash
|
|
run: go install golang.org/x/tools/gopls@latest
|
|
- name: Set up Elixir
|
|
if: runner.os != 'Windows'
|
|
uses: erlef/setup-beam@v1
|
|
with:
|
|
elixir-version: '1.18.4'
|
|
otp-version: '26.1'
|
|
|
|
- name: Prepare java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: "17"
|
|
- name: Install clojure tools
|
|
uses: DeLaGuardo/setup-clojure@13.4
|
|
with:
|
|
cli: latest
|
|
- name: Install Terraform
|
|
uses: hashicorp/setup-terraform@v3
|
|
with:
|
|
terraform_version: "1.5.0"
|
|
terraform_wrapper: false
|
|
- name: Install terraform-ls (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host "Installing terraform-ls manually for Windows"
|
|
$ver = '0.32.7'
|
|
$zip = "terraform-ls_${ver}_windows_amd64.zip"
|
|
Invoke-WebRequest -Uri "https://releases.hashicorp.com/terraform-ls/$ver/$zip" -OutFile $zip
|
|
|
|
$dest = "$env:USERPROFILE\terraform-ls"
|
|
New-Item -ItemType Directory -Force -Path $dest | Out-Null
|
|
Expand-Archive $zip -DestinationPath $dest -Force
|
|
|
|
Write-Host "terraform-ls installed to: $dest"
|
|
echo "$dest" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
- name: Install terraform-ls (Linux/macOS)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
ver=0.32.7
|
|
os=$(uname | tr '[:upper:]' '[:lower:]')
|
|
echo "Installing terraform-ls ${ver} for ${os}"
|
|
curl -sSL -o tfls.zip \
|
|
"https://releases.hashicorp.com/terraform-ls/${ver}/terraform-ls_${ver}_${os}_amd64.zip"
|
|
mkdir -p "$HOME/bin"
|
|
unzip -q tfls.zip -d "$HOME/bin"
|
|
chmod +x "$HOME/bin/terraform-ls"
|
|
echo "$HOME/bin" >> "$GITHUB_PATH"
|
|
echo "terraform-ls installed to $HOME/bin"
|
|
- name: Install uv
|
|
shell: bash
|
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
- name: Cache uv virtualenv
|
|
id: cache-uv
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .venv
|
|
key: uv-venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
|
|
- name: Create virtual environment
|
|
shell: bash
|
|
run: |
|
|
if [ ! -d ".venv" ]; then
|
|
uv venv
|
|
fi
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: uv pip install -e ".[dev]"
|
|
- name: Test with pytest
|
|
shell: bash
|
|
run: uv run poe test
|