Skip to content

Commit

Permalink
fix: install dfx using setup-dfx action (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswanson-dfinity authored Mar 2, 2024
1 parent 8678a87 commit be20e00
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
build_deps: scripts/workflows/provision-darwin-build.sh
steps:
- uses: actions/checkout@master

- uses: actions/cache@v3
with:
path: |
Expand Down Expand Up @@ -83,6 +83,8 @@ jobs:
path: /usr/local/bin
- name: Setup quill binary
run: chmod +x /usr/local/bin/quill
- name: Install dfx
uses: dfinity/setup-dfx@main
- name: Provision Darwin
if: ${{ contains(matrix.os, 'macos') }}
run: bash scripts/workflows/provision-darwin-e2e.sh
Expand Down
20 changes: 15 additions & 5 deletions e2e/utils/_.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,34 @@ standard_setup() {
x=$(mktemp -d -t dfx-e2e-XXXXXXXX)
export DFX_E2E_TEMP_DIR="$x"

if [ "$(uname)" == "Darwin" ]; then
project_relative_path="Library/Application Support/org.dfinity.dfx"
elif [ "$(uname)" == "Linux" ]; then
project_relative_path=".local/share/dfx"
fi

mkdir "$x/working-dir"
mkdir "$x/cache-root"
mkdir "$x/config-root"
mkdir "$x/home-dir"

# we need to configure dfxvm in the isolated home directory
default_dfx_version="$(dfxvm default)"
# don't re-download dfx for every test
mkdir -p "$x/home-dir/$project_relative_path"
ln -s "$HOME/$project_relative_path/versions" "$x/home-dir/$project_relative_path/versions"

cd "$x/working-dir" || exit

export HOME="$x/home-dir"
export DFX_CACHE_ROOT="$x/cache-root"
export DFX_CONFIG_ROOT="$x/config-root"
export RUST_BACKTRACE=1
export PEM_LOCATION="${BATS_TEST_DIRNAME}/../assets"
if [ "$(uname)" == "Darwin" ]; then
export E2E_SHARED_LOCAL_NETWORK_DATA_DIRECTORY="$HOME/Library/Application Support/org.dfinity.dfx/network/local"
elif [ "$(uname)" == "Linux" ]; then
export E2E_SHARED_LOCAL_NETWORK_DATA_DIRECTORY="$HOME/.local/share/dfx/network/local"
fi
export E2E_SHARED_LOCAL_NETWORK_DATA_DIRECTORY="$HOME/$project_relative_path/network/local"
export E2E_NETWORKS_JSON="$DFX_CONFIG_ROOT/.config/dfx/networks.json"

dfxvm default "$default_dfx_version"
}

standard_nns_setup() {
Expand Down
3 changes: 0 additions & 3 deletions scripts/workflows/provision-darwin-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ pushd /tmp

brew install coreutils

# install dfx
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"

# Install Bats.
if [ "$(uname -r)" = "19.6.0" ]; then
brew unlink bats
Expand Down
3 changes: 0 additions & 3 deletions scripts/workflows/provision-linux-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export
# Enter temporary directory.
pushd /tmp

# install dfx
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"

# Install Bats.
sudo apt-get install --yes bats

Expand Down

0 comments on commit be20e00

Please sign in to comment.