diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000000..e9fda6ad0dd --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,45 @@ +name: "go: build binary" + +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: End to End + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 + + - name: Build SeaweedFS + docker image + run: make build + + - name: Install mount binary + run: cp ./weed /usr/local/sbin/mount.weed + + - name: Start containers + run: docker-compose -f ./compose/e2e.yml up --wait + + - name: Mount + run: mount -t weed fuse /mnt -o 'filer=localhost:8888,filer.path=/' + + - name: TEST + run: ls -las --color /mnt; echo 'fregregerger' > /mnt/test; ls -las --color /mnt; cat /mnt/test + + - name: Stop containers + if: always() + run: docker-compose -f ./compose/e2e.yml down --volumes --remove-orphans --rmi all diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index efe15d4af2c..bf19d185d5d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,11 +30,19 @@ jobs: uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 - name: Get dependencies - run: | - cd weed; go get -v -t -d ./... + run: cd weed; go get -v -t -d ./... - name: Build run: cd weed; go build -tags "elastic gocdk sqlite ydb tikv" -v . - name: Test run: cd weed; go test -tags "elastic gocdk sqlite ydb tikv" -v ./... + + - name: Start e2e containers + run: | + docker-compose -f "docker-compose.yml" up -d --build + cd weed; go get -v -t -d ./... + + - name: Stop containers + if: always() + run: docker-compose -f "docker-compose.yml" down diff --git a/docker/Dockerfile.local b/docker/Dockerfile.local index 947edffda3d..53cfd957151 100644 --- a/docker/Dockerfile.local +++ b/docker/Dockerfile.local @@ -5,6 +5,7 @@ RUN mkdir -p /etc/seaweedfs COPY ./filer.toml /etc/seaweedfs/filer.toml COPY ./entrypoint.sh /entrypoint.sh RUN apk add fuse # for weed mount +RUN apk add curl # for health checks # volume server grpc port EXPOSE 18080 diff --git a/docker/Makefile b/docker/Makefile index 793ef17de2b..3b80ba3f88e 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -12,7 +12,6 @@ binary: build: binary docker build --no-cache -t chrislusf/seaweedfs:local -f Dockerfile.local . - rm ./weed go_build: # make go_build tags=elastic,ydb,gocdk,hdfs,5BytesOffset docker build --build-arg TAGS=$(tags) --no-cache -t chrislusf/seaweedfs:go_build -f Dockerfile.go_build . diff --git a/docker/compose/e2e.yml b/docker/compose/e2e.yml new file mode 100644 index 00000000000..9f0a050a5e1 --- /dev/null +++ b/docker/compose/e2e.yml @@ -0,0 +1,65 @@ +version: '3.9' + +services: + master: + image: chrislusf/seaweedfs:local + ports: + - "9333:9333" + - "19333:19333" + command: "-v=1 master -ip=master" + healthcheck: + test: [ "CMD", "curl", "--fail", "-I", "http://localhost:9333/cluster/healthz" ] + interval: 3s + timeout: 30s + + volume: + image: chrislusf/seaweedfs:local + ports: + - "8080:8080" + - "18080:18080" + command: "-v=1 volume -mserver=master:9333 -port=8080 -ip=volume -preStopSeconds=1" + healthcheck: + test: [ "CMD", "curl", "--fail", "-I", "http://localhost:8080/healthz" ] + interval: 3s + timeout: 30s + depends_on: + master: + condition: service_healthy + + filer: + image: chrislusf/seaweedfs:local + ports: + - "8111:8111" + - "8888:8888" + - "18888:18888" + command: "-v=1 filer -ip.bind=0.0.0.0 -master='master:9333'" + healthcheck: + test: [ "CMD", "curl", "--fail", "-I", "http://localhost:8888" ] + interval: 3s + timeout: 30s + depends_on: + master: + condition: service_healthy + volume: + condition: service_healthy + + mount: + image: chrislusf/seaweedfs:local + cap_add: + - SYS_ADMIN + deploy: + resources: + limits: + memory: 4096m + command: "-v=4 mount -filer='filer:8888' -dirAutoCreate -dir=/mnt/seaweedfs -cacheCapacityMB=100 -concurrentWriters=128" + healthcheck: + test: [ "CMD", "mountpoint", "-q", "--", "/mnt/seaweedfs" ] + interval: 3s + timeout: 30s + depends_on: + master: + condition: service_healthy + volume: + condition: service_healthy + filer: + condition: service_healthy