surrealpatch/.github/workflows/nightly.yml

300 lines
9.7 KiB
YAML
Raw Normal View History

2022-09-22 13:56:27 +00:00
name: Nightly release
on:
workflow_dispatch:
2022-09-22 13:56:27 +00:00
schedule:
- cron: '0 0 * * *'
defaults:
run:
shell: bash
2022-09-22 13:56:27 +00:00
jobs:
test:
name: Test
2023-06-09 15:19:26 +00:00
runs-on: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
steps:
- name: Checkout sources
uses: actions/checkout@v3
2022-09-22 13:56:27 +00:00
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
2022-09-22 13:56:27 +00:00
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
2022-09-22 13:56:27 +00:00
- name: Run cargo test
run: |
(&>/dev/null cargo run --no-default-features -F storage-mem -- start --log trace --user root --pass root memory &)
cargo test --workspace --features protocol-ws,protocol-http,kv-mem,kv-rocksdb
2022-09-22 13:56:27 +00:00
lint:
name: Lint
2023-06-09 15:19:26 +00:00
runs-on: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
steps:
- name: Checkout sources
uses: actions/checkout@v3
2022-09-22 13:56:27 +00:00
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
2022-09-22 13:56:27 +00:00
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
2022-09-22 13:56:27 +00:00
with:
targets: wasm32-unknown-unknown
2022-09-22 13:56:27 +00:00
components: rustfmt, clippy
- name: Run cargo check
run: cargo check --workspace
2022-09-22 13:56:27 +00:00
- name: Check format of code
run: cargo fmt --all --check
2022-09-22 13:56:27 +00:00
- name: Check format of unlinked tests
run: cargo fmt --all --check -- ./lib/tests/**/*.rs ./lib/src/kvs/tests/*.rs
- name: Check linting with clippy
2023-06-20 11:48:20 +00:00
run: cargo clippy --all-targets --all-features -- -D warnings
2022-09-22 13:56:27 +00:00
- name: Run WebAssembly check
run: cargo check --features kv-mem,kv-indxdb,protocol-ws,protocol-http --target wasm32-unknown-unknown --package surrealdb
2022-09-22 13:56:27 +00:00
build:
name: Build ${{ matrix.arch }}
needs: [test, lint]
strategy:
fail-fast: false
2022-09-22 13:56:27 +00:00
matrix:
include:
- arch: x86_64-apple-darwin
os: macos-latest-xl
2022-09-22 13:56:27 +00:00
file: surreal-nightly.darwin-amd64
opts: --features storage-tikv
- arch: aarch64-apple-darwin
os: macos-latest-xl
2022-09-22 13:56:27 +00:00
file: surreal-nightly.darwin-arm64
opts: --features storage-tikv
- arch: x86_64-unknown-linux-gnu
2023-06-09 15:19:26 +00:00
os: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
file: surreal-nightly.linux-amd64
opts: --features storage-tikv
- arch: aarch64-unknown-linux-gnu
2023-06-09 15:19:26 +00:00
os: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
file: surreal-nightly.linux-arm64
opts: --features storage-tikv
- arch: x86_64-pc-windows-msvc
os: windows-latest
2022-09-22 13:56:27 +00:00
file: surreal-nightly.windows-amd64
opts:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
2022-09-22 13:56:27 +00:00
- name: Prepare environment
if: contains(matrix.arch, 'windows') && endsWith(matrix.arch, '-gnu')
run: echo "C:\msys64\usr\bin;$Env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Install dependencies
if: contains(matrix.arch, 'windows') && endsWith(matrix.arch, '-msvc')
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static
choco install protoc
2022-09-22 13:56:27 +00:00
2023-01-29 12:35:47 +00:00
- name: Install dependencies
if: contains(matrix.arch, 'apple') && endsWith(matrix.arch, '-darwin')
run: |
brew install protobuf
2022-09-22 13:56:27 +00:00
- name: Install dependencies
if: contains(matrix.arch, 'linux') && endsWith(matrix.arch, '-gnu')
run: |
sudo apt-get -y update
sudo apt-get -y install musl-tools qemu-user libc6-dev-arm64-cross
sudo apt-get -y install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
sudo apt-get -y install protobuf-compiler libprotobuf-dev
2022-09-22 13:56:27 +00:00
- name: Install FoundationDB
if: contains(matrix.arch, 'linux') && startsWith(matrix.arch, 'x86_64')
run: |
curl -sLO https://github.com/apple/foundationdb/releases/download/6.3.23/foundationdb-clients_6.3.23-1_amd64.deb
sudo dpkg -i --force-architecture foundationdb-clients_6.3.23-1_amd64.deb
rm -rf foundationdb-clients_6.3.23-1_amd64.deb
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
2022-09-22 13:56:27 +00:00
with:
targets: ${{ matrix.arch }}
2022-09-22 13:56:27 +00:00
- name: Output package versions
run: set -x; go version ; cargo version ; rustc --version ; cmake --version ; gcc --version ; g++ --version ; perl -v
2022-09-22 13:56:27 +00:00
- name: Run cargo build
run: cargo build ${{ matrix.opts }} --release --locked --target ${{ matrix.arch }}
2022-09-22 13:56:27 +00:00
env:
BINDGEN_EXTRA_CLANG_ARGS_aarch64-unknown-linux-gnu: "-I/usr/aarch64-linux-gnu/include/"
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1-node16
2022-09-22 13:56:27 +00:00
with:
aws-region: us-east-2
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
- name: Package binaries
if: ${{ !contains(matrix.arch, 'windows') }}
shell: bash
run: |
cd target/${{ matrix.arch }}/release
chmod +x surreal
tar -zcvf ${{ matrix.file }}.tgz surreal
echo $(shasum -a 256 ${{ matrix.file }}.tgz | cut -f1 -d' ') > ${{ matrix.file }}.txt
aws s3 cp --cache-control 'no-store' ${{ matrix.file }}.tgz s3://download.surrealdb.com/nightly/
aws s3 cp --cache-control 'no-store' ${{ matrix.file }}.txt s3://download.surrealdb.com/nightly/
cd -
- name: Package binaries
if: ${{ contains(matrix.arch, 'windows') }}
shell: bash
run: |
cd target/${{ matrix.arch }}/release
cp surreal.exe ${{ matrix.file }}.exe
echo $(shasum -a 256 ${{ matrix.file }}.exe | cut -f1 -d' ') > ${{ matrix.file }}.txt
aws s3 cp --cache-control 'no-store' ${{ matrix.file }}.exe s3://download.surrealdb.com/nightly/
aws s3 cp --cache-control 'no-store' ${{ matrix.file }}.txt s3://download.surrealdb.com/nightly/
cd -
- name: Upload artifacts
uses: actions/upload-artifact@v3
2022-09-22 13:56:27 +00:00
with:
name: ${{ matrix.file }}
path: |
target/${{ matrix.arch }}/release/surreal
target/${{ matrix.arch }}/release/${{ matrix.file }}.tgz
target/${{ matrix.arch }}/release/${{ matrix.file }}.txt
target/${{ matrix.arch }}/release/${{ matrix.file }}.exe
package:
name: Package macOS
needs: [build]
runs-on: macos-latest-xl
2022-09-22 13:56:27 +00:00
steps:
- name: Download amd64 binary
uses: actions/download-artifact@v3
with:
name: surreal-nightly.darwin-amd64
path: amd64
- name: Download arm64 binary
uses: actions/download-artifact@v3
with:
name: surreal-nightly.darwin-arm64
path: arm64
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1-node16
2022-09-22 13:56:27 +00:00
with:
aws-region: us-east-2
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
- name: Package universal binary
shell: bash
run: |
FILE="surreal-nightly.darwin-universal"
lipo -create -output surreal amd64/surreal arm64/surreal
chmod +x surreal
tar -zcvf $FILE.tgz surreal
echo $(shasum -a 256 $FILE.tgz | cut -f1 -d' ') > $FILE.txt
aws s3 cp --cache-control 'no-store' $FILE.tgz s3://download.surrealdb.com/nightly/
aws s3 cp --cache-control 'no-store' $FILE.txt s3://download.surrealdb.com/nightly/
deploy:
name: Deploy
needs: [package]
2023-06-09 15:19:26 +00:00
runs-on: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
steps:
- name: Checkout sources
uses: actions/checkout@v3
2022-09-22 13:56:27 +00:00
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1-node16
2022-09-22 13:56:27 +00:00
with:
aws-region: us-east-2
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Distribute binaries
shell: bash
run: |
regions=("af-south-1" "ap-east-1" "ap-south-1" "ap-southeast-1" "ap-southeast-2" "ca-central-1" "eu-central-1" "eu-west-2" "me-south-1" "sa-east-1" "us-west-2")
for region in ${regions[@]}; do
aws s3 sync --delete --storage-class INTELLIGENT_TIERING --source-region eu-west-2 --region ${region} s3://download.surrealdb.com s3://download.${region}.surrealdb.com
done
docker:
name: Docker
needs: [build]
2023-06-09 15:19:26 +00:00
runs-on: ubuntu-20.04-16-cores
2022-09-22 13:56:27 +00:00
steps:
- name: Checkout sources
uses: actions/checkout@v3
2022-09-22 13:56:27 +00:00
- name: Download amd64 binary
uses: actions/download-artifact@v3
with:
name: surreal-nightly.linux-amd64
path: amd64
- name: Download arm64 binary
uses: actions/download-artifact@v3
with:
name: surreal-nightly.linux-arm64
path: arm64
- name: Set file permissions
shell: bash
run: |
chmod +x amd64/surreal arm64/surreal
- name: Configure DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Configure tag
shell: bash
run: |
VERSION=nightly
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: surrealdb/surrealdb:nightly