test: add tests for tcs cluster publish/show #465
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
push: | |
branches: [master] | |
tags: ['*'] | |
workflow_dispatch: | |
env: | |
GO_VERSION: '>=1.21.5' | |
jobs: | |
create-packages-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Build OpenSSL 3.0 | |
run: | | |
wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz | |
tar -xvf openssl-3.0.8.tar.gz | |
cd openssl-3.0.8/ | |
./Configure --prefix=${GITHUB_WORKSPACE}/openssl no-shared | |
make && make install | |
- name: Setup GoReleaser | |
run: | | |
curl -O -L https://github.com/goreleaser/goreleaser/releases/download/v1.12.3/goreleaser_1.12.3_amd64.deb | |
sudo dpkg -i goreleaser_1.12.3_amd64.deb | |
rm goreleaser_1.12.3_amd64.deb | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --skip-validate" | |
else | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --snapshot" | |
fi | |
# These scripts will be picked up while building packages with goreleaser. | |
- name: Generate ZSH and Bash completion scripts | |
run: | | |
mage build | |
./tt completion bash > tt-completion.bash | |
./tt completion zsh > tt-completion.zsh | |
- name: Build packages | |
env: | |
CGO_LDFLAGS: "-L${{ env.GITHUB_WORKSPACE }}/openssl/lib64" | |
CGO_CFLAGS: "-I${{ env.GITHUB_WORKSPACE }}/openssl/include" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
goreleaser release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --skip-publish --config ./goreleaser/.goreleaser_linux.yml | |
- name: Upload packages artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-linux | |
path: dist | |
create-packages-linux-arm64: | |
runs-on: graviton | |
strategy: | |
fail-fast: false | |
container: | |
image: tarantool/testing:tt-build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install etcd | |
uses: ./.github/actions/setup-etcd | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --skip-validate" | |
else | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --snapshot" | |
fi | |
# These scripts will be picked up while building packages with goreleaser. | |
- name: Generate ZSH and Bash completion scripts | |
run: | | |
mage build | |
./tt completion bash > tt-completion.bash | |
./tt completion zsh > tt-completion.zsh | |
- name: Build packages | |
env: | |
CGO_LDFLAGS: "-L/opt/openssl/lib" | |
CGO_CFLAGS: "-I/opt/openssl/include" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
goreleaser release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} \ | |
--skip-publish --config ./goreleaser/.goreleaser_linux_arm64.yml | |
- name: Upload packages artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-linux-arm64 | |
path: dist | |
create-packages-macos: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Build OpenSSL 3.0 | |
run: | | |
wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz | |
tar -xvf openssl-3.0.8.tar.gz | |
cd openssl-3.0.8/ | |
./Configure --prefix=${GITHUB_WORKSPACE}/openssl no-shared | |
make && make install | |
echo "CGO_LDFLAGS=-L${GITHUB_WORKSPACE}/openssl/lib" >> $GITHUB_ENV | |
echo "CGO_CFLAGS=-I${GITHUB_WORKSPACE}/openssl/include" >> $GITHUB_ENV | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --skip-validate" | |
else | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --snapshot" | |
fi | |
- name: Build packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: v1.26.2 | |
args: release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --skip-publish --config ./goreleaser/.goreleaser_macOS.yml | |
- name: Upload packages artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-macos | |
path: dist | |
draft-release: | |
needs: [create-packages-linux, create-packages-linux-arm64, create-packages-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Make directories | |
run: | | |
mkdir -p ./dist-prebuilt/packages-linux | |
mkdir -p ./dist-prebuilt/packages-macos | |
mkdir -p ./dist-prebuilt/packages-linux-arm64 | |
- name: Download linux binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-linux | |
path: ./dist-prebuilt/packages-linux | |
- name: Download linux arm64 binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-linux-arm64 | |
path: ./dist-prebuilt/packages-linux-arm64 | |
- name: Download macos binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-macos | |
path: ./dist-prebuilt/packages-macos | |
- name: Remove not-needed files | |
run: | | |
rm ./dist-prebuilt/packages-linux/artifacts.json | |
rm ./dist-prebuilt/packages-linux/config.yaml | |
rm ./dist-prebuilt/packages-linux/metadata.json | |
rm ./dist-prebuilt/packages-linux-arm64/artifacts.json | |
rm ./dist-prebuilt/packages-linux-arm64/config.yaml | |
rm ./dist-prebuilt/packages-linux-arm64/metadata.json | |
rm ./dist-prebuilt/packages-macos/artifacts.json | |
rm ./dist-prebuilt/packages-macos/config.yaml | |
rm ./dist-prebuilt/packages-macos/metadata.json | |
rm ./dist-prebuilt/packages-macos/tt_darwin_amd64_v1/tt | |
rm ./dist-prebuilt/packages-linux/tt_linux_amd64_v1/tt | |
rm ./dist-prebuilt/packages-linux-arm64/tt_linux_arm64/tt | |
- name: Pack additional archives | |
run: | | |
./.gen_tarballs.sh -t ${{ github.ref_name }} | |
mv /tmp/gentoo_tarballs/tt*.tar.* ./dist-prebuilt/packages-linux/ | |
- name: merge checksum file | |
run: | | |
cd ./dist-prebuilt | |
cat ./packages-linux/tt*checksums.txt >> checksums.txt | |
cat ./packages-linux-arm64/tt*checksums.txt >> checksums.txt | |
cat ./packages-macos/tt*checksums.txt >> checksums.txt | |
rm ./packages-linux/tt*checksums.txt | |
rm ./packages-linux-arm64/tt*checksums.txt | |
rm ./packages-macos/tt*checksums.txt | |
mv checksums.txt ./packages-macos/ | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "GORELEASER_FLAGS=--skip-validate" >> $GITHUB_OUTPUT | |
else | |
echo "GORELEASER_FLAGS=--snapshot" >> $GITHUB_OUTPUT | |
fi | |
- name: Release | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: v1.26.2 | |
args: release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --config ./goreleaser/.goreleaser_publish.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-s3: | |
needs: [create-packages-linux, create-packages-linux-arm64] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Download x86_64 packages artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: packages-linux | |
path: dist | |
- name: Publish x86_64 packages to RWS | |
env: | |
RWS_URL_PART: https://rws.tarantool.org/release/modules | |
RWS_AUTH: ${{ secrets.RWS_AUTH }} | |
run: mage publishRWS && rm -rf dist | |
- name: Download arm64 packages artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: packages-linux-arm64 | |
path: dist | |
- name: Publish arm64 packages to RWS | |
env: | |
RWS_URL_PART: https://rws.tarantool.org/release/modules | |
RWS_AUTH: ${{ secrets.RWS_AUTH }} | |
run: mage publishRWS |