diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f0d075..7b6b2f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,17 +36,15 @@ jobs: uses: actions/checkout@v2 - name: Install latest rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@v1 with: toolchain: stable target: i686-pc-windows-msvc - default: true - override: true - name: Build run: | - cargo build --release - Compress-Archive -LiteralPath target/release/odbc2parquet.exe -DestinationPath odbc2parquet-win-x86.zip + cargo build --release --target i686-pc-windows-msvc + Compress-Archive -LiteralPath target/i686-pc-windows-msvc/release/odbc2parquet.exe -DestinationPath odbc2parquet-win-x86.zip - name: Github Upload uses: svenstaro/upload-release-action@v2 @@ -91,6 +89,33 @@ jobs: asset_name: odbc2parquet-macos-x86_64.gz tag: ${{ github.ref }} + release_macos_arm64: + name: Build and release macOS ARM64 + # https://github.com/actions/runner-images?tab=readme-ov-file#available-images + runs-on: macos-latest # ARM-based macOS runner (Apple Silicon) + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Unix ODBC + run: | + brew install unixodbc + sudo ln -s /opt/homebrew/lib ~/lib + + - name: Build + run: | + cargo build --release + gzip --force target/release/odbc2parquet + mv target/release/odbc2parquet.gz odbc2parquet-macos-arm64.gz + + - name: Github Upload + uses: svenstaro/upload-release-action@v2 + with: + file: odbc2parquet-macos-arm64.gz + asset_name: odbc2parquet-macos-arm64.gz + tag: ${{ github.ref }} + release_ubuntu_x64: name: Build and release Ubuntu x86_64 runs-on: ubuntu-latest @@ -112,66 +137,32 @@ jobs: asset_name: odbc2parquet-ubuntu-x86_64.gz tag: ${{ github.ref }} - release_macos_arm64: - name: Build and release macOS ARM64 - # https://github.com/actions/runner-images?tab=readme-ov-file#available-images - runs-on: macos-latest # ARM-based macOS runner (Apple Silicon) + release_ubuntu_arm64: + name: Build and release Ubuntu ARM64 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - - name: Install Unix ODBC - run: | - brew install unixodbc - sudo ln -s /opt/homebrew/lib ~/lib + - name: Install latest rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-gnu - - name: Build - run: | - cargo build --release - gzip --force target/release/odbc2parquet - mv target/release/odbc2parquet.gz odbc2parquet-macos-arm64.gz + - name: Install cross for cross-compilation + run: cargo install cross + - name: Cross-build for Ubuntu ARM (aarch64) + run: | + cross build --release --target aarch64-unknown-linux-gnu + gzip --force target/aarch64-unknown-linux-gnu/release/odbc2parquet + mv target/aarch64-unknown-linux-gnu/release/odbc2parquet.gz odbc2parquet-ubuntu-arm64.gz + - name: Github Upload uses: svenstaro/upload-release-action@v2 with: - file: odbc2parquet-macos-arm64.gz - asset_name: odbc2parquet-macos-arm64.gz - tag: ${{ github.ref }} - - # Doesn't work yet. Needs package `aarch64-linux-gnu-gcc` - # - # release_ubuntu_arm64: - # name: Build and release Ubuntu ARM64 - # # https://github.com/actions/runner-images?tab=readme-ov-file#available-images - # runs-on: macos-latest # ARM-based macOS runner to cross-compile for Ubuntu ARM - - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - - # - name: Install latest rust toolchain - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # target: aarch64-unknown-linux-gnu - # default: true - # override: true - - # - name: Install Unix ODBC - # run: | - # brew install unixodbc - # sudo ln -s /opt/homebrew/lib ~/lib - - # - name: Cross-build for Ubuntu ARM (aarch64) - # run: | - # cargo build --release --target aarch64-unknown-linux-gnu - # gzip --force target/aarch64-unknown-linux-gnu/release/odbc2parquet - # mv target/aarch64-unknown-linux-gnu/release/odbc2parquet.gz odbc2parquet-ubuntu-arm64.gz - - # - name: Github Upload - # uses: svenstaro/upload-release-action@v2 - # with: - # file: odbc2parquet-ubuntu-arm64.gz - # asset_name: odbc2parquet-ubuntu-arm64.gz - # tag: ${{ github.ref }} + file: odbc2parquet-ubuntu-arm64.gz + asset_name: odbc2parquet-ubuntu-arm64.gz + tag: ${{ github.ref }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 261fe67..a631f84 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ # IDEs /.vscode/ -/.idea/ \ No newline at end of file +/.idea/ + +# OSs +.DS_Store diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..e7dde17 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,11 @@ +[target.aarch64-unknown-linux-gnu] +# Disable `build-std` for `aarch64-unknown-linux-gnu`, +# since it already has a std library pre-built. +build-std = false +# Install unixodbc:arm64 and unixodbc-dev:arm64, see +# Additional commands to run prior to building the package. +# These override the commands present in `[build]`: they will not merge. +pre-build = [ + "dpkg --add-architecture $CROSS_DEB_ARCH", + "apt-get update && apt-get install --assume-yes unixodbc:$CROSS_DEB_ARCH unixodbc-dev:$CROSS_DEB_ARCH" +]