Skip to content

Commit

Permalink
add install action (Chia-Network#12075)
Browse files Browse the repository at this point in the history
* add install action

* add the actual action file

* update pre-commit to use the install action

* add prefix for arch -arm64 use

* typo

* outputs:

* copy paste correction

* false

* hmm

* there

* if ("$env:INSTALL_PYTHON_VERSION" -ne "")
  • Loading branch information
altendky authored Jul 8, 2022
1 parent 96199c0 commit 51c6590
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 68 deletions.
36 changes: 36 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Install chia-blockchain"

description: "Run the platform appropriate installer script."

inputs:
python-version:
description: "Value to be set for INSTALL_PYTHON_VERSION."
required: false
default: ""
development:
description: "Install development dependencies."
required: false
default: ""
command-prefix:
description: "Text to place before the command such as `arch -arm64` for non-native macOS runners."
required: false
default: ""

runs:
using: "composite"
steps:
- name: Run install script (macOS, Ubuntu)
if: runner.os == 'macos' || runner.os == 'linux'
shell: bash
env:
INSTALL_PYTHON_VERSION: ${{ inputs.python-version }}
run: |
${{ inputs.command-prefix }} sh install.sh ${{ inputs.development && '-d' || '' }}
- name: Run install script (Windows)
if: runner.os == 'windows'
shell: pwsh
env:
INSTALL_PYTHON_VERSION: ${{ inputs.python-version }}
run: |
${{ inputs.command-prefix }} ./Install.ps1 ${{ inputs.development && '-d' || '' }}
14 changes: 7 additions & 7 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ jobs:
ref: ${{ env.BLOCKS_AND_PLOTS_VERSION }}
fetch-depth: 1

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: pytest
run: |
. ./activate
./venv/bin/py.test -n 0 --capture no -m benchmark tests
pytest -n 0 --capture no -m benchmark tests
12 changes: 6 additions & 6 deletions .github/workflows/build-linux-arm64-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ jobs:
tar -xvzf /tmp/bladebit.tar.gz -C $GITHUB_WORKSPACE/bladebit
chmod +x "$GITHUB_WORKSPACE/bladebit/bladebit"
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Build arm64 .deb package
env:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ldd --version
git -C ./chia-blockchain-gui status
. ./activate
cd ./build_scripts
sh build_linux_deb.sh arm64
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-linux-installer-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ jobs:
tar -xvzf /tmp/bladebit.tar.gz -C $GITHUB_WORKSPACE/bladebit
chmod +x "$GITHUB_WORKSPACE/bladebit/bladebit"
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Setup Node 16.x
uses: actions/setup-node@v3
Expand All @@ -159,7 +160,6 @@ jobs:
run: |
ldd --version
git -C ./chia-blockchain-gui status
. ./activate
cd ./build_scripts
sh build_linux_deb.sh amd64
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-linux-installer-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ jobs:
tar -xvzf /tmp/bladebit.tar.gz -C $GITHUB_WORKSPACE/bladebit
chmod +x "$GITHUB_WORKSPACE/bladebit/bladebit"
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Build .rpm package
env:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ldd --version
git -C ./chia-blockchain-gui status
. ./activate
cd ./build_scripts
bash build_linux_rpm.sh amd64
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-macos-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ jobs:
chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot"
chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34"
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Setup Node 16.x
uses: actions/setup-node@v3
Expand All @@ -145,7 +146,6 @@ jobs:
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
run: |
git -C ./chia-blockchain-gui status
. ./activate
cd ./build_scripts
sh build_macos.sh
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/build-macos-m1-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ jobs:
chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot"
chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34"
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
arch -arm64 sh install.sh -d
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true
command-prefix: "arch -arm64"

- uses: chia-network/actions/activate-venv@main

- name: Install node 16.x
run: |
Expand All @@ -119,7 +121,6 @@ jobs:
run: |
export PATH=$(brew --prefix node@16)/bin:$PATH
git -C ./chia-blockchain-gui status
. ./activate
cd ./build_scripts
arch -arm64 sh build_macos_m1.sh
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
- name: Run install script
run: |
sh install.sh -d

- uses: ./.github/actions/install
with:
development: true

- uses: pre-commit/[email protected]
22 changes: 12 additions & 10 deletions .github/workflows/test-install-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: sh install.sh
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Run install-gui script
run: |
. ./activate
sh install-gui.sh
test_scripts_in_docker:
Expand Down Expand Up @@ -247,12 +248,13 @@ jobs:
with:
fetch-depth: 0

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: sh install.sh -a
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true

- uses: chia-network/actions/activate-venv@main

- name: Run chia --help
run: |
. ./activate
chia --help
22 changes: 5 additions & 17 deletions .github/workflows/test-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,12 @@ jobs:
run: |
brew install boost
- name: Run install script (macOS, Ubuntu)
if: matrix.os.matrix == 'macos' || matrix.os.matrix == 'ubuntu'
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python.install_sh }}
run: |
sh install.sh -d
echo "$(cd venv/bin/; pwd)" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$(cd venv/; pwd)" >> $GITHUB_ENV
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.install_sh }}
development: true

- name: Run install script (Windows)
if: matrix.os.matrix == 'windows'
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python.install_sh }}
run: |
./Install.ps1 -d
(Resolve-Path venv/Scripts/).Path >> $Env:GITHUB_PATH
$env_path = (Resolve-Path venv/).Path
Write-Output "VIRTUAL_ENV=$env_path" >> $Env:GITHUB_ENV
- uses: chia-network/actions/activate-venv@main

- name: Install timelord
if: matrix.configuration.install_timelord
Expand Down
2 changes: 1 addition & 1 deletion Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
}

$supportedPythonVersions = "3.10", "3.9", "3.8", "3.7"
if (Test-Path env:INSTALL_PYTHON_VERSION)
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
{
$pythonVersion = $env:INSTALL_PYTHON_VERSION
}
Expand Down

0 comments on commit 51c6590

Please sign in to comment.