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

Build arm64 binaries #6

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
84 changes: 21 additions & 63 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,44 @@ name: Release

on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
extension: .exe
- target: x86_64-apple-darwin
# - target: x86_64-apple-darwin
# os: ubuntu-latest
Copy link
Owner

@mtsmfm mtsmfm Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this os should be macos-latest though, it seems you've tried both

https://github.com/int128/split-test/actions/runs/8845858159/job/24290599577

- target: aarch64-apple-darwin
os: macos-latest

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.target }}
use-cross: true
- uses: actions/upload-artifact@v1
with:
name: build-${{ matrix.target }}
path: target/${{ matrix.target }}/release/split-test${{ matrix.extension }}

create-release:
needs: [build]
runs-on: ubuntu-latest
steps:
- id: create-release
uses: actions/create-release@v1
- uses: actions/checkout@v4
- run: rustup update stable
- run: rustup default stable
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the error message

https://github.com/int128/split-test/actions/runs/8845858159/job/24290599577

error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-apple-darwin`

perhaps this patch helps?

Suggested change
- run: rustup default stable
- run: rustup default stable
- run: rustup target add ${{ matrix.target }}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@int128 Do you still have interests on this? At least I'd like to fix the CI if it has any trouble

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot everything about this pull request. If needed, feel free to pick my changes.

- run: cargo install cross
- run: cross build --release --target=${{ matrix.target }}
- run: cp -v "$target_binary" "$target_asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- run: |
echo '${{ steps.create-release.outputs.upload_url }}' > release_upload_url.txt
- uses: actions/upload-artifact@v1
with:
name: create-release
path: release_upload_url.txt

upload-release:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
include:
- target: x86_64-pc-windows-gnu
extension: .exe
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: create-release
- id: upload-url
run: |
echo "::set-output name=url::$(cat create-release/release_upload_url.txt)"
- uses: actions/download-artifact@v1
with:
name: build-${{ matrix.target }}
- run: find .
- uses: actions/upload-release-asset@v1
target_binary: target/${{ matrix.target }}/release/split-test${{ matrix.extension }}
target_asset: target/split-test-${{ matrix.target }}${{ matrix.extension }}
- if: github.ref_type == 'tag'
run: gh release upload "$GITHUB_REF_NAME" "$target_asset"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.upload-url.outputs.url }}
asset_path: build-${{ matrix.target }}/split-test${{ matrix.extension }}
asset_name: split-test-${{ matrix.target }}${{ matrix.extension }}
asset_content_type: application/octet-stream
GITHUB_TOKEN: ${{ github.token }}
target_asset: target/split-test-${{ matrix.target }}${{ matrix.extension }}
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: test
- uses: actions/checkout@v4
- run: rustup update stable
- run: rustup default stable
- run: cargo test