Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to setup dfx #836

Merged
merged 10 commits into from
Aug 25, 2022
28 changes: 28 additions & 0 deletions .github/actions/setup-dfx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup DFX'
description: Setup DFX
inputs:
dfx-version:
default: 0.11.1
description: The dfx version to be installed or loaded from cache.
required: true
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
/usr/local/bin/dfx
~/.cache/dfinity
key: dfx-cache-${{ inputs.dfx-version }}-4
- name: Install DFX
shell: bash
run: |
if [[ "$(command -v dfx)" ]]
frederikrothenberger marked this conversation as resolved.
Show resolved Hide resolved
then
echo "DFX restored from cache"
else
echo "DFX not restored from cache, running install script:"
DFX_VERSION=${{ inputs.dfx-version }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
fi
echo "DFX version"
dfx --version
16 changes: 2 additions & 14 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ jobs:
device: [ 'desktop', 'mobile' ]
# Make sure that one failing test does not cancel all other matrix jobs
fail-fast: false
env:
DFX_VERSION: 0.11.1

steps:
- uses: actions/checkout@v2
Expand All @@ -245,12 +243,7 @@ jobs:
with:
node-version: 16.x

# This step hangs on Github actions on Darwin for some reason, that
# is why we run this only on Linux for now
- name: Install DFX
run: |
echo Install DFX Version: "$DFX_VERSION"
yes | sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
- uses: ./.github/actions/setup-dfx

# Helps with debugging
- name: Show versions
Expand Down Expand Up @@ -335,8 +328,6 @@ jobs:
using-dev-build:
runs-on: ubuntu-latest
needs: docker-build
env:
DFX_VERSION: 0.8.3
steps:
- uses: actions/checkout@v2

Expand All @@ -352,10 +343,7 @@ jobs:
# using https (for dfx-proxy)
node-version: 16.x

- name: Install DFX
run: |
echo Install DFX Version: "$DFX_VERSION"
yes | sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
- uses: ./.github/actions/setup-dfx

# Helps with debugging
- name: Show versions
Expand Down