Skip to content

Update update_gear_version.py #149

Update update_gear_version.py

Update update_gear_version.py #149

name: Contracts CI - Tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'frontend/**'
- 'docker/**'
push:
paths-ignore:
- 'frontend/**'
- 'docker/**'
branches: [master]
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: contracts
permissions:
contents: write
id-token: write
pages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
GEAR_VERSION: ${{ steps.get_gear_version.outputs.GEAR_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python (to get the latest GEAR version)
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Get latest GEAR version
id: get_gear_version
run: |
python - <<EOF
import re, requests
tags = requests.get("https://api.github.com/repos/gear-tech/gear/tags").json()
valid_tags = sorted(
(tag['name'] for tag in tags if re.match(r'^v\d+\.\d+\.\d+$', tag['name'])),
key=lambda s: [int(part) for part in s.lstrip('v').split('.')],
reverse=True
)
if valid_tags:
print(f"::set-output name=GEAR_VERSION::{valid_tags[0].lstrip('v')}")
else:
raise Exception("No valid GEAR version found")
EOF
test:
runs-on: self-hosted
needs: [prepare]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust (Stable)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Prepare Gear Binary
run: |
mkdir -p target/tmp
wget -qO- https://get.gear.rs/gear-v${{ needs.prepare.outputs.GEAR_VERSION }}-x86_64-unknown-linux-gnu.tar.xz | tar xJ -C target/tmp
# mandatory tasks
- name: Fmt
run: 'cargo +nightly fmt --all -- --config imports_granularity=Crate,edition=2021'
- name: Clippy
run: 'cargo clippy --release --workspace --all-targets --all-features -- -D warnings'
- name: Test
run: cargo test --release --workspace