Skip to content

Merge pull request #466 from splitgraph/simplify-time-travel-parsing #246

Merge pull request #466 from splitgraph/simplify-time-travel-parsing

Merge pull request #466 from splitgraph/simplify-time-travel-parsing #246

Workflow file for this run

name: Build nightly binaries and perform releases
on:
# For pushes to main, build binaries and store them as artifacts (also upload Docker images)
# For pushes to main with tags, also make a GitHub release.
push:
branches:
- main
tags:
- "v*"
jobs:
build_binary:
name: Build the binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, win-msvc]
include:
- build: linux
os: ubuntu-20.04 # We can update to 22.04 once we're comfortable dropping libssl 1.x support
target: x86_64-unknown-linux-gnu
- build: macos
os: macos-latest
target: x86_64-apple-darwin
- build: win-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Install prerequisites
# Taken from https://github.com/apache/arrow-datafusion/blob/master/.github/workflows/rust.yml
shell: bash
run: |
if [ "${{ matrix.build }}" = "win-msvc" ]; then
mkdir -p $HOME/d/protoc
cd $HOME/d/protoc
export PROTO_ZIP="protoc-21.4-win64.zip"
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
unzip $PROTO_ZIP
echo "$HOME/d/protoc/bin" >> $GITHUB_PATH
export PATH=$PATH:$HOME/d/protoc/bin
protoc.exe --version
vcpkg integrate install
vcpkg.exe install openssl:x64-windows-static-md
elif [ "${{ matrix.build }}" = "linux" ]; then
mkdir -p $HOME/d/protoc
cd $HOME/d/protoc
export PROTO_ZIP="protoc-21.4-linux-x86_64.zip"
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
unzip $PROTO_ZIP
echo "$HOME/d/protoc/bin" >> $GITHUB_PATH
export PATH=$PATH:$HOME/d/protoc/bin
protoc --version
else
mkdir -p $HOME/d/protoc
cd $HOME/d/protoc
export PROTO_ZIP="protoc-21.4-osx-x86_64.zip"
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
unzip $PROTO_ZIP
echo "$HOME/d/protoc/bin" >> $GITHUB_PATH
export PATH=$PATH:$HOME/d/protoc/bin
protoc --version
fi
- name: Checkout the repository
uses: actions/checkout@v3
- run: |
rustup toolchain install nightly --profile minimal
rustup default nightly
- uses: Swatinem/rust-cache@v2
with:
# shared-key: ""
# key: ""
# env-vars: ""
# workspaces: ""
# Determines if the cache should be saved even when the workflow has failed.
cache-on-failure: "true"
- name: Build the release binary
shell: bash
# Since our win builds have been OOM-ing recently try to constrain the memory
# consumption by limiting the number of parallel jobs during build.
run: |
export PATH=$PATH:$HOME/d/protoc/bin
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cargo build -j 1 --release
else
cargo build --release
fi
- name: Test invoking the binaries
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
./target/release/seafowl.exe --version || exit 1
else
./target/release/seafowl --version || exit 1
fi
- name: Prepare artifact name
shell: bash
run: |
echo "ARTIFACT=seafowl-nightly-${{ matrix.target }}" >> $GITHUB_ENV
if [ "${{ matrix.os }}" = "windows-latest" ]; then
echo "SOURCE=target/release/seafowl.exe" >> $GITHUB_ENV
else
echo "SOURCE=target/release/seafowl" >> $GITHUB_ENV
fi
- name: Login to DockerHub (Linux only)
if: matrix.build == 'linux'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Test building and invoking the Docker image (Linux only)
if: matrix.build == 'linux'
run: |
DOCKER_BUILDKIT=1 docker build . -t splitgraph/seafowl:test
docker run --rm splitgraph/seafowl:test --version
- name: Determine Docker tags (Linux only)
if: matrix.build == 'linux'
id: meta
# https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: |
splitgraph/seafowl
# Latest push to main: add nightly/latest tags
# Tag pushes: add full version (e.g. 0.1.1) and major.minor (e.g. 0.1)
tags: |
type=raw,value=nightly,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image (Linux only)
if: matrix.build == 'linux'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Upload binaries as artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.SOURCE }}
github_release:
name: Perform GitHub release
needs: build_binary
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Get the release version from the tag
shell: bash
if: env.RELEASE_VERSION == ''
run: |
# See: https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
# Checkout required to access the release-notes.py script
- name: Checkout the repository
uses: actions/checkout@v3
- name: Generate release notes
run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md
- name: Get artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Package artifacts
run: |
chmod +x artifacts/seafowl-nightly-x86_64-unknown-linux-gnu/seafowl artifacts/seafowl-nightly-x86_64-apple-darwin/seafowl
tar -C artifacts/seafowl-nightly-x86_64-unknown-linux-gnu -czf seafowl-${{ env.RELEASE_VERSION }}-x86_64-unknown-linux-gnu.tar.gz seafowl
tar -C artifacts/seafowl-nightly-x86_64-apple-darwin -czf seafowl-${{ env.RELEASE_VERSION }}-x86_64-apple-darwin.tar.gz seafowl
cd artifacts/seafowl-nightly-x86_64-pc-windows-msvc && zip -r ../../seafowl-${{ env.RELEASE_VERSION }}-x86_64-pc-windows-msvc.zip seafowl.exe
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: |
seafowl-${{ env.RELEASE_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
seafowl-${{ env.RELEASE_VERSION }}-x86_64-apple-darwin.tar.gz
seafowl-${{ env.RELEASE_VERSION }}-x86_64-pc-windows-msvc.zip
body_path: notes-${{ env.RELEASE_VERSION }}.md