Skip to content

Commit

Permalink
CI nats-server latest (nats-io#408)
Browse files Browse the repository at this point in the history
* CI nats-server latest

* Script fix

* Script fix
  • Loading branch information
mtmk authored Feb 26, 2024
1 parent 273a009 commit c56cbdd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
config:
- branch: 'v2.9.22'
- branch: 'v2.10.9'
- branch: 'v2.9'
- branch: 'latest'
- branch: 'main'
runs-on: ubuntu-latest
env:
Expand All @@ -24,15 +24,20 @@ jobs:
steps:
- name: Install nats
run: |
# latest 0.1.1 doesn't have binaries
# rel=$(curl -s https://api.github.com/repos/nats-io/natscli/releases/latest | jq -r .tag_name | sed s/v//)
rel=0.1.0
rel=$(curl -s https://api.github.com/repos/nats-io/natscli/releases/latest | jq -r .tag_name | sed s/v//)
wget https://github.com/nats-io/natscli/releases/download/v$rel/nats-$rel-linux-amd64.zip
unzip nats-$rel-linux-amd64.zip
sudo mv nats-$rel-linux-amd64/nats /usr/local/bin
gh_api_url="https://api.github.com/repos/nats-io/nats-server/releases"
branch="${{ matrix.config.branch }}"
if [[ $branch == "v"* ]]; then
branch=$(curl -s $gh_api_url | jq -r '.[].tag_name' | grep $branch | sort -V | tail -1)
elif [[ $branch == "latest" ]]; then
branch=$(curl -s $gh_api_url/latest | jq -r .tag_name)
fi
for i in 1 2 3
do
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@${{ matrix.config.branch }} | PREFIX=. sh && break || sleep 30
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@$branch | PREFIX=. sh && break || sleep 30
done
sudo mv nats-server /usr/local/bin
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
config:
- branch: 'v2.9.22'
- branch: 'v2.10.9'
- branch: 'v2.9'
- branch: 'latest'
- branch: 'main'
runs-on: ubuntu-latest
env:
Expand All @@ -24,9 +24,16 @@ jobs:
steps:
- name: Install nats-server
run: |
gh_api_url="https://api.github.com/repos/nats-io/nats-server/releases"
branch="${{ matrix.config.branch }}"
if [[ $branch == "v"* ]]; then
branch=$(curl -s $gh_api_url | jq -r '.[].tag_name' | grep $branch | sort -V | tail -1)
elif [[ $branch == "latest" ]]; then
branch=$(curl -s $gh_api_url/latest | jq -r .tag_name)
fi
for i in 1 2 3
do
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@${{ matrix.config.branch }} | PREFIX=. sh && break || sleep 30
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@$branch | PREFIX=. sh && break || sleep 30
done
sudo mv nats-server /usr/local/bin
Expand Down Expand Up @@ -86,8 +93,8 @@ jobs:
fail-fast: false
matrix:
config:
- branch: 'v2.9.22'
- branch: 'v2.10.9'
- branch: 'v2.9'
- branch: 'latest'
- branch: 'main'
runs-on: windows-latest
env:
Expand All @@ -109,9 +116,16 @@ jobs:
shell: bash
run: |
mkdir tools-nats-server && cd tools-nats-server
gh_api_url="https://api.github.com/repos/nats-io/nats-server/releases"
branch="${{ matrix.config.branch }}"
if [[ $branch == "v"* ]]; then
branch=$(curl -s $gh_api_url | jq -r '.[].tag_name' | grep $branch | sort -V | tail -1)
elif [[ $branch == "latest" ]]; then
branch=$(curl -s $gh_api_url/latest | jq -r .tag_name)
fi
for i in 1 2 3
do
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@${{ matrix.config.branch }} | PREFIX=. sh && break || sleep 30
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@$branch | PREFIX=. sh && break || sleep 30
done
mv nats-server nats-server.exe
cygpath -w "$(pwd)" | tee -a "$GITHUB_PATH"
Expand Down

0 comments on commit c56cbdd

Please sign in to comment.