Skip to content

Vaerh/issue605

Vaerh/issue605 #508

name: Go Client Tests
on:
pull_request:
branches:
- 'main'
- 'devel'
paths:
- 'main.go'
- 'routeros/*.go'
- '.github/workflows/*.yml'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
experimental: [false]
go:
- 1.21
os: [ubuntu-latest]
routeros_version:
- "7.12"
- "7.15"
- "7.16"
steps:
- name: Container check
run: |
echo "The container ID: ${{ job.services.routeros.id }}"
echo "Wait for the container to finish launching..."
while true; do
docker logs ${{ job.services.routeros.id }} 2>&1 | grep MikroTik && break
docker logs ${{ job.services.routeros.id }} 2>&1
echo "waiting..."
sleep 10
done
IP=$(docker inspect ${{ job.services.routeros.id }} --format '{{.NetworkSettings.IPAddress}}')
echo "IP address: ${IP}"
echo "ROS_IP_ADDRESS=${IP}" >> "$GITHUB_ENV"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go
- name: Get dependencies
run: |
go mod download
- name: Build
run: go build -v .
- name: Preparing RouterOS for testing
run: |
go run .github/scripts/setup_routeros.go
env:
ROS_USERNAME: admin
ROS_PASSWORD: ''
- name: Run client tests
run: go test -timeout 30m -v ./routeros
env:
ROS_HOSTURL: https://${ROS_IP_ADDRESS}
ROS_USERNAME: admin
ROS_PASSWORD: ''
ROS_INSECURE: true
TF_ACC: 1
ROS_VERSION: ${{ matrix.routeros_version }}
services:
routeros:
image: vaerhme/routeros:v${{ matrix.routeros_version }}
ports:
- 443:443
- 8728:8728
- 8729:8729
volumes:
- /dev/net/tun:/dev/net/tun
options: >-
--cap-add=NET_ADMIN
--entrypoint /routeros/entrypoint_with_four_interfaces.sh