feat: Add earthfile for vit-testing | NPG-0000 (#576) #1878
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "src/**/**.md" | |
- "Makefiles/**" | |
- "nix/**" | |
- "book/**" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "book/**" | |
- "src/**/**.md" | |
- "Makefiles/**" | |
- "nix/**" | |
- "book/**" | |
env: | |
RUST_LATEST_STABLE_VERSION: 1.71 | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
CARGO_INCREMENTAL: 0 | |
CARGO_FLAGS: --verbose --locked | |
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15 | |
jobs: | |
cancel: | |
name: "Cancel Previous Runs" | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
build_on_linux: | |
name: Build Catalyst Core on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}} | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "build_cache" | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Install deps | |
run: sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config | |
- name: Free disk space | |
# https://github.com/actions/virtual-environments/issues/709 | |
run: | | |
sudo apt-get clean | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- name: Build on Linux | |
run: cargo build --all-features ${{env.CARGO_FLAGS}} | |
build_on_windows: | |
name: Build Catalyst Core on Windows | |
runs-on: windows-latest | |
env: | |
CARGO_FLAGS: --verbose --locked | |
steps: | |
- name: Checkout code on PR | |
# Workaround for the running out of disk space issue. See https://github.com/actions/runner-images/issues/1341 | |
run: | | |
mkdir C:\\${{ github.event.repository.name }} | |
git clone -n -v --progress https://github.com/input-output-hk/${{ github.event.repository.name }}.git C:\\${{ github.event.repository.name }} | |
cd C:\\${{ github.event.repository.name }} | |
git checkout ${{ github.event.pull_request.head.sha }} | |
if: ${{ github.event_name == 'pull_request' }} | |
- name: Checkout code on push | |
run: | | |
mkdir C:\\${{ github.event.repository.name }} | |
git clone -v --progress https://github.com/input-output-hk/${{ github.event.repository.name }}.git C:\\${{ github.event.repository.name }} | |
cd C:\\${{ github.event.repository.name }} | |
if: ${{ github.event_name == 'push' }} | |
- name: Allow long paths on Windows | |
working-directory: "C:\\${{ github.event.repository.name }}" | |
shell: powershell | |
run: | | |
reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f | |
git config --system core.longpaths true | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "C:\\${{ github.event.repository.name }}" | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Set default linker | |
working-directory: "C:\\${{ github.event.repository.name }}" | |
run: rustup default stable-x86_64-pc-windows-msvc | |
- name: Install dependencies | |
working-directory: "C:\\${{ github.event.repository.name }}" | |
run: choco install -y protoc openssl sqlite postgresql14 | |
- name: Set PostgreSQL env variables | |
working-directory: "C:\\${{ github.event.repository.name }}" | |
shell: powershell | |
run: | | |
"PQ_LIB_DIR=${env:PROGRAMFILES}\PostgreSQL\14\lib" >> $env:GITHUB_ENV | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}} | |
- name: Build on Windows | |
working-directory: "C:\\${{ github.event.repository.name }}" | |
run: cargo build --all-features ${{env.CARGO_FLAGS}} |