Add automated builds for ARM (#179)

* 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
next
Sayan 3 years ago committed by GitHub
parent d53a0cb505
commit 3f0fc340c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,36 +68,19 @@ jobs:
rustup default stable rustup default stable
rustup target add ${{ matrix.rust }} rustup target add ${{ matrix.rust }}
- name: Build - name: Make bundle
if: runner.os != 'Windows' run: make bundle
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 }}
env: env:
RUSTFLAGS: -Ctarget-feature=+crt-static RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
- name: Upload binaries ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ matrix.artifact }} name: ${{ matrix.rust }}
path: | path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
target/${{ matrix.rust }}/release/skyd
target/${{ matrix.rust }}/release/skysh
target/${{ matrix.rust }}/release/sky-bench
if: runner.os != 'Windows'
- 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: build_32bit:
name: Build artifacts (32-bit) name: Build artifacts (32-bit)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -149,56 +132,29 @@ jobs:
echo ::set-output name=version::"${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install 32-bit tools (Linux) - name: Install 32-bit tools (Linux)
run: | run: sudo apt update && sudo apt install gcc-multilib -y
sudo apt update && sudo apt install gcc-multilib -y
if: runner.os == 'Linux' if: runner.os == 'Linux'
- name: Install Rust - name: Install Rust
run: | run: |
rustup target add ${{ matrix.rust }} rustup target add ${{ matrix.rust }}
- name: Build - name: Make bundle
if: runner.os != 'Windows' run: make bundle
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 }}
env: env:
RUSTFLAGS: -Ctarget-feature=+crt-static RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
- name: Upload binaries ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ matrix.artifact }} name: ${{ matrix.rust }}
path: | path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
target/${{ matrix.rust }}/release/skyd
target/${{ matrix.rust }}/release/skysh
target/${{ matrix.rust }}/release/sky-bench
if: runner.os != 'Windows'
- 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: build_musl:
name: Build Linux x86_64-musl (Tier 2) name: Build Linux x86_64-musl (Tier 2)
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
matrix:
build: [linux]
include:
- build: linux
os: ubuntu-latest
artifact: x86_64-linux-musl
rust: x86_64-unknown-linux-musl
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -206,25 +162,25 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} key: x86_64-unknown-linux-musl -cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-registry- x86_64-unknown-linux-musl-cargo-registry-
- name: Cache Cargo index - name: Cache Cargo index
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} key: x86_64-unknown-linux-musl-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-index- x86_64-unknown-linux-musl-cargo-index-
- name: Cache Cargo build - name: Cache Cargo build
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} key: x86_64-unknown-linux-musl-target-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-target- x86_64-unknown-linux-musl-target-
- name: Query version number - name: Query version number
id: get_version id: get_version
@ -234,24 +190,78 @@ jobs:
echo ::set-output name=version::"${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install MUSL tools - name: Install MUSL tools
run: | run: sudo apt update && sudo apt install musl-tools -y
sudo apt update && sudo apt install musl-tools -y
- name: Install Rust - name: Install Rust
run: | run: rustup target add x86_64-unknown-linux-musl
rustup target add ${{ matrix.rust }}
- name: Build
run: cargo build --release --target ${{ matrix.rust }}
- 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 uses: actions/upload-artifact@v2
with: with:
name: ${{ matrix.artifact }} name: ${{ matrix.rust }}
path: | path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
target/${{ matrix.rust }}/release/skyd build-arm64:
target/${{ matrix.rust }}/release/skysh name: Build artifacts (self-hosted-arm64-native)
target/${{ matrix.rust }}/release/sky-bench 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: release:
name: Release name: Release
@ -259,6 +269,7 @@ jobs:
- build_64bit - build_64bit
- build_32bit - build_32bit
- build_musl - build_musl
- build-arm64
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Query version number - name: Query version number
@ -267,82 +278,19 @@ jobs:
run: | run: |
echo "using version tag ${GITHUB_REF:10}" echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${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 - name: Download all artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with:
path: artifacts path: artifacts
- name: Download ARM64 bundle
- name: Archive artifacts run:
run: | - >
wget https://raw.githubusercontent.com/skytable/skytable/next/ci/artifact.sh wget
chmod +x artifact.sh https://releases.skytable.io/release/${{ steps.get_version.outputs.VERSION }}/
bash artifact.sh sky-bundle-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.zip
working-directory: artifacts
- name: Release Linux bundle (x86_64) - name: Upload release binaries
uses: actions/upload-release-asset@v1 uses: alexellis/upload-assets@0.3.0
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
env: env:
GITHUB_TOKEN: ${{ secrets.TDBB }} GITHUB_TOKEN: ${{ github.token }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} asset_paths: '["artifacts/*.zip"]'
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

@ -1,20 +0,0 @@
on: [push, pull_request]
name: Test (arm64-native)
jobs:
test:
name: Test
runs-on: self-hosted
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Test
run: make test
- name: Stress test
run: make stress
if: "contains(toJSON(github.event.commits.*.msg), '[stress-ci]')"

@ -69,4 +69,3 @@ jobs:
run: make test run: make test
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
if: env.IS_MD_FILE == 'false'

@ -8,7 +8,6 @@ on:
env: env:
IS_ACTIONS_DOC: "false" IS_ACTIONS_DOC: "false"
IS_MD_FILE: "false"
jobs: jobs:
tests-pass: tests-pass:
name: Tier 1 Tests name: Tier 1 Tests
@ -16,7 +15,15 @@ jobs:
needs: needs:
- test_64bit - test_64bit
- test_32bit - test_32bit
- test-arm64
steps: steps:
- name: Download ARM64 artifact
run: wget http://releases.skytable.io/everycommit/${{ github.sha }}-aarch64-unknown-linux-gnu-builds.zip
- name: Upload ARM64 artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.sha }}-aarch64-unknown-linux-gnu-builds.zip
path: ${{ github.sha }}-aarch64-unknown-linux-gnu-builds.zip
- name: Finish Tier 1 Tests - name: Finish Tier 1 Tests
run: exit 0 run: exit 0
test_64bit: test_64bit:
@ -57,8 +64,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-registry- ${{ matrix.rust }}-cargo-registry-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo index - name: Cache Cargo index
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -66,8 +71,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-index- ${{ matrix.rust }}-cargo-index-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo build - name: Cache Cargo build
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -75,13 +78,11 @@ jobs:
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-target- ${{ matrix.rust }}-target-
if: env.IS_MD_FILE == 'false'
- name: Install Rust - name: Install Rust
run: | run: |
rustup default stable rustup default stable
rustup target add ${{ matrix.rust }} rustup target add ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Publish docs - name: Publish docs
env: env:
@ -99,14 +100,13 @@ jobs:
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }} TARGET: ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Archive artifacts - name: Archive artifacts
run: | run: |
mkdir dist mkdir dist
cargo build --target ${{ matrix.rust }} cargo build --target ${{ matrix.rust }}
mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist
if: env.IS_MD_FILE == 'false' && runner.os != 'Windows' if: runner.os != 'Windows'
- name: Archive artifacts - name: Archive artifacts
shell: cmd shell: cmd
@ -117,14 +117,13 @@ jobs:
move target\${{ matrix.rust }}\debug\*.exe dist move target\${{ matrix.rust }}\debug\*.exe dist
env: env:
RUSTFLAGS: -Ctarget-feature=+crt-static RUSTFLAGS: -Ctarget-feature=+crt-static
if: env.IS_MD_FILE == 'false' && runner.os == 'Windows' if: runner.os == 'Windows'
- name: Save artifacts - name: Save artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip
path: dist path: dist
if: env.IS_MD_FILE == 'false'
test_32bit: test_32bit:
name: Test (32-bit) name: Test (32-bit)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -154,7 +153,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-registry- ${{ matrix.rust }}-cargo-registry-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo index - name: Cache Cargo index
uses: actions/cache@v2 uses: actions/cache@v2
@ -163,7 +161,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-index- ${{ matrix.rust }}-cargo-index-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo build - name: Cache Cargo build
uses: actions/cache@v2 uses: actions/cache@v2
@ -172,27 +169,24 @@ jobs:
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-target- ${{ matrix.rust }}-target-
if: env.IS_MD_FILE == 'false'
- name: Install Rust - name: Install Rust
run: | run: |
rustup default stable rustup default stable
rustup target add ${{ matrix.rust }} rustup target add ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Run Tests - name: Run Tests
run: make test run: make test
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }} TARGET: ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Archive artifacts - name: Archive artifacts
run: | run: |
mkdir dist mkdir dist
cargo build --target ${{ matrix.rust }} cargo build --target ${{ matrix.rust }}
mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist
if: env.IS_MD_FILE == 'false' && runner.os == 'Linux' if: runner.os == 'Linux'
- name: Archive artifacts - name: Archive artifacts
shell: cmd shell: cmd
@ -203,14 +197,13 @@ jobs:
move target\${{ matrix.rust }}\debug\*.exe dist move target\${{ matrix.rust }}\debug\*.exe dist
env: env:
RUSTFLAGS: -Ctarget-feature=+crt-static RUSTFLAGS: -Ctarget-feature=+crt-static
if: env.IS_MD_FILE == 'false' && runner.os == 'Windows' if: runner.os == 'Windows'
- name: Save artifacts - name: Save artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip
path: dist path: dist
if: env.IS_MD_FILE == 'false'
test_musl64: test_musl64:
name: Test MUSL x86_64 (Tier 2) name: Test MUSL x86_64 (Tier 2)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -238,7 +231,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-registry- ${{ matrix.rust }}-cargo-registry-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo index - name: Cache Cargo index
uses: actions/cache@v2 uses: actions/cache@v2
@ -247,7 +239,6 @@ jobs:
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-cargo-index- ${{ matrix.rust }}-cargo-index-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo build - name: Cache Cargo build
uses: actions/cache@v2 uses: actions/cache@v2
@ -256,31 +247,76 @@ jobs:
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.rust }}-target- ${{ matrix.rust }}-target-
if: env.IS_MD_FILE == 'false'
- name: Install Rust - name: Install Rust
run: | run: |
rustup default stable rustup default stable
rustup target add ${{ matrix.rust }} rustup target add ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Run Tests - name: Run Tests
run: make test run: make test
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }} TARGET: ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Archive artifacts - name: Archive artifacts
run: | run: |
mkdir dist mkdir dist
cargo build --target ${{ matrix.rust }} cargo build --target ${{ matrix.rust }}
mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist mv target/${{ matrix.rust }}/debug/skyd target/${{ matrix.rust }}/debug/skysh target/${{ matrix.rust }}/debug/sky-bench dist
if: env.IS_MD_FILE == 'false'
- name: Save artifacts - name: Save artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip name: ${{ github.sha }}-${{ matrix.rust }}-builds.zip
path: dist path: dist
if: env.IS_MD_FILE == 'false' test-arm64:
name: Test (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: Test
run: make test
env:
TARGET: aarch64-unknown-linux-gnu
- name: Stress test
run: make stress
if: "contains(toJSON(github.event.commits.*.msg), '[stress-ci]')"
- 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: Save artifacts
run: |
cargo build -j16 --target aarch64-unknown-linux-gnu
zip -j dist.zip target/aarch64-unknown-linux-gnu/debug/skyd target/aarch64-unknown-linux-gnu/debug/skysh target/aarch64-unknown-linux-gnu/debug/sky-bench
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }} s3 cp dist.zip s3://everycommit/${{ github.sha }}-aarch64-unknown-linux-gnu-builds.zip

