Skip to content

Commit

Permalink
change cross platform environment to use taiki-e/cross-toolchain-action
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Apr 17, 2024
1 parent ea14366 commit b99569d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 43 deletions.
61 changes: 19 additions & 42 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,23 @@ jobs:
prerelease: false

publish:
runs-on: ${{ matrix.os }}
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_amd64
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_arm64
- os: macOS-latest
target: x86_64-apple-darwin
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_amd64
- os: macOS-latest
target: aarch64-apple-darwin
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: ${{ needs.setup.outputs.appname }}.exe
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_amd64
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: btmeister.exe
asset_name: btmeister-${{ needs.setup.outputs.tag }}_windows_arm64

- target: aarch64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_amd64
- target: x86_64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_arm64
- target: aarch64-pc-windows-gnullvm
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_amd64
- target: x86_64-pc-windows-gnu
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_arm64

steps:
# initialization
- name: Checkout the project
Expand All @@ -79,31 +65,22 @@ jobs:
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Setup
run: |
sudo apt-get install --yes --no-install-recommends musl-tools gcc-mingw-w64-x86-64-win32
run: rustup update stable

- uses: mbround18/setup-osxcross@v1
# This builds executables & sets env variables for rust to consume.
with:
osx-version: "12.3"

- name: Setup Rust (1/2) (toolchain)
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Setup Rust (2/2) (cross)
run: |
cargo install cross
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}

- name: Setup variables
id: vars
shell: bash
run: |
DIR=$(echo "${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}")
echo "dir=$DIR" >> $GITHUB_OUTPUT
- name: Cross build with all features
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
# publish release
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "totebag"
version = "0.1.10"
version = "0.1.11"
description = "A tool for archiving files and directories and extracting several archive formats."
repository = "https://github.com/tamada/totebag"
readme = "README.md"
Expand Down

0 comments on commit b99569d

Please sign in to comment.