Skip to content

Commit

Permalink
Add automated builds for ARM (#179)
Browse files Browse the repository at this point in the history
* Move arm64 tests into test workflow

* Archive artifacts for arm64

* Fix missing target

* Add upload assets step

* Simplify packaging

* Use caching on ARM runners and remove is_md_file

Since GH now supports `skip ci`, we don't need this anymore

* Save artifacts for ARM64

* Simplify hashing condition

* Fix caching condition

* Use IPv6 for wget

* Don't use https for wget

* Add automatic release for ARM64
  • Loading branch information
ohsayan committed Jun 23, 2021
1 parent d53a0cb commit 3f0fc34
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 214 deletions.
264 changes: 106 additions & 158 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,19 @@ jobs:
rustup default stable
rustup target add ${{ matrix.rust }}
- name: Build
if: runner.os != 'Windows'
run: cargo build --release --target ${{ matrix.rust }}

- name: Build (Windows)
shell: cmd # Use cmd as the default shell to avoid perl path errors
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.rust }}
- name: Make bundle
run: make bundle
env:
RUSTFLAGS: -Ctarget-feature=+crt-static

- name: Upload binaries
RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.rust }}/release/skyd
target/${{ matrix.rust }}/release/skysh
target/${{ matrix.rust }}/release/sky-bench
if: runner.os != 'Windows'
name: ${{ matrix.rust }}
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip

- name: Upload binaries (Windows)
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.rust }}/release/skyd.exe
target/${{ matrix.rust }}/release/skysh.exe
target/${{ matrix.rust }}/release/sky-bench.exe
if: runner.os == 'Windows'
build_32bit:
name: Build artifacts (32-bit)
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -149,82 +132,55 @@ jobs:
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install 32-bit tools (Linux)
run: |
sudo apt update && sudo apt install gcc-multilib -y
run: sudo apt update && sudo apt install gcc-multilib -y
if: runner.os == 'Linux'

- name: Install Rust
run: |
rustup target add ${{ matrix.rust }}
- name: Build
if: runner.os != 'Windows'
run: cargo build --release --target ${{ matrix.rust }}

- name: Build (Windows)
shell: cmd # Use cmd as the default shell to avoid perl path errors
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.rust }}
- name: Make bundle
run: make bundle
env:
RUSTFLAGS: -Ctarget-feature=+crt-static

- name: Upload binaries
RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.rust }}/release/skyd
target/${{ matrix.rust }}/release/skysh
target/${{ matrix.rust }}/release/sky-bench
if: runner.os != 'Windows'
name: ${{ matrix.rust }}
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip

- name: Upload binaries (Windows)
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.rust }}/release/skyd.exe
target/${{ matrix.rust }}/release/skysh.exe
target/${{ matrix.rust }}/release/sky-bench.exe
if: runner.os == 'Windows'
build_musl:
name: Build Linux x86_64-musl (Tier 2)
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux]
include:
- build: linux
os: ubuntu-latest
artifact: x86_64-linux-musl
rust: x86_64-unknown-linux-musl

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
key: x86_64-unknown-linux-musl -cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-registry-
x86_64-unknown-linux-musl-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
key: x86_64-unknown-linux-musl-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-index-
x86_64-unknown-linux-musl-cargo-index-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
key: x86_64-unknown-linux-musl-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-target-
x86_64-unknown-linux-musl-target-
- name: Query version number
id: get_version
Expand All @@ -234,31 +190,86 @@ jobs:
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install MUSL tools
run: |
sudo apt update && sudo apt install musl-tools -y
run: sudo apt update && sudo apt install musl-tools -y

- name: Install Rust
run: |
rustup target add ${{ matrix.rust }}
- name: Build
run: cargo build --release --target ${{ matrix.rust }}
run: rustup target add x86_64-unknown-linux-musl

- name: Upload binaries
- name: Make bundle
run: make bundle
env:
RUST_BACKTRACE: 1
TARGET: x86_64-unknown-linux-musl
ARTIFACT: x86_64-linux-musl
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.rust }}/release/skyd
target/${{ matrix.rust }}/release/skysh
target/${{ matrix.rust }}/release/sky-bench
name: ${{ matrix.rust }}
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
build-arm64:
name: Build artifacts (self-hosted-arm64-native)
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up tools
run: |
sudo apt update && sudo apt install awscli zip zstd -y
aws configure set aws_access_key_id ${{ secrets.STORAGE_ACCESS_KEY }}
aws configure set aws_secret_access_key ${{ secrets.STORAGE_ACCESS_SECRET }}
aws configure set default.s3.signature_version s3v4
- name: Get cache
run: |
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }} s3 cp --no-progress s3://cache/skytable-linux-arm64.tar.zst target.tar.zst
tar -I zstd -xf target.tar.zst
rm target.tar.zst
echo "LASTHASH=$(cat target/LASTHASH 2>/dev/null)" >> $GITHUB_ENV
continue-on-error: true
- name: Install Rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo $HOME/.cargo/bin >> $GITHUB_PATH
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Make bundle
env:
TARGET: aarch64-unknown-linux-gnu
VERSION: ${{ steps.get_version.outputs.VERSION }}
ARTIFACT: aarch64-linux-gnu
- name: Save cache
env:
NEWHASH: ${{ hashFiles('Cargo.lock') }}
LASTHASH: ${{ env.LASTHASH }}
run: |
if [[ ${NEWHASH} != ${LASTHASH} ]]; then
echo "Freshening cache"
tar --zstd -cf target.tar.zst target
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }} s3 cp --no-progress target.tar.zst s3://cache/skytable-linux-arm64.tar.zst
echo "Finished freshening cache"
else
echo "Cache hit occurred. Not saving cache"
fi
- name: Upload bundle
run:
- >
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }}
s3 cp sky-bundle-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.zip
s3://releases/${{ steps.get_version.outputs.VERSION }}/
release:
name: Release
needs:
- build_64bit
- build_32bit
- build_musl
- build-arm64
runs-on: ubuntu-latest
steps:
- name: Query version number
Expand All @@ -267,82 +278,19 @@ jobs:
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}

- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Archive artifacts
run: |
wget https://raw.githubusercontent.com/skytable/skytable/next/ci/artifact.sh
chmod +x artifact.sh
bash artifact.sh
- name: Release Linux bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/x86_64-linux-gnu.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu.zip

- name: Release Windows bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/x86_64-windows.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-windows.zip

- name: Release MacOS bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/x86_64-macos.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-macos.zip

- name: Release Linux bundle (i686)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/i686-linux-gnu.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-i686-linux-gnu.zip

- name: Release Windows bundle (i686)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/i686-windows.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-i686-windows.zip
- name: Release Linux bundle (x86_64 MUSL)
uses: actions/upload-release-asset@v1
path: artifacts
- name: Download ARM64 bundle
run:
- >
wget
https://releases.skytable.io/release/${{ steps.get_version.outputs.VERSION }}/
sky-bundle-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.zip
working-directory: artifacts
- name: Upload release binaries
uses: alexellis/upload-assets@0.3.0
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/x86_64-linux-musl.zip
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
asset_paths: '["artifacts/*.zip"]'
20 changes: 0 additions & 20 deletions .github/workflows/test-aarch64.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ jobs:
run: make test
env:
RUST_BACKTRACE: 1
if: env.IS_MD_FILE == 'false'
Loading

0 comments on commit 3f0fc34

Please sign in to comment.