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 building in every commit #55

Open
wants to merge 4 commits into
base: verbose-printing
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 102 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Tests
on: [push, pull_request]

jobs:

check:
name: Check
runs-on: ubuntu-latest
Expand All @@ -22,7 +21,7 @@ jobs:
override: true

- name: Install cuda
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.2.2'
method: 'network'
Expand Down Expand Up @@ -78,15 +77,15 @@ jobs:

- name: Install CUDA Linux
if: runner.os == 'Linux'
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.2.2'
method: 'network'
sub-packages: '["nvcc", "cudart"]'

- name: Install CUDA Windows
if: runner.os == 'Windows'
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.5.1'
method: 'network'
Expand Down Expand Up @@ -168,15 +167,15 @@ jobs:

- name: Install CUDA Linux
if: runner.os == 'Linux'
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.2.2'
method: 'network'
sub-packages: '["nvcc", "cudart"]'

- name: Install CUDA Windows
if: runner.os == 'Windows'
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.5.1'
method: 'network'
Expand Down Expand Up @@ -242,7 +241,7 @@ jobs:
components: rustfmt, clippy

- name: Install cuda
uses: Jimver/[email protected].8
uses: Jimver/[email protected].10
with:
cuda: '11.2.2'
method: 'network'
Expand Down Expand Up @@ -271,3 +270,99 @@ jobs:
with:
command: clippy
args: --tests -- -D warnings

build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Build gnu-linux on ubuntu-18.04 and musl on ubuntu latest
os: [ ubuntu-18.04, windows-2019, macos-latest ]
features: ["default", "kaspacuda/overclock "]
name: Building debug binary of ${{ matrix.os }} ${{ matrix.features }}
steps:
- name: Fix CRLF on Windows
if: runner.os == 'Windows'
run: git config --global core.autocrlf false

- name: Fix LibOpenCL on Linux
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install ocl-icd-opencl-dev -y

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Install CUDA Linux
if: runner.os == 'Linux'
uses: Jimver/[email protected]
with:
cuda: '11.2.2'
method: 'network'
sub-packages: '["nvcc", "cudart"]'

- name: Install CUDA Windows
if: runner.os == 'Windows'
uses: Jimver/[email protected]
with:
cuda: '11.5.1'
method: 'network'
sub-packages: '["nvcc", "cudart"]'

- name: Build on Linux GNU
if: matrix.os == 'ubuntu-18.04'
# We're using musl to make the binaries statically linked and portable
run: |
cargo build --target=x86_64-unknown-linux-gnu --release --all --features ${{ matrix.features }}
feature_name=${{ matrix.features }}
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-${feature_name/\//-}-linux-gnu-amd64"
strip ./target/x86_64-unknown-linux-gnu/release/kaspa-miner
mkdir ${asset_name}
mv ./target/x86_64-unknown-linux-gnu/release/kaspa-miner ${asset_name}/${asset_name}
mv ./target/x86_64-unknown-linux-gnu/release/libkaspa*.so ${asset_name}/
tar czvf ${asset_name}.tgz ${asset_name}
echo "archive=${asset_name}.tgz" >> $GITHUB_ENV
echo "asset_name=${asset_name}.tgz" >> $GITHUB_ENV

- name: Build on Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
cargo build --target=x86_64-pc-windows-msvc --release --all --features ${{ matrix.features }}
feature_name=${{ matrix.features }}
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-${feature_name/\//-}-win64-amd64"
mkdir ${asset_name}
mv ./target/x86_64-pc-windows-msvc/release/kaspa-miner.exe ${asset_name}/${asset_name}.exe
mv ./target/x86_64-pc-windows-msvc/release/kaspa*.dll ${asset_name}/
bash ./integrations/windows/create_bat.sh ${asset_name}
7z a -tzip -r ${asset_name}.zip ${asset_name}
echo "archive=${asset_name}.zip" >> $GITHUB_ENV
echo "asset_name=${asset_name}.zip" >> $GITHUB_ENV

- name: Build on MacOS
if: matrix.os == 'macos-latest'
run: |
cargo build --target=x86_64-apple-darwin --release -p kaspa-miner
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-cpu-only-osx-amd64"
mkdir ${asset_name}
mv ./target/x86_64-apple-darwin/release/kaspa-miner ${asset_name}/${asset_name}
tar czvf ${asset_name}.tgz ${asset_name}
echo "archive=${asset_name}.tgz" >> $GITHUB_ENV
echo "asset_name=${asset_name}.tgz" >> $GITHUB_ENV

- name: Upload binary to GitHub
uses: actions/upload-artifact@v3
with:
name: "${{ runner.os }} binary"
path: "./${{ env.archive }}/"