aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/e2e.yml
blob: d2b77d60986e2263c28662056fc3716c864f7d57 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: "End to End"

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

concurrency:
  group: ${{ github.head_ref }}/e2e
  cancel-in-progress: true

permissions:
  contents: read

defaults:
  run:
    working-directory: docker

jobs:
  e2e:
    name: FUSE Mount
    runs-on: ubuntu-22.04
    timeout-minutes: 30
    steps:
    - name: Set up Go 1.x
      uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v2
      with:
        go-version: ^1.13
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v2

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
      
    - name: Cache Docker layers
      uses: actions/cache@v4
      with:
        path: /tmp/.buildx-cache
        key: ${{ runner.os }}-buildx-e2e-${{ github.sha }}
        restore-keys: |
          ${{ runner.os }}-buildx-e2e-

    - name: Install dependencies
      run: |
        # Use faster mirrors and install with timeout
        echo "deb http://azure.archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" | sudo tee /etc/apt/sources.list
        echo "deb http://azure.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
        
        sudo apt-get update --fix-missing
        sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends fuse
        
        # Verify FUSE installation
        echo "FUSE version: $(fusermount --version 2>&1 || echo 'fusermount not found')"
        echo "FUSE device: $(ls -la /dev/fuse 2>&1 || echo '/dev/fuse not found')"

    - name: Start SeaweedFS
      timeout-minutes: 10
      run: |
        # Enable Docker buildkit for better caching
        export DOCKER_BUILDKIT=1
        export COMPOSE_DOCKER_CLI_BUILD=1
        
        # Build with retry logic
        for i in {1..3}; do
          echo "Build attempt $i/3"
          if make build_e2e; then
            echo "Build successful on attempt $i"
            break
          elif [ $i -eq 3 ]; then
            echo "Build failed after 3 attempts"
            exit 1
          else
            echo "Build attempt $i failed, retrying in 30 seconds..."
            sleep 30
          fi
        done
        
        # Start services with wait
        docker compose -f ./compose/e2e-mount.yml up --wait

    - name: Run FIO 4k
      timeout-minutes: 15
      run: |
        echo "Starting FIO at: $(date)"
        # Concurrent r/w
        echo 'Run randrw with size=16M bs=4k'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randrw --bs=4k --direct=1 --numjobs=8 --ioengine=libaio --group_reporting --runtime=30 --time_based=1

        echo "Verify FIO at: $(date)"
        # Verified write
        echo 'Run randwrite with size=16M bs=4k'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randwrite --bs=4k --direct=1 --numjobs=8 --ioengine=libaio --iodepth=32 --group_reporting --runtime=30 --time_based=1 --do_verify=0 --verify=crc32c --verify_backlog=1

    - name: Run FIO 128k
      timeout-minutes: 15
      run: |
        echo "Starting FIO at: $(date)"
        # Concurrent r/w
        echo 'Run randrw with size=16M bs=128k'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randrw --bs=128k --direct=1 --numjobs=8 --ioengine=libaio --iodepth=32 --group_reporting --runtime=30 --time_based=1

        echo "Verify FIO at: $(date)"
        # Verified write
        echo 'Run randwrite with size=16M bs=128k'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randwrite --bs=128k --direct=1 --numjobs=8 --ioengine=libaio --iodepth=32 --group_reporting --runtime=30 --time_based=1 --do_verify=0 --verify=crc32c --verify_backlog=1

    - name: Run FIO 1MB
      timeout-minutes: 15
      run: |
        echo "Starting FIO at: $(date)"
        # Concurrent r/w
        echo 'Run randrw with size=16M bs=1m'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randrw --bs=1m --direct=1 --numjobs=8 --ioengine=libaio --iodepth=32 --group_reporting --runtime=30 --time_based=1
        
        echo "Verify FIO at: $(date)"
        # Verified write
        echo 'Run randwrite with size=16M bs=1m'
        docker compose -f ./compose/e2e-mount.yml exec mount timeout -k5 60 fio --name=fiotest --filename=/mnt/seaweedfs/fiotest --size=16M --rw=randwrite --bs=1m --direct=1 --numjobs=8 --ioengine=libaio --iodepth=32 --group_reporting --runtime=30 --time_based=1 --do_verify=0 --verify=crc32c --verify_backlog=1

    - name: Save logs
      if: always()
      run: |
        docker compose -f ./compose/e2e-mount.yml logs > output.log
        echo 'Showing last 500 log lines of mount service:'
        docker compose -f ./compose/e2e-mount.yml logs --tail 500 mount

    - name: Check for data races
      if: always()
      continue-on-error: true # TODO: remove this comment to enable build failure on data races (after all are fixed)
      run: grep -A50 'DATA RACE' output.log && exit 1 || exit 0

    - name: Archive logs
      if: always()
      uses: actions/upload-artifact@v5
      with:
        name: output-logs
        path: docker/output.log

    - name: Cleanup
      if: always()
      run: docker compose -f ./compose/e2e-mount.yml down --volumes --remove-orphans --rmi all