Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
lfs: true

- name: Install cargo-near
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh

- name: Run rustfmt
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -63,23 +65,3 @@ jobs:
- name: Run tests
run: |
RUST_BACKTRACE=1 cargo test

test-build:
name: Build and diff
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@v4

- name: Build
run: ./build.sh

- name: Diff
run: |
git diff
git status
changed_files=$(git status --porcelain --untracked-files=no | wc -l)
if [ $changed_files -gt 0 ]; then
echo 'contract changed, please rebuild contract'
exit 1
fi
51 changes: 51 additions & 0 deletions .github/workflows/update-contract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
tags:
- 'btc-light-client-v[0-9]+.[0-9]+.[0-9]+*'

workflow_dispatch:

name: Update Contracts
jobs:
update-contracts:
runs-on: ubuntu-latest
name: Update Contracts
permissions:
contents: write
steps:
- name: Clone the repository
uses: actions/checkout@v3
- name: Install cargo-near
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
- name: Build contract
run: |
cd contract

cargo near build reproducible-wasm
mv ./target/near/btc_light_client_contract.wasm ./target/near/btc_light_client_contract_bitcoin.wasm

cargo near build reproducible-wasm --variant bitcoin_testnet
mv ./target/near/btc_light_client_contract.wasm ./target/near/btc_light_client_contract_bitcoin_testnet.wasm

cargo near build reproducible-wasm --variant litecoin
mv ./target/near/btc_light_client_contract.wasm ./target/near/btc_light_client_contract_litecoin.wasm

cargo near build reproducible-wasm --variant litecoin_testnet
mv ./target/near/btc_light_client_contract.wasm ./target/near/btc_light_client_contract_litecoin_testnet.wasm
timeout-minutes: 60
- name: Archive built WASM files
env:
RAW_TAG: ${{ github.ref_name }}
run: |
SAFE_TAG="${RAW_TAG//./-}"
ZIP_NAME="${SAFE_TAG}.zip"
mkdir -p artifacts
find ./contract/target/near -name "*.wasm" -exec cp {} artifacts/ \;
zip -j "$ZIP_NAME" artifacts/*
shell: bash
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: "*.zip"
Loading
Loading