Skip to content

Commit

Permalink
ci: add test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed Aug 28, 2024
1 parent ded6a21 commit f67ca49
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Unit & Acceptance Tests

on:
push:
branches:
- main
- test-ci
pull_request:

jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install podman
run: |
sudo apt-get -y update
sudo apt-get -y install podman
- name: Setup kernel unpriviledged port start
run: sudo sysctl net.ipv4.ip_unprivileged_port_start=80

- name: Configure hosts redirection
run: echo '127.0.0.1 ipa.example.test' | sudo tee -a /etc/hosts

- name: Start podman daemon
run: |
systemctl --user start podman.socket
ls $XDG_RUNTIME_DIR/podman/podman.sock
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
- name: Setup test environment
run: make prepare-dev-env

- name: Run unit tests
run: make test

- name: Run acceptance tests
run: make testacc

- name: Destroy test environment
run: make stop-dev-env
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ prepare-dev-env:
echo "Starting the freeipa container environment..."; \
if ! podman compose up -d; then \
echo >&2 "ERROR: Failed to start the freeipa container environment."; \
echo "Fetching last logs from the container..."; \
podman logs --tail 20 freeipa-server; \
exit 1; \
fi; \
echo "Waiting for the freeipa container environment to come up..."; \
until curl -s -k https://ipa.example.test/ipa/ui/ | grep -q "Identity Management"; do sleep 1; done; \
echo "Following the container logs until it's ready..."; \
(podman logs -f freeipa-server &) | grep -q "Identity Management" && kill $$!; \
echo "FreeIPA container environment started."; \
else \
echo "FreeIPA container environment already running."; \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.9"

services:
freeipa:
image: quay.io/freeipa/freeipa-server:rocky-9-4.11.0
image: quay.io/freeipa/freeipa-server:rocky-9
container_name: freeipa-server
hostname: ipa.example.test
tty: true
Expand Down

0 comments on commit f67ca49

Please sign in to comment.