From 0152b3b5dac6b44fc3b92695d1e3d9501c0b1b84 Mon Sep 17 00:00:00 2001 From: GollyTicker Date: Mon, 16 Oct 2023 21:49:25 +0200 Subject: [PATCH] [dev] Automatically download protoc binaries. Cleanup. --- .github/workflows/release.yml | 4 ---- .github/workflows/test.yml | 1 - README.md | 3 ++- doc/template.README.md | 3 ++- release/.cache/.gitignore | 3 ++- release/.gitignore | 1 - release/10-ensure-protoc-binaries-exist.sh | 14 ++++++++++++++ ...toc-binaries.sh => 10.1-get-protoc-binaries.sh} | 2 -- release/source.sh | 2 +- test/results/.gitignore | 4 +++- test/suite/.gitignore | 1 - 11 files changed, 24 insertions(+), 14 deletions(-) create mode 100755 release/10-ensure-protoc-binaries-exist.sh rename release/{10-get-protoc-binaries.sh => 10.1-get-protoc-binaries.sh} (97%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0545efd5..23fd045d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,10 +35,6 @@ jobs: set +x source release/source.sh - - name: Protoc - run: | - ./release/10-get-protoc-binaries.sh - - name: Install Go and Goreleaser run: | sudo apt-get -q update diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 13ee1a3a..df78a0a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,6 @@ jobs: sudo apt-get -q update sudo apt-get -q install -y jq zip unzip curl git fetch --tags origin - ./release/10-get-protoc-binaries.sh - name: Tests run: | diff --git a/README.md b/README.md index c8750186..62cb3c27 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,8 @@ How to make a release: [RELEASE.md](RELEASE.md) #### Setup - As for script utilities, one needs `bash`, `jq`, `zip`, `unzip` and `curl`. -- One also needs to download the protoc binaries for the local development via `release/10-get-protoc-binaries.sh`. + +Running the tests will download the protoc binaries on the first invocation automatically. For development the `generated-local.Dockerfile` (via [generate-local.Dockerfile.sh](dev/generate-local.Dockerfile.sh)) is used. To build the image simply run `source test/suite/setup.sh` and then `buildProtocurl` diff --git a/doc/template.README.md b/doc/template.README.md index 10145c9d..423fc629 100644 --- a/doc/template.README.md +++ b/doc/template.README.md @@ -202,7 +202,8 @@ How to make a release: [RELEASE.md](RELEASE.md) #### Setup - As for script utilities, one needs `bash`, `jq`, `zip`, `unzip` and `curl`. -- One also needs to download the protoc binaries for the local development via `release/10-get-protoc-binaries.sh`. + +Running the tests will download the protoc binaries on the first invocation automatically. For development the `generated-local.Dockerfile` (via [generate-local.Dockerfile.sh](dev/generate-local.Dockerfile.sh)) is used. To build the image simply run `source test/suite/setup.sh` and then `buildProtocurl` diff --git a/release/.cache/.gitignore b/release/.cache/.gitignore index 7986d113..d6b7ef32 100644 --- a/release/.cache/.gitignore +++ b/release/.cache/.gitignore @@ -1 +1,2 @@ -#dummy +* +!.gitignore diff --git a/release/.gitignore b/release/.gitignore index 13540285..4adacd1a 100644 --- a/release/.gitignore +++ b/release/.gitignore @@ -1,4 +1,3 @@ tmp generated.Dockerfile -.cache new.versions.txt diff --git a/release/10-ensure-protoc-binaries-exist.sh b/release/10-ensure-protoc-binaries-exist.sh new file mode 100755 index 00000000..11400596 --- /dev/null +++ b/release/10-ensure-protoc-binaries-exist.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -euo pipefail + +source ./release/0-get-latest-dependencies-versions.sh + +FILES_EXIST="true" +ls release/tmp/protoc-$PROTO_VERSION-*.zip > /dev/null 2>&1 || FILES_EXIST="false" + +if [[ "$FILES_EXIST" == "true" ]]; then + echo "Found protoc binaries for $PROTO_VERSION." +else + echo "No protoc binaries for $PROTO_VERSION found. Downloading..." + ./release/10.1-get-protoc-binaries.sh +fi diff --git a/release/10-get-protoc-binaries.sh b/release/10.1-get-protoc-binaries.sh similarity index 97% rename from release/10-get-protoc-binaries.sh rename to release/10.1-get-protoc-binaries.sh index d0a0f073..84693b42 100755 --- a/release/10-get-protoc-binaries.sh +++ b/release/10.1-get-protoc-binaries.sh @@ -1,8 +1,6 @@ #!/bin/bash set -euo pipefail -source release/source.sh - # platforms and architectures for which Google released pre-built binaries VARIATIONS=( "linux-aarch_64" diff --git a/release/source.sh b/release/source.sh index 73a1ca30..73ad4d5d 100755 --- a/release/source.sh +++ b/release/source.sh @@ -3,7 +3,7 @@ set -euo pipefail # PRECONDITION: git fetch origin --tags -source ./release/0-get-latest-dependencies-versions.sh +source ./release/10-ensure-protoc-binaries-exist.sh # should be one of 386, amd64 and arm64 export BUILD_ARCH="$(uname -m | sed "s/x86_64/amd64/" | sed "s/x86_32/386/" | sed "s/aarch_64/arm64/")" diff --git a/test/results/.gitignore b/test/results/.gitignore index bee10d63..f4d523b7 100644 --- a/test/results/.gitignore +++ b/test/results/.gitignore @@ -1 +1,3 @@ -*-out.txt \ No newline at end of file +*-out.txt +*-tmp.txt + diff --git a/test/suite/.gitignore b/test/suite/.gitignore index ec881248..2f1900f0 100644 --- a/test/suite/.gitignore +++ b/test/suite/.gitignore @@ -1,3 +1,2 @@ run-testcases.sh tmp.Dockerfile -results/*-tmp.txt