Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed May 10, 2024
1 parent 36536e6 commit c60e185
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- .github/workflows/provision-darwin.sh
- .github/workflows/provision-linux.sh
- .github/workflows/backend.yaml
- .ic-commit

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/provision-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,34 @@ bash install-brew.sh
rm install-brew.sh

# Install Node.
version=${NODE_VERSION:=14.15.4}
version=${NODE_VERSION:=20.12.2}
curl --location --output node.pkg "https://nodejs.org/dist/v$version/node-v$version.pkg"
sudo installer -pkg node.pkg -store -target /
rm node.pkg

# Install DFINITY SDK.
curl --location --output install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/dfxvm-install-script/install.sh"
DFX_VERSION=${DFX_VERSION:=0.19.0} DFXVM_INIT_YES=true bash install-dfx.sh
curl --location --output install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.20.0} DFXVM_INIT_YES=true bash install-dfx.sh
rm install-dfx.sh
echo "$HOME/Library/Application Support/org.dfinity.dfx/bin" >> $GITHUB_PATH
source "$HOME/Library/Application Support/org.dfinity.dfx/env"
dfx cache install

# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
# if so, update the dfx cache with the latest ic artifacts
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
arch="x86_64-darwin"
if [ "$current_sha" != "$stable_sha" ]; then
export current_sha
export arch
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
fi
fi

# Install ic-repl
version=0.1.2
version=0.7.0
curl --location --output ic-repl "https://github.com/chenyan2002/ic-repl/releases/download/$version/ic-repl-macos"
mv ./ic-repl /usr/local/bin/ic-repl
chmod a+x /usr/local/bin/ic-repl
Expand Down Expand Up @@ -54,4 +67,4 @@ mv "${HOME}/bin/wasmtime-v${wasmtime_version}-x86_64-macos/wasmtime" "${HOME}/bi
rm "wasmtime-v${wasmtime_version}-x86_64-macos.tar.xz"

# Exit temporary directory.
popd
popd
22 changes: 17 additions & 5 deletions .github/workflows/provision-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,33 @@ set -ex
pushd /tmp

# Install Node.
wget --output-document install-node.sh "https://deb.nodesource.com/setup_14.x"
wget --output-document install-node.sh "https://deb.nodesource.com/setup_20.x"
sudo bash install-node.sh
sudo apt-get install --yes nodejs
rm install-node.sh

# Install DFINITY SDK.
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/dfxvm-install-script/install.sh"
DFX_VERSION=${DFX_VERSION:=0.19.0} DFXVM_INIT_YES=true bash install-dfx.sh
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.20.0} DFXVM_INIT_YES=true bash install-dfx.sh
rm install-dfx.sh
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
source "$HOME/.local/share/dfx/env"
dfx cache install
# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
# if so, update the dfx cache with the latest ic artifacts
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
arch="x86_64-linux"
if [ "$current_sha" != "$stable_sha" ]; then
export current_sha
export arch
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
fi
fi

# Install ic-repl
version=0.1.2
version=0.7.0
curl --location --output ic-repl "https://github.com/chenyan2002/ic-repl/releases/download/$version/ic-repl-linux64"
mv ./ic-repl /usr/local/bin/ic-repl
chmod a+x /usr/local/bin/ic-repl
Expand Down Expand Up @@ -53,4 +65,4 @@ echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

# Exit temporary directory.
popd
popd
1 change: 1 addition & 0 deletions .ic_commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
63acf4f88b20ec0c6384f4e18f0f6f69fc5d9b9f
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ test-4: # install
cat $$TMP_FILE; \
rm -f $$TMP_FILE

.PHONY: test-a
.SILENT: test-a
test-a: # install
.PHONY: test
.SILENT: test
test: install
# Call the backend canister for healthcheck and capture the output
@echo "Calling healthcheck on backend canister..."
@TMP_FILE=$$(mktemp); \
Expand Down
Empty file removed creates
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"webpack-dev-server": "^4.8.1"
},
"engines": {
"node": "^12 || ^14 || ^16 || ^18"
"node": "16 || ^18 || ^20"
},
"browserslist": [
"last 2 chrome version",
Expand Down

0 comments on commit c60e185

Please sign in to comment.