Vaerh/issue605 #510
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: 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 "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" | |
docker inspect ${{ job.services.routeros.id }} | |
exit 5 | |
- 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 | |
options: >- | |
--cap-add=NET_ADMIN | |
--entrypoint /routeros/entrypoint_with_four_interfaces.sh | |
--device /dev/net/tun | |
--device /dev/kvm |