diff --git a/.docker/Fedora.dockerfile b/.docker/Fedora.dockerfile deleted file mode 100644 index 1891af84..00000000 --- a/.docker/Fedora.dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM golang:1.23-bookworm as BUILDER - -WORKDIR /app - -ADD . . - -RUN CGO_ENABLED=0 go build -cover -o ./bin/algorun *.go - - -FROM fedora:39 as legacy - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun -RUN dnf install systemd ansible-core -y && \ - mkdir -p /app/coverage/int/fedora/39 && \ - echo GOCOVERDIR=/app/coverage/int/fedora/39 >> /etc/environment - -STOPSIGNAL SIGRTMIN+3 -CMD ["/usr/lib/systemd/systemd"] - -FROM fedora:40 as previous - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun - -RUN dnf install systemd ansible-core -y && \ - mkdir -p /app/coverage/int/fedora/40 && \ - echo GOCOVERDIR=/app/coverage/int/fedora/40 >> /etc/environment - -STOPSIGNAL SIGRTMIN+3 -CMD ["/usr/lib/systemd/systemd"] - -FROM fedora:41 as latest - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun - -RUN dnf install systemd ansible-core -y && \ - mkdir -p /app/coverage/int/fedora/41 && \ - echo GOCOVERDIR=/app/coverage/int/fedora/41 >> /etc/environment - -STOPSIGNAL SIGRTMIN+3 -CMD ["/usr/lib/systemd/systemd"] diff --git a/.docker/Ubuntu.dockerfile b/.docker/Ubuntu.dockerfile deleted file mode 100644 index f5cca2f7..00000000 --- a/.docker/Ubuntu.dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -FROM golang:1.23-bookworm as BUILDER - -WORKDIR /app - -ADD . . - -RUN CGO_ENABLED=0 go build -cover -o ./bin/algorun *.go - -FROM ubuntu:18.04 as bionic - -RUN apt-get update && apt-get install systemd software-properties-common -y && add-apt-repository --yes --update ppa:ansible/ansible - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun -RUN mkdir -p /app/coverage/int/ubuntu/18.04 && \ - echo GOCOVERDIR=/app/coverage/int/ubuntu/18.04 >> /etc/environment && \ - apt-get install ansible -y && \ - chmod 0 /usr/bin/apt # Liam Neeson - -STOPSIGNAL SIGRTMIN+3 -CMD ["/bin/systemd"] - -FROM ubuntu:22.04 as jammy - -RUN apt-get update && apt-get install systemd software-properties-common -y && add-apt-repository --yes --update ppa:ansible/ansible - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun -RUN mkdir -p /app/coverage/int/ubuntu/22.04 && \ - echo GOCOVERDIR=/app/coverage/int/ubuntu/22.04 >> /etc/environment && \ - apt-get install ansible -y - -STOPSIGNAL SIGRTMIN+3 -CMD ["/usr/lib/systemd/systemd"] - -FROM ubuntu:24.04 as noble - -RUN apt-get update && apt-get install systemd software-properties-common -y && add-apt-repository --yes --update ppa:ansible/ansible - -ADD playbook.yaml /root/playbook.yaml -COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun -RUN mkdir -p /app/coverage/int/ubuntu/24.04 && \ - echo GOCOVERDIR=/app/coverage/int/ubuntu/24.04 >> /etc/environment && \ - apt-get install ansible -y - -STOPSIGNAL SIGRTMIN+3 -CMD ["/usr/lib/systemd/systemd"] \ No newline at end of file diff --git a/.github/workflows/code_test.yaml b/.github/workflows/code_test.yaml index 4fd67ab7..9cd454f3 100644 --- a/.github/workflows/code_test.yaml +++ b/.github/workflows/code_test.yaml @@ -43,29 +43,8 @@ jobs: - name: Build run: go build -o bin/algorun *.go - - name: Install Algod - run: ./bin/algorun install - - - name: Wait for the server to start - run: npx wait-on tcp:8080 - - name: Unit Tests - run: make unit - - - name: Kill docker - run: docker compose down - - - name: Start Integration - run: docker compose -f docker-compose.integration.yaml up -d - - - name: Wait for mount - run: npx wait-on ./coverage/int/fedora/40 ./coverage/int/ubuntu/24.04/ - - - name: Integration tests - run: make integration - - - name: Combine coverage - run: make combine-coverage + run: make test - name: Upload results to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/node_test.yaml b/.github/workflows/node_test.yaml index 1a4d4be4..4f72ca43 100644 --- a/.github/workflows/node_test.yaml +++ b/.github/workflows/node_test.yaml @@ -23,7 +23,9 @@ jobs: go-version: 1.22 - name: Run Ubuntu commands run: | - go build . + export GOCOVERDIR=$(pwd)/coverage + mkdir -p $GOCOVERDIR + go build -cover . ./algorun-tui install systemctl status algorand.service export TOKEN=$(cat /var/lib/algorand/algod.admin.token) @@ -32,6 +34,12 @@ jobs: ./algorun-tui upgrade ./algorun-tui stop ./algorun-tui uninstall + go tool covdata textfmt -i=$GOCOVERDIR -o coverage.txt + + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} macos: runs-on: macos-latest @@ -44,7 +52,9 @@ jobs: - name: Run MacOs commands run: | - go build . + export GOCOVERDIR=$(pwd)/coverage + mkdir -p $GOCOVERDIR + go build -cover . ./algorun-tui install sudo launchctl print system/com.algorand.algod sleep 5 @@ -54,3 +64,9 @@ jobs: ./algorun-tui upgrade ./algorun-tui stop ./algorun-tui uninstall + go tool covdata textfmt -i=$GOCOVERDIR -o coverage.txt + + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 195d9e3a..a9c60543 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,6 @@ build: - CGO_ENABLED=0 go build -o bin/algorun *.go + CGO_ENABLED=0 go build -o bin/algorun . test: - go test -coverpkg=./... -covermode=atomic ./... + go test -coverprofile=coverage.out -coverpkg=./... -covermode=atomic ./... generate: - oapi-codegen -config generate.yaml https://raw.githubusercontent.com/algorand/go-algorand/v3.26.0-stable/daemon/algod/api/algod.oas3.yml -unit: - mkdir -p $(CURDIR)/coverage/unit && go test -cover ./... -args -test.gocoverdir=$(CURDIR)/coverage/unit -integration: - for service in $(shell docker compose -f docker-compose.integration.yaml ps --services) ; do \ - docker compose exec -it "$$service" ansible-playbook --connection=local /root/playbook.yaml ; \ - done -combine-coverage: - go tool covdata textfmt -i=./coverage/unit,./coverage/int/ubuntu/24.04,./coverage/int/fedora/40 -o coverage.txt && sed -i 2,3d coverage.txt \ No newline at end of file + oapi-codegen -config generate.yaml https://raw.githubusercontent.com/algorand/go-algorand/v3.26.0-stable/daemon/algod/api/algod.oas3.yml \ No newline at end of file diff --git a/docker-compose.integration.yaml b/docker-compose.integration.yaml deleted file mode 100644 index 9a89539d..00000000 --- a/docker-compose.integration.yaml +++ /dev/null @@ -1,58 +0,0 @@ -services: - # Legacy with apt disabled - ubuntu.18.04: - deploy: - replicas: 0 - privileged: true - environment: - - GOCOVERDIR=/app/coverage/int/ubuntu/18.04 - build: - context: . - target: bionic - dockerfile: .docker/Ubuntu.dockerfile - volumes: - - "./coverage/int/ubuntu/18.04:/app/coverage/int/ubuntu/18.04" - ubuntu.22.04: - deploy: - replicas: 0 - privileged: true - environment: - - GOCOVERDIR=/app/coverage/int/ubuntu/22.04 - build: - context: . - target: jammy - dockerfile: .docker/Ubuntu.dockerfile - volumes: - - "./coverage/int/ubuntu/22.04:/app/coverage/int/ubuntu/22.04" - ubuntu.24.04: - privileged: true - environment: - - GOCOVERDIR=/app/coverage/int/ubuntu/24.04 - build: - context: . - target: noble - dockerfile: .docker/Ubuntu.dockerfile - volumes: - - "./coverage/int/ubuntu/24.04:/app/coverage/int/ubuntu/24.04" - fedora.39: - deploy: - replicas: 0 - privileged: true - environment: - - GOCOVERDIR=/app/coverage/int/fedora/39 - build: - context: . - target: legacy - dockerfile: .docker/Fedora.dockerfile - volumes: - - "./coverage/int/fedora/39:/app/coverage/int/fedora/39" - fedora.40: - privileged: true - environment: - - GOCOVERDIR=/app/coverage/int/fedora/40 - build: - context: . - target: previous - dockerfile: .docker/Fedora.dockerfile - volumes: - - "./coverage/int/fedora/40:/app/coverage/int/fedora/40" \ No newline at end of file