Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 2 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# The whole SDK team owns the whole repo for now.
* @dfinity/dx

# The infra team can still approve Nix PRs.
**/*.nix @dfinity-lab/infra
nix/** @dfinity-lab/infra

# Allows sources.json to be updated without full approval (only CI).
nix/sources.json @ghost
# Allows dfx-asset-sources.json to be updated without full approval (only CI).
src/dfx/assets/dfx-asset-sources.json @ghost
3 changes: 1 addition & 2 deletions .github/repo_policies/BOT_APPROVED_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
# This is to increase security and prevent accidentally updating files that shouldn't be changed by a bot
Cargo.lock
CHANGELOG.md
nix/sources.json
src/dfx/Cargo.toml
src/dfx/assets/dfx-asset-sources.toml
src/dfx/assets/dfx-asset-sources.json
26 changes: 7 additions & 19 deletions .github/workflows/bitcoin-canister-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install script dependencies
run: sudo apt-get install -y jq moreutils

- name: Fetch Bitcoin Canister latest release tag
env:
GH_TOKEN: "${{ secrets.NIV_UPDATER_TOKEN }}"
Expand All @@ -33,8 +36,7 @@ jobs:

- 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")
CURRENT_TAG=$(jq -r '.commmon."ic-btc-canister".version' src/dfx/assets/dfx-asset-sources.json)
echo "Current tag is $CURRENT_TAG"
if [[ "$CURRENT_TAG" == "$LATEST_TAG" ]]; then
echo "No update is required."
Expand All @@ -43,24 +45,10 @@ jobs:
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 sources to use the latest bitcoin canister version
run: ./scripts/update-btc-canister.sh "$LATEST_TAG"

- name: Update dfx to use the latest Bitcoin Canister version
- name: Create PR
env:
GH_TOKEN: "${{ secrets.NIV_UPDATER_TOKEN }}"
run: |
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/consistent-sources.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/update-motoko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ jobs:
echo "MOTOKO_VERSION=${{ github.event.inputs.motokoVersion }}" >> $GITHUB_ENV
fi
grep -s "MOTOKO_VERSION" $GITHUB_ENV

- 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 Motoko
run: |
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/update-replica-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@ jobs:
echo "REPLICA_VERSION=${{ github.event.inputs.customReplicaVersion }}" >> $GITHUB_ENV
fi
grep -s "REPLICA_VERSION" $GITHUB_ENV

- 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 replica
run: |
Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ What that means is your PR title should start with one of the following prefix:
#### Locally
To update the replica to a given $SHA from the dfinity repo, execute the following:
``` bash
# Requires niv to run. To install niv, run nix-env -iA nixpkgs.niv
./scripts/update-replica.sh $SHA
```

Expand All @@ -114,7 +113,6 @@ To update Motoko to a given $VERSION from the motoko and motoko-base repos, run

You can also execute the following locally:
``` bash
# Requires niv to run. To install niv, run nix-env -iA nixpkgs.niv
./scripts/update-motoko.sh $VERSION
```

Expand Down
51 changes: 2 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/tests-dfx/info.bash
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ teardown() {
}

@test "displays the replica revision included in dfx" {
nix_sources_path="${BATS_TEST_DIRNAME}/../../nix/sources.json"
expected_rev="$(jq -r '."pocket-ic-x86_64-linux".rev' "$nix_sources_path")"
sources_path="${BATS_TEST_DIRNAME}/../../src/dfx/assets/dfx-asset-sources.json"
expected_rev="$(jq -r '."x86_64-linux"."pocket-ic".rev' "$sources_path")"

assert_command dfx info replica-rev
assert_eq "$expected_rev"
Expand Down
7 changes: 0 additions & 7 deletions nix/README.adoc

This file was deleted.

49 changes: 0 additions & 49 deletions nix/sources.json

This file was deleted.

26 changes: 26 additions & 0 deletions scripts/update-btc-canister.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

# $1 not set || not running in repo root
if [ -z ${1+x} ] || [ ! "$0" -ef ./scripts/update-btc-canister.sh ]; then
echo "Usage: run ./scripts/update-btc-canister.sh <version-to-update-to> in repo root"
exit 1
fi
if ! command -v curl jq sponge &>/dev/null; then
echo "This script requires curl, jq, and moreutils to be installed"
exit 1
fi

urlencode() {
printf '%s' "$1" | jq -sRr @uri
}

sources="src/dfx/assets/dfx-asset-sources.json"
version=$1
echo "Updating sources to version $version"
btc_canister_url=$(printf 'https://github.com/dfinity/bitcoin-canister/releases/download/%s/ic-btc-canister.wasm.gz' "$(urlencode "$version")")
btc_canister_sha=$(curl --proto '=https' --tlsv1.2 -sSfL "$btc_canister_url" | sha256sum | head -c 64)
jq '.common."ic-btc-canister" = {url: $url, sha256: $sha256, version: $version}' --arg version "$version" \
--arg url "$btc_canister_url" --arg sha256 "$btc_canister_sha" "$sources" | sponge "$sources"

echo "Done. Don't forget to update CHANGELOG.md"
Loading