@ -1,4 +1,5 @@
ADDITIONAL_SOFTWARE= ADDITIONAL_SOFTWARE=
# (DEF) Either prepare --target triple-x-y OR have an empty value
TARGET_ARG = TARGET_ARG =
ifneq ($(origin TARGET),undefined) ifneq ($(origin TARGET),undefined)
TARGET_ARG +=--target ${TARGET} TARGET_ARG +=--target ${TARGET}
@ -12,14 +13,14 @@ ADDITIONAL_SOFTWARE += sudo apt-get update && sudo apt install gcc-multilib -y
endif endif
endif endif
# display a message if no additional packages are required for this target # (DEF) display a message if no additional packages are required for this target
ifeq ($(ADDITIONAL_SOFTWARE),) ifeq ($(ADDITIONAL_SOFTWARE),)
ADDITIONAL_SOFTWARE += echo "info: No additional software required for this target" ADDITIONAL_SOFTWARE += echo "info: No additional software required for this target"
endif endif
BUILD_VERBOSE = cargo build --verbose $(TARGET_ARG) BUILD_VERBOSE = cargo build --verbose $(TARGET_ARG)
# Create empty commands # (DEF) Create empty commands
STOP_SERVER = STOP_SERVER =
BUILD_COMMAND = BUILD_COMMAND =
BUILD_SERVER_COMMAND = BUILD_SERVER_COMMAND =
@ -27,6 +28,7 @@ TEST_COMMAND =
RELEASE_COMMAND = RELEASE_COMMAND =
START_COMMAND = START_COMMAND =
# (DEF) Add cmd /c for windows due to OpenSSL issues or just add cargo run for non-windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
# export windows specifc rustflags # export windows specifc rustflags
export RUSTFLAGS = -Ctarget-feature=+crt-static export RUSTFLAGS = -Ctarget-feature=+crt-static
@ -43,7 +45,7 @@ STOP_SERVER += pkill skyd
# make sure to set executable permissions # make sure to set executable permissions
endif endif
# Assemble the commands # (DEF) Assemble the commands
BUILD_SERVER_COMMAND += $(BUILD_VERBOSE) BUILD_SERVER_COMMAND += $(BUILD_VERBOSE)
BUILD_SERVER_COMMAND += -p skyd BUILD_SERVER_COMMAND += -p skyd
RELEASE_SERVER_COMMAND = RELEASE_SERVER_COMMAND =
@ -63,6 +65,28 @@ START_COMMAND += &
START_COMMAND_RELEASE += & START_COMMAND_RELEASE += &
endif endif
# (DEF) Prepare release bundle commands
BUNDLE=
ifeq ($(origin TARGET),undefined)
# no target defined. but check for windows
ifeq ($(OS),Windows_NT)
# windows, so we need exe
BUNDLE+=zip -j sky-bundle-${VERSION}-${ARTIFACT}.zip target/release/{skysh.exe,skyd.exe,sky-bench.exe}
else
# not windows, so no exe
BUNDLE+=zip -j sky-bundle-${VERSION}-${ARTIFACT}.zip target/release/{skysh,skyd,sky-bench}
endif
else
# target was defined, but check for windows
ifeq ($(OS),Windows_NT)
# windows, so we need exe
BUNDLE+= zip -j bundle.zip target/${TARGET}/release/{skysh,skyd,sky-bench}
else
# not windows, so no exe
BUNDLE+=zip -j bundle.zip target/${TARGET}/release/{skysh,skyd,sky-bench}
endif
endif
.pre: .pre:
@echo "====================================================================" @echo "===================================================================="
@echo "Installing any additional dependencies" @echo "Installing any additional dependencies"
@ -114,6 +138,11 @@ stress: .release-server
@echo "====================================================================" @echo "===================================================================="
@$(STOP_SERVER) @$(STOP_SERVER)
rm .sky_pid rm .sky_pid
bundle: release
@echo "===================================================================="
@echo "Creating bundle for platform"
@echo "===================================================================="
@$(BUNDLE)
clean: clean:
@echo "====================================================================" @echo "===================================================================="
@echo "Cleaning up target folder" @echo "Cleaning up target folder"

@ -6,12 +6,7 @@
set -euo pipefail set -euo pipefail
FILES_CHANGED=$(git diff --numstat HEAD^..HEAD | wc -l) FILES_CHANGED=$(git diff --numstat HEAD^..HEAD | wc -l)
ACTIONS_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- 'actions.jsonc' | wc -l) ACTIONS_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- 'actions.jsonc' | wc -l)
MD_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- '*.md' | wc -l) if [ ${ACTIONS_CHANGED_COUNT} = "1" ]; then
if [ ${FILES_CHANGED} = ${MD_CHANGED_COUNT} ]; then
# This push just modifies markdown files
echo "This push only modifies markdown files"
echo "IS_MD_FILE=true" >>$GITHUB_ENV
elif [ ${ACTIONS_CHANGED_COUNT} = "1" ]; then
# This push changes the actions documentation # This push changes the actions documentation
echo "This push modifies the actions.jsonc file" echo "This push modifies the actions.jsonc file"
echo "IS_ACTIONS_DOC=true" >>$GITHUB_ENV echo "IS_ACTIONS_DOC=true" >>$GITHUB_ENV

Loading…
Cancel
Save