From 90d15c1c096e7d27c51e335e26f1cc72a65c2fac Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Tue, 2 Feb 2021 15:34:03 +0100 Subject: [PATCH] refactor: build miniooni from toplevel (#203) * refactor: build miniooni from toplevel Of course, also move the specific test checking whether we are still able of building miniooni. Part of https://github.com/ooni/probe/issues/1335 * build for current branch just to confirm * fix: correct the path where linux/arm binary is * okay, it works, we can remove the special rule --- .../.github => .github}/workflows/miniooni.yml | 10 +++++----- CLI/README.md | 3 +++ CLI/darwin/amd64/.gitignore | 1 + CLI/linux/386/.gitignore | 1 + CLI/linux/amd64/.gitignore | 1 + .../darwin/amd64 => CLI/linux/arm}/.gitignore | 0 .../CLI/linux/386 => CLI/linux/arm64}/.gitignore | 0 CLI/windows/386/.gitignore | 1 + CLI/windows/amd64/.gitignore | 1 + .../engine/build-cli.sh => build-miniooni.sh | 16 ++++++++-------- internal/engine/CLI/README.md | 3 --- internal/engine/CLI/linux/amd64/.gitignore | 1 - internal/engine/CLI/linux/arm64/.gitignore | 1 - internal/engine/CLI/linux/armv7/.gitignore | 1 - internal/engine/CLI/windows/386/.gitignore | 1 - internal/engine/CLI/windows/amd64/.gitignore | 1 - 16 files changed, 21 insertions(+), 21 deletions(-) rename {internal/engine/.github => .github}/workflows/miniooni.yml (85%) create mode 100644 CLI/README.md rename {internal/engine/CLI/darwin/amd64 => CLI/linux/arm}/.gitignore (100%) rename {internal/engine/CLI/linux/386 => CLI/linux/arm64}/.gitignore (100%) rename internal/engine/build-cli.sh => build-miniooni.sh (61%) delete mode 100644 internal/engine/CLI/README.md delete mode 100644 internal/engine/CLI/linux/amd64/.gitignore delete mode 100644 internal/engine/CLI/linux/arm64/.gitignore delete mode 100644 internal/engine/CLI/linux/armv7/.gitignore delete mode 100644 internal/engine/CLI/windows/386/.gitignore delete mode 100644 internal/engine/CLI/windows/amd64/.gitignore diff --git a/internal/engine/.github/workflows/miniooni.yml b/.github/workflows/miniooni.yml similarity index 85% rename from internal/engine/.github/workflows/miniooni.yml rename to .github/workflows/miniooni.yml index dd3d702..81da688 100644 --- a/internal/engine/.github/workflows/miniooni.yml +++ b/.github/workflows/miniooni.yml @@ -14,7 +14,7 @@ jobs: go-version: "1.14" - uses: actions/checkout@v2 - - run: ./build-cli.sh linux + - run: ./build-miniooni.sh linux - run: ./CLI/linux/amd64/miniooni --yes -nNi https://example.com web_connectivity - uses: actions/upload-artifact@v1 with: @@ -26,21 +26,21 @@ jobs: path: ./CLI/linux/amd64/miniooni - uses: actions/upload-artifact@v1 with: - name: miniooni-linux-armv7 - path: ./CLI/linux/armv7/miniooni + name: miniooni-linux-arm + path: ./CLI/linux/arm/miniooni - uses: actions/upload-artifact@v1 with: name: miniooni-linux-arm64 path: ./CLI/linux/arm64/miniooni - - run: ./build-cli.sh darwin + - run: ./build-miniooni.sh darwin - uses: actions/upload-artifact@v1 with: name: miniooni-darwin-amd64 path: ./CLI/darwin/amd64/miniooni - run: sudo apt install --yes mingw-w64 - - run: ./build-cli.sh windows + - run: ./build-miniooni.sh windows - uses: actions/upload-artifact@v1 with: name: miniooni-windows-amd64.exe diff --git a/CLI/README.md b/CLI/README.md new file mode 100644 index 0000000..e244205 --- /dev/null +++ b/CLI/README.md @@ -0,0 +1,3 @@ +# Directory github.com/ooni/probe-cli/CLI + +We use this directory for building CLI binaries (e.g. ooniprobe). diff --git a/CLI/darwin/amd64/.gitignore b/CLI/darwin/amd64/.gitignore index e6ab6e0..ab810d8 100644 --- a/CLI/darwin/amd64/.gitignore +++ b/CLI/darwin/amd64/.gitignore @@ -1 +1,2 @@ /ooniprobe +/miniooni diff --git a/CLI/linux/386/.gitignore b/CLI/linux/386/.gitignore index e6ab6e0..ab810d8 100644 --- a/CLI/linux/386/.gitignore +++ b/CLI/linux/386/.gitignore @@ -1 +1,2 @@ /ooniprobe +/miniooni diff --git a/CLI/linux/amd64/.gitignore b/CLI/linux/amd64/.gitignore index e6ab6e0..ab810d8 100644 --- a/CLI/linux/amd64/.gitignore +++ b/CLI/linux/amd64/.gitignore @@ -1 +1,2 @@ /ooniprobe +/miniooni diff --git a/internal/engine/CLI/darwin/amd64/.gitignore b/CLI/linux/arm/.gitignore similarity index 100% rename from internal/engine/CLI/darwin/amd64/.gitignore rename to CLI/linux/arm/.gitignore diff --git a/internal/engine/CLI/linux/386/.gitignore b/CLI/linux/arm64/.gitignore similarity index 100% rename from internal/engine/CLI/linux/386/.gitignore rename to CLI/linux/arm64/.gitignore diff --git a/CLI/windows/386/.gitignore b/CLI/windows/386/.gitignore index cdc66d9..8766a39 100644 --- a/CLI/windows/386/.gitignore +++ b/CLI/windows/386/.gitignore @@ -1 +1,2 @@ /ooniprobe.exe +/miniooni.exe diff --git a/CLI/windows/amd64/.gitignore b/CLI/windows/amd64/.gitignore index cdc66d9..8766a39 100644 --- a/CLI/windows/amd64/.gitignore +++ b/CLI/windows/amd64/.gitignore @@ -1 +1,2 @@ /ooniprobe.exe +/miniooni.exe diff --git a/internal/engine/build-cli.sh b/build-miniooni.sh similarity index 61% rename from internal/engine/build-cli.sh rename to build-miniooni.sh index 4eb9703..7ba4273 100755 --- a/internal/engine/build-cli.sh +++ b/build-miniooni.sh @@ -3,27 +3,27 @@ set -e case $1 in macos|darwin) export GOOS=darwin GOARCH=amd64 - go build -o ./CLI/darwin/amd64 -ldflags="-s -w" ./cmd/miniooni + go build -o ./CLI/darwin/amd64 -ldflags="-s -w" ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/darwin/amd64/miniooni";; linux) export GOOS=linux GOARCH=386 - go build -o ./CLI/linux/386 -tags netgo -ldflags='-s -w -extldflags "-static"' ./cmd/miniooni + go build -o ./CLI/linux/386 -tags netgo -ldflags='-s -w -extldflags "-static"' ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/linux/386/miniooni" export GOOS=linux GOARCH=amd64 - go build -o ./CLI/linux/amd64 -tags netgo -ldflags='-s -w -extldflags "-static"' ./cmd/miniooni + go build -o ./CLI/linux/amd64 -tags netgo -ldflags='-s -w -extldflags "-static"' ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/linux/amd64/miniooni" export GOOS=linux GOARCH=arm GOARM=7 - go build -o ./CLI/linux/armv7 -tags netgo -ldflags='-s -w -extldflags "-static"' ./cmd/miniooni - echo "Binary ready at ./CLI/linux/armv7/miniooni" + go build -o ./CLI/linux/arm -tags netgo -ldflags='-s -w -extldflags "-static"' ./internal/engine/cmd/miniooni + echo "Binary ready at ./CLI/linux/arm/miniooni" export GOOS=linux GOARCH=arm64 - go build -o ./CLI/linux/arm64 -tags netgo -ldflags='-s -w -extldflags "-static"' ./cmd/miniooni + go build -o ./CLI/linux/arm64 -tags netgo -ldflags='-s -w -extldflags "-static"' ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/linux/arm64/miniooni";; windows) export GOOS=windows GOARCH=386 - go build -o ./CLI/windows/386 -ldflags="-s -w" ./cmd/miniooni + go build -o ./CLI/windows/386 -ldflags="-s -w" ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/windows/386/miniooni.exe" export GOOS=windows GOARCH=amd64 - go build -o ./CLI/windows/amd64 -ldflags="-s -w" ./cmd/miniooni + go build -o ./CLI/windows/amd64 -ldflags="-s -w" ./internal/engine/cmd/miniooni echo "Binary ready at ./CLI/windows/amd64/miniooni.exe";; *) echo "usage: $0 darwin|linux|windows" 1>&2 diff --git a/internal/engine/CLI/README.md b/internal/engine/CLI/README.md deleted file mode 100644 index e3c4ef1..0000000 --- a/internal/engine/CLI/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Directory github.com/ooni/probe-engine/CLI - -We use this directory for building CLI binaries (e.g. miniooni). diff --git a/internal/engine/CLI/linux/amd64/.gitignore b/internal/engine/CLI/linux/amd64/.gitignore deleted file mode 100644 index a47ad4c..0000000 --- a/internal/engine/CLI/linux/amd64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/miniooni diff --git a/internal/engine/CLI/linux/arm64/.gitignore b/internal/engine/CLI/linux/arm64/.gitignore deleted file mode 100644 index a47ad4c..0000000 --- a/internal/engine/CLI/linux/arm64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/miniooni diff --git a/internal/engine/CLI/linux/armv7/.gitignore b/internal/engine/CLI/linux/armv7/.gitignore deleted file mode 100644 index a47ad4c..0000000 --- a/internal/engine/CLI/linux/armv7/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/miniooni diff --git a/internal/engine/CLI/windows/386/.gitignore b/internal/engine/CLI/windows/386/.gitignore deleted file mode 100644 index 2953a7a..0000000 --- a/internal/engine/CLI/windows/386/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/miniooni.exe diff --git a/internal/engine/CLI/windows/amd64/.gitignore b/internal/engine/CLI/windows/amd64/.gitignore deleted file mode 100644 index 2953a7a..0000000 --- a/internal/engine/CLI/windows/amd64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/miniooni.exe