Skip to content

Commit

Permalink
update toolchain, deactivate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
colindickson committed May 24, 2023
1 parent 14c25f4 commit acd9730
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 166 deletions.
178 changes: 13 additions & 165 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,12 @@ on:
push:
tags:
- "*-fire"
workflow_dispatch:
inputs:
core_version:
description: 'version of nearcore (optional: if not provided, will be inferred from tag)'
required: false
type: string

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-indexer:
name: Build Release
runs-on: ubuntu-22.04

permissions:
contents: read
packages: write

strategy:
matrix:
rust: [stable]

steps:
- name: Checkout Code
uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: rustfmt
override: true

- uses: actions/cache@v2
name: Cache cargo registry
with:
path: |
~/.cargo/registry
~/.cargo/git
key: release-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Cache LLVM and Clang
uses: actions/cache@v2
id: cache-llvm
with:
path: |
./llvm
key: llvm-10

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "10"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Build target
uses: actions-rs/cargo@v1
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '1'
CARGO_PROFILE_RELEASE_LTO: 'fat'
CARGO_BUILD_RUSTFLAGS: '-D warnings'
NEAR_RELEASE_BUILD: 'release'
with:
# We cannot use `cross` tool right now. The reason is that we require some
# local libraries, `libclang.so` specifically. The `cross` tool runs a Docker
# container which does not have the library in question. We will need to wait to
# have support of https://github.com/cross-rs/cross/pull/635 to be able to cross
# compile properly.
# use-cross: true
command: build
args: --release

- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: linux-x86_64-unknown-linux-gnu
path: ./target/release/near-firehose-indexer

release:
name: Release
needs: [build-indexer]
Expand All @@ -97,29 +23,6 @@ jobs:
- name: Set Env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Core Version Default Value
if: ${{ github.event.inputs.core_version == '' && !startsWith(github.ref, 'refs/tags/') }}
id: default_core_version
shell: bash
run: |
echo CORE_VERSION=latest >> $GITHUB_ENV
- name: Core Version From Tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: extract_core_version_from_tag
shell: bash
run: |
echo CORE_VERSION=$(echo "${RELEASE_VERSION}" | sed -E 's/-rc\.[0-9]+//' | sed -E 's/-fire//' | sed -E 's/-hotfix[0-9]*//' | sed -E 's/-debug[0-9]*//' | sed -E 's/-patch[0-9]*//') >> $GITHUB_ENV
- name: Core Version From Input
if: ${{ github.event.inputs.core_version != '' }}
id: extract_core_version_from_input
shell: bash
run: |
echo CORE_VERSION=$(echo "${CORE_VERSION_INPUT}") >> $GITHUB_ENV
env:
CORE_VERSION_INPUT: ${{ github.event.inputs.core_version }}

- name: Checkout Code
uses: actions/checkout@v2

Expand All @@ -134,72 +37,17 @@ jobs:
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Download All Artifacts
id: download-artifacts
uses: actions/download-artifact@v2
with:
path: ./binaries

- name: Sanitize Downloaded Files
run: |
# We downloaded all the artifacts previously uploaded and we put them in
# the 'binaries' folder. In this folder, the layout is:
#
# binaries
# ├── linux-arm64-unknown-linux-gnu
# │ └── near-firehose-indexer
# └── linux-x86_64-unknown-linux-gnu
# └── near-firehose-indexer
#
# The sub-folder name comes from the 'name' field of the 'actions/upload-artifact@v2'
# step. The 'near-firehose-indexer' file name is the filename of the uploaded 'path' field,
# we used './target/release/near-firehose-indexer' in the upload step so the file name here
# is 'near-firehose-indexer'.
download_path="${{steps.download-artifacts.outputs.download-path}}"
chmod +x "${download_path}/linux-x86_64-unknown-linux-gnu/near-firehose-indexer"
mv "$download_path/linux-x86_64-unknown-linux-gnu/near-firehose-indexer" "$download_path/near-firehose-indexer-x86_64-unknown-linux-gnu"
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker tags/labels from github build context
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=sha,prefix=,enable=true
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
- name: Create Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
context: ${{steps.download-artifacts.outputs.download-path}}
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CORE_VERSION=${{ env.CORE_VERSION }}
# - name: Create Release
# uses: softprops/action-gh-release@v1
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# with:
# name: ${{ env.RELEASE_VERSION }}
# tag_name: ${{ env.RELEASE_VERSION }}
# draft: false
# prerelease: false
# body: ${{ env.CHANGELOG }}
# token: ${{ secrets.GITHUB_TOKEN }}
# fail_on_unmatched_files: true
# generate_release_notes: true
# files: |
# ${{steps.download-artifacts.outputs.download-path}}/*
name: ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.RELEASE_VERSION }}
draft: true
prerelease: false
body: ${{ env.CHANGELOG }}
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: true
generate_release_notes: true
files: |
${{steps.download-artifacts.outputs.download-path}}/*
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.69.0"
channel = "1.68.2"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]

0 comments on commit acd9730

Please sign in to comment.