-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kuksag/kuksag/vyper-compiler-ci
Add CI to update vyper info list
- Loading branch information
Showing
5 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: build-vyper-list | ||
|
||
on: | ||
push: | ||
schedule: | ||
# every 3 hours | ||
- cron: "0 */3 * * *" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Prerequisites | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y curl wget jq findutils coreutils sed | ||
- name: Build vyper list | ||
run: vyper/vyper_fetch.sh vyper.list.json vyper/create_entry.sh | ||
|
||
- uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'vyper.list.json' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Expected two arguments: <path to output file> <path to create_entry.sh>" | ||
exit 1 | ||
fi | ||
|
||
# 1. Remove beta versions from list.json (because later we call "to number") | ||
# 2. Cast every version to an array of values ("0.3.6" -> [0, 3, 6]) & Get maximum of such arrays | ||
latest_downloaded_version=$(jq --raw-output \ | ||
'[ .builds[] | select(.version | contains("beta") | not) ] | | ||
max_by(.version | split (".") | map(tonumber)) | .version' "$1") | ||
|
||
echo "Latest downloaded version: $latest_downloaded_version" | ||
|
||
echo "Fetching new versions..." | ||
|
||
# 1. Get only linux releases | ||
# 2. Remove beta versions from list.json (suppose beta only happened in the past) | ||
# 3. Cast every version to an array of values & select only such that greater than local latest | ||
# 4. Get name and download url of the latest versions | ||
new_versions=$(curl --silent --user-agent "blockscout-solc-bin" "https://api.github.com/repos/vyperlang/vyper/releases" | | ||
jq --raw-output \ | ||
".[].assets[] | | ||
select(.name | endswith(\"linux\")) | | ||
select(.name | contains(\"beta\") | not) | | ||
select( | ||
(.name | match(\"[0-9]+.[0-9]+.[0-9]+\") | .string | split(\".\") | map(tonumber)) | ||
> | ||
(\"$latest_downloaded_version\" | split(\".\") | map(tonumber) ) | ||
) | | ||
.name, .browser_download_url") | ||
|
||
if [ "$new_versions" == "" ]; then | ||
echo "No new versions found" | ||
exit 0 | ||
fi | ||
|
||
echo -e "New available versions:\n$new_versions" | ||
|
||
body_before=$(jq '.builds[]' "$1") | ||
|
||
body=$(echo "$new_versions" | xargs --delimiter='\n' --max-args=2 "$2") | ||
|
||
echo "$body$body_before" | jq -n '. |= [inputs] | {"builds":.}' >"$1" |
This file was deleted.
Oops, something went wrong.