71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: Teste Shell Runner
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
shell-test:
|
|
runs-on: deploy
|
|
|
|
steps:
|
|
- name: ✅ Verificar sistema
|
|
run: |
|
|
echo "=== Runner funcionando! ==="
|
|
echo "Data: $(date)"
|
|
echo "Hostname: $(hostname)"
|
|
uname -a
|
|
|
|
- name: 📦 Verificar ferramentas disponíveis
|
|
run: |
|
|
echo "=== Sistema base ==="
|
|
cat /etc/os-release
|
|
echo ""
|
|
echo "=== Ferramentas disponíveis ==="
|
|
which bash && bash --version | head -1
|
|
which curl && curl --version | head -1
|
|
which wget && wget --version 2>&1 | head -1 || echo "wget: não instalado"
|
|
which git && git --version
|
|
|
|
- name: 📦 Instalar python3 se necessário
|
|
run: |
|
|
# Alpine usa apk, Ubuntu/Debian usa apt
|
|
if command -v apk &>/dev/null; then
|
|
apk add --no-cache python3
|
|
elif command -v apt-get &>/dev/null; then
|
|
apt-get update -qq && apt-get install -y -qq python3 curl
|
|
fi
|
|
python3 --version
|
|
- name: 📦 Instalar python3 se necessário
|
|
run: |
|
|
# Alpine usa apk, Ubuntu/Debian usa apt
|
|
if command -v apk &>/dev/null; then
|
|
apk add --no-cache curl
|
|
elif command -v apt-get &>/dev/null; then
|
|
apt-get update -qq && apt-get install -y -qq curl
|
|
fi
|
|
- name: 🌐 Testar conectividade externa
|
|
run: |
|
|
echo "=== Ping externo ==="
|
|
curl -s https://ifconfig.me && echo ""
|
|
echo "Conectividade OK!"
|
|
|
|
- name: 📝 Criar e executar script shell inline
|
|
run: |
|
|
cat > /tmp/meu-script.sh << 'EOF'
|
|
#!/bin/bash
|
|
echo "=== Script a correr dentro do runner ==="
|
|
echo "Utilizador: $(whoami)"
|
|
echo "Directório: $(pwd)"
|
|
echo "Memória disponível:"
|
|
free -h
|
|
echo "Espaço em disco:"
|
|
df -h /
|
|
EOF
|
|
|
|
chmod +x /tmp/meu-script.sh
|
|
bash /tmp/meu-script.sh
|
|
|
|
- name: 🎉 Teste concluído
|
|
run: echo "Todos os steps passaram com sucesso!" |