Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
vporton committed Dec 10, 2023
2 parents 155a82f + 8c6740d commit 283413d
Show file tree
Hide file tree
Showing 142 changed files with 4,270 additions and 1,733 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/bitcoin-canister-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Check Bitcoin Canister Release Update

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs at UTC midnight every day

jobs:
check-update:
runs-on: ubuntu-latest

steps:
- name: Checkout dfx repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch Bitcoin Canister latest release tag
env:
GH_TOKEN: "${{ secrets.NIV_UPDATER_TOKEN }}"
run: |
LATEST_TAG=$(gh release view --repo dfinity/bitcoin-canister --json tagName -q .tagName)
echo "Latest tag is $LATEST_TAG"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
- name: Check if the latest release tag has been updated
run: |
URL_ENCODED_CURRENT_TAG=$(jq -r '.["ic-btc-canister"].version' nix/sources.json)
CURRENT_TAG=$(python -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))" "$URL_ENCODED_CURRENT_TAG")
echo "Current tag is $CURRENT_TAG"
if [[ "$CURRENT_TAG" == "$LATEST_TAG" ]]; then
echo "No update is required."
exit 1
else
echo "An update is required."
fi
- name: install Nix
uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: install niv (dependency manager for Nix projects)
run: nix-env -i niv -f '<nixpkgs>'

- name: install packages from nix/sources.json
run: niv update

- name: update sources
run: |
URL_ENCODED_LATEST_TAG=$(echo -n "$LATEST_TAG" | python -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.stdin.read().strip(), safe=""))')
niv update ic-btc-canister -a version=$URL_ENCODED_LATEST_TAG
./scripts/write-dfx-asset-sources.sh
- name: Update dfx to use the latest Bitcoin Canister version
env:
GH_TOKEN: "${{ secrets.NIV_UPDATER_TOKEN }}"
run: |
git config user.name github-actions
git config user.email [email protected]
git checkout -b bot/update-bitcoin-canister/$LATEST_TAG
git add .
git commit -m "Update Bitcoin Canister to $LATEST_TAG"
git push --set-upstream origin bot/update-bitcoin-canister/$LATEST_TAG
PR_TITLE="chore: Update Bitcoin Canister Version to $LATEST_TAG"
PR_BODY="This PR updates the Bitcoin Canister version to the latest tag: $LATEST_TAG"
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head $(git branch --show-current)
53 changes: 46 additions & 7 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: ["ic-ref", "replica"]
# macos-latest is currently macos-11, ubuntu-latest is currently ubuntu-20.04
# ubuntu-18.04 not supported due to:
# /home/runner/.cache/dfinity/versions/0.8.3-34-g36e39809/ic-starter:
Expand All @@ -97,17 +96,17 @@ jobs:
path: /usr/local/bin
- name: Setup dfx binary
run: chmod +x /usr/local/bin/dfx
- name: Disable query verification in ic-ref
if: ${{ matrix.backend == 'ic-ref' }}
run: |
echo DFX_DISABLE_QUERY_VERIFICATION=1 >> $GITHUB_ENV
- name: start and deploy
run: |
pwd
time dfx cache install
time dfx new smoke
cd smoke
if [ "${{ matrix.backend}}" = "ic-ref" ]; then
time dfx start --emulator --background
else
time dfx start --background
fi
time dfx start --background
time dfx deploy
time dfx canister call smoke_backend greet '("fire")'
time curl --fail http://localhost:"$(dfx info webserver-port)"/sample-asset.txt?canisterId=$(dfx canister id smoke_frontend)
Expand Down Expand Up @@ -153,10 +152,50 @@ jobs:
- name: Run e2e test
run: timeout 2400 bats "e2e/$E2E_TEST"

ui_test:
runs-on: ${{ matrix.os }}
needs: [build_dfx]
strategy:
matrix:
os: [macos-12, ubuntu-20.04, ubuntu-22.04]
steps:
- name: Checking out repo
uses: actions/checkout@v4
- name: Setting up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Installing playwright
run: |
pip install playwright==1.40.0
playwright install
playwright install-deps
- name: Download dfx binary
uses: actions/download-artifact@v3
with:
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }}
path: /usr/local/bin
- name: Setup dfx binary
run: chmod +x /usr/local/bin/dfx
- name: Deploy default dfx project
run: |
dfx new e2e_project
cd e2e_project
dfx start --background --clean
dfx deploy 2>&1 | tee deploy.log
echo FRONTEND_URL=$(grep "_frontend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV
echo CANDID_URL=$(grep "_backend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV
- name: Running the Python script
run: |
python scripts/test-uis.py \
--frontend_url "$FRONTEND_URL" \
--candid_url "$CANDID_URL" \
--browser chromium firefox webkit
aggregate:
name: e2e:required
if: ${{ always() }}
needs: [test, smoke]
needs: [test, smoke, ui_test]
runs-on: ubuntu-latest
steps:
- name: check smoke test result
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/publish-dfxvm-install-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish dfxvm install script

on:
push:
branches:
- sdk-1278-dfxvm-install-script
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .

jobs:
publish-manifest:
name: dfxvm-install-script-shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shfmt
run: go install mvdan.cc/sh/v3/cmd/shfmt@latest
- name: Generate
run: |
shellcheck --shell=sh public/install/*.sh --exclude SC2154,SC2034,SC3003,SC3014,SC3043
~/go/bin/shfmt -d -p -i 4 -ci -bn -s public/install/*.sh
sed -i "s/@revision@/${GITHUB_SHA}/" public/install/999_footer.sh
mkdir _out
cat public/install/*.sh > _out/install.sh
sed -i "
/#!.*/p
/##.*/p
/^ *$/d
/^ *#/d
s/ *#.*//
" _out/install.sh
- name: Upload Artifacts
if: github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
single_commit: yes
branch: dfxvm-install-script
folder: _out/
3 changes: 3 additions & 0 deletions .github/workflows/publish-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -17,6 +18,7 @@ env:

jobs:
publish-manifest:
name: install-script-shellcheck:required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -38,6 +40,7 @@ jobs:
" _out/install.sh
cp public/manifest.json _out/manifest.json
- name: Upload Artifacts
if: github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
single_commit: yes
Expand Down
Loading

0 comments on commit 283413d

Please sign in to comment.