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

Release builds for ARM architectures #130

Open
wants to merge 2 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
10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# use the correct linker for cross compiling to ARM
[target.armv7-unknown-linux-musleabihf]
linker = "rust-lld"

[target.arm-unknown-linux-musleabi]
linker = "rust-lld"

[target.aarch64-unknown-linux-musl]
linker = "rust-lld"

2 changes: 1 addition & 1 deletion .github/workflows/release_linux.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and upload release (linux)
name: Build and upload release (linux x86_64)

on:
release:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/release_linux_aarch64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and upload release (linux aarch64)

on:
release:
types: [created]

env:
APP_NAME: gdrive
ARCHIVE_NAME: gdrive_linux-aarch64.tar.gz

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare upload url
run: |
UPLOAD_URL="$(jq -r '.release.upload_url' "$GITHUB_EVENT_PATH" | sed -e "s/{?name,label}$/?name=${ARCHIVE_NAME}/")"
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: aarch64-unknown-linux-musl

- name: Build application
run: |
sudo apt update && sudo apt install -y clang llvm
export TARGET_CC=clang
export TARGET_AR=llvm-ar
cargo build --release --target=aarch64-unknown-linux-musl

- name: Create archive
run: |
tar -czf $ARCHIVE_NAME -C target/aarch64-unknown-linux-musl/release $APP_NAME

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip
47 changes: 47 additions & 0 deletions .github/workflows/release_linux_arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and upload release (linux arm 32bit)

on:
release:
types: [created]

env:
APP_NAME: gdrive
ARCHIVE_NAME: gdrive_linux-arm.tar.gz

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare upload url
run: |
UPLOAD_URL="$(jq -r '.release.upload_url' "$GITHUB_EVENT_PATH" | sed -e "s/{?name,label}$/?name=${ARCHIVE_NAME}/")"
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: armv7-unknown-linux-musleabihf

- name: Build application
run: |
sudo apt update && sudo apt install -y clang llvm
export TARGET_CC=clang
export TARGET_AR=llvm-ar
cargo build --release --target=armv7-unknown-linux-musleabihf

- name: Create archive
run: |
tar -czf $ARCHIVE_NAME -C target/armv7-unknown-linux-musleabihf/release $APP_NAME

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion .github/workflows/release_macos.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and upload release (macos)
name: Build and upload release (macos x86_64)

on:
release:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release_macos_arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and upload release (macos arm64)

on:
release:
types: [created]

env:
APP_NAME: gdrive
ARCHIVE_NAME: gdrive_macos-arm64.tar.gz

jobs:
build:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare upload url
run: |
UPLOAD_URL="$(jq -r '.release.upload_url' "$GITHUB_EVENT_PATH" | sed -e "s/{?name,label}$/?name=${ARCHIVE_NAME}/")"
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV

- name: Build application
run: |
rustup target add aarch64-apple-darwin
cargo build --release --target=aarch64-apple-darwin
tar -czf $ARCHIVE_NAME -C target/aarch64-apple-darwin/release/ $APP_NAME

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion src/common/drive_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub enum DocType {
}

impl DocType {
const IMPORT_EXTENSION_MAP: &[(FileExtension, DocType)] = &[
const IMPORT_EXTENSION_MAP: &'static [(FileExtension, DocType)] = &[
(FileExtension::Doc, DocType::Document),
(FileExtension::Docx, DocType::Document),
(FileExtension::Odt, DocType::Document),
Expand Down