This repository has been archived by the owner on Jul 22, 2022. It is now read-only.
forked from Flax-Network/flax-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (145 loc) · 5.96 KB
/
build-linux-installer-deb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build Installer - Linux DEB AMD64
on:
workflow_dispatch:
push:
branches:
- 'long_lived/**'
- main
- 'release/**'
tags:
- '**'
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
jobs:
build:
name: Linux amd64 DEB Installer
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.8]
os: [ubuntu-18.04]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Cleanup any leftovers that exist from previous runs
run: bash build_scripts/clean-runner.sh || true
- name: Setup Python environment
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Cache npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v3
with:
# Note that new runners may break this https://github.com/actions/cache/issues/292
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
# Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it
- name: Get version number
id: version_number
run: |
python3 -m venv ../venv
. ../venv/bin/activate
pip3 install setuptools_scm
echo "::set-output name=FLAX_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)"
deactivate
# Get the most recent release from chia-plotter-madmax
- uses: actions/github-script@v6
id: 'latest-madmax'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const release = await github.rest.repos.getLatestRelease({
owner: 'Chia-Network',
repo: 'chia-plotter-madmax',
});
return release.data.tag_name;
- name: Get latest madmax plotter
run: |
mkdir "$GITHUB_WORKSPACE/madmax"
wget -O "$GITHUB_WORKSPACE/madmax/flax_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-x86-64
wget -O "$GITHUB_WORKSPACE/madmax/flax_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-x86-64
chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot"
chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot_k34"
# Get the most recent release from bladebit
- uses: actions/github-script@v6
id: 'latest-bladebit'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const release = await github.rest.repos.getLatestRelease({
owner: 'Chia-Network',
repo: 'bladebit',
});
return release.data.tag_name;
- name: Get latest bladebit plotter
run: |
mkdir "$GITHUB_WORKSPACE/bladebit"
wget -O /tmp/bladebit.tar.gz https://github.com/Chia-Network/bladebit/releases/download/${{ steps.latest-bladebit.outputs.result }}/bladebit-${{ steps.latest-bladebit.outputs.result }}-ubuntu-x86-64.tar.gz
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
- name: Setup Node 16.x
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Add jq
run: |
sudo apt-get install -y jq
- name: Build .deb package
env:
FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }}
run: |
ldd --version
git -C ./flax-blockchain-gui status
. ./activate
cd ./build_scripts
sh build_linux_deb.sh amd64
- name: Upload Linux artifacts
uses: actions/upload-artifact@v3
with:
name: flax-installers-linux-deb-intel
path: ${{ github.workspace }}/build_scripts/final_installer/
- name: Create Checksums
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
env:
FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }}
run: |
ls ${{ github.workspace }}/build_scripts/final_installer/
sha256sum ${{ github.workspace }}/build_scripts/final_installer/flax-blockchain_${FLAX_INSTALLER_VERSION}_amd64.deb > ${{ github.workspace }}/build_scripts/final_installer/flax-blockchain_${FLAX_INSTALLER_VERSION}_amd64.deb.sha256
sha256sum ${{ github.workspace }}/build_scripts/final_installer/flax-blockchain-cli_${FLAX_INSTALLER_VERSION}-1_amd64.deb > ${{ github.workspace }}/build_scripts/final_installer/flax-blockchain-cli_${FLAX_INSTALLER_VERSION}-1_amd64.deb.sha256
ls ${{ github.workspace }}/build_scripts/final_installer/