mirror of
https://github.com/trailofbits/algo.git
synced 2026-08-17 21:25:50 +02:00
2d3e97cf88
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Commits](https://github.com/actions/checkout/compare/v6...v6.0.1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
169 lines
4.9 KiB
YAML
169 lines
4.9 KiB
YAML
---
|
|
name: Main
|
|
|
|
'on':
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
syntax-check:
|
|
name: Ansible syntax check
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup uv environment
|
|
uses: ./.github/actions/setup-uv
|
|
|
|
- name: Check Ansible playbook syntax
|
|
run: uv run ansible-playbook main.yml --syntax-check
|
|
|
|
basic-tests:
|
|
name: Basic sanity tests
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup uv environment
|
|
uses: ./.github/actions/setup-uv
|
|
|
|
- name: Install system dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y shellcheck
|
|
|
|
- name: Run basic sanity tests
|
|
run: uv run pytest tests/unit/ -v
|
|
|
|
docker-build:
|
|
name: Docker build test
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup uv environment
|
|
uses: ./.github/actions/setup-uv
|
|
|
|
- name: Build Docker image
|
|
run: docker build -t local/algo:test .
|
|
|
|
- name: Test Docker image starts
|
|
run: |
|
|
# Just verify the image can start and show help
|
|
docker run --rm local/algo:test /algo/algo --help
|
|
|
|
- name: Run Docker deployment tests
|
|
run: uv run pytest tests/unit/test_docker_localhost_deployment.py -v
|
|
|
|
config-generation:
|
|
name: Configuration generation test
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup uv environment
|
|
uses: ./.github/actions/setup-uv
|
|
|
|
- name: Test configuration generation (local mode)
|
|
run: |
|
|
# Run our simplified config test
|
|
chmod +x tests/test-local-config.sh
|
|
./tests/test-local-config.sh
|
|
|
|
ansible-dry-run:
|
|
name: Ansible dry-run validation
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
provider: [local, ec2, digitalocean, gce]
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup uv environment
|
|
uses: ./.github/actions/setup-uv
|
|
|
|
- name: Create test configuration for ${{ matrix.provider }}
|
|
run: |
|
|
# Create provider-specific test config
|
|
cat > test-${{ matrix.provider }}.cfg << 'EOF'
|
|
users:
|
|
- testuser
|
|
cloud_providers:
|
|
${{ matrix.provider }}:
|
|
server: test-server
|
|
size: t3.micro
|
|
image: ubuntu-22.04
|
|
region: us-east-1
|
|
wireguard_enabled: true
|
|
ipsec_enabled: false
|
|
dns_adblocking: false
|
|
ssh_tunneling: false
|
|
store_pki: true
|
|
algo_provider: ${{ matrix.provider }}
|
|
algo_server_name: test-algo-vpn
|
|
server: test-server
|
|
endpoint: 10.0.0.1
|
|
ansible_ssh_user: ubuntu
|
|
ansible_ssh_port: 22
|
|
algo_ssh_port: 4160
|
|
algo_ondemand_cellular: false
|
|
algo_ondemand_wifi: false
|
|
EOF
|
|
|
|
- name: Run Ansible check mode for ${{ matrix.provider }}
|
|
run: |
|
|
# Run ansible in check mode to validate playbooks work
|
|
uv run ansible-playbook main.yml \
|
|
-i "localhost," \
|
|
-c local \
|
|
-e @test-${{ matrix.provider }}.cfg \
|
|
-e "provider=${{ matrix.provider }}" \
|
|
--check \
|
|
--diff \
|
|
-vv \
|
|
--skip-tags "facts,tests,local,update-alternatives,cloud_api" || true
|
|
|
|
# The || true is because check mode will fail on some tasks
|
|
# but we're looking for syntax/undefined variable errors
|