summaryrefslogtreecommitdiffstats
path: root/.github/workflows/docker-test.yml
blob: 42a871c4f9a5b2df8c8d5500df1314a72255b9a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Test

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  docker-run:
    if: ${{ !github.event.act }} # skip during local actions testing
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install requirements
        # make sure nvme-cli installed (we need it for /etc/nvme/hostnqn and /etc/nvme/hostid)
        run: |
          sudo apt update
          sudo apt-get install --yes --quiet nvme-cli

      - name: Load Kernel drivers
        run: sudo modprobe -v nvme-fabrics

      - name: Fix D-BUS
        run: |
          sed 's/@STAFD_DBUS_NAME@/org.nvmexpress.staf/g' etc/dbus-1/system.d/org.nvmexpress.staf.in.conf | sudo tee /usr/share/dbus-1/system.d/org.nvmexpress.staf.conf
          sed 's/@STACD_DBUS_NAME@/org.nvmexpress.stac/g' etc/dbus-1/system.d/org.nvmexpress.stac.in.conf | sudo tee /usr/share/dbus-1/system.d/org.nvmexpress.stac.conf
          sudo systemctl reload dbus.service

      - name: Build & Start containers
        run: docker-compose -f "docker-compose.yml" up --detach --build

      - name: Run tests
        run: |
          docker-compose ps
          docker-compose exec -T stafd stafctl ls
          docker-compose exec -T stafd stafctl status
          docker-compose exec -T stacd stacctl ls
          docker-compose exec -T stacd stacctl status
          docker-compose logs

      - name: Logs
        if: failure()
        run: |
          docker-compose ps || true
          docker-compose logs || true

      - name: Stop containers
        if: always()
        run: docker-compose -f "docker-compose.yml" down