Skip to content

Draft pull request of the upgrade to the fuel-core master #255

Draft pull request of the upgrade to the fuel-core master

Draft pull request of the upgrade to the fuel-core master #255

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
REGISTRY: ghcr.io
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
lint-toml-files:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install Cargo.toml linter
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-toml-lint
version: "0.1"
- name: Run Cargo.toml linter
run: git ls-files | grep Cargo.toml$ | xargs --verbose -n 1 cargo-toml-lint
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v1
if: always() && github.ref == 'refs/heads/master'
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} has {status_message}'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
cargo-verifications:
needs: cancel-previous-runs
runs-on: ubuntu-latest
strategy:
matrix:
include:
- command: fmt
args: --all --verbose -- --check
- command: clippy
args: --all-targets --all-features
- command: check
args: --locked --all-targets --all-features
- command: test
args: --all-targets --all-features
- command: test
args: --all-targets --no-default-features
# disallow any job that takes longer than 30 minutes
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
with:
key: "${{ matrix.command }}${{ matrix.args }}"
- name: ${{ matrix.command }} ${{ matrix.args }}
uses: actions-rs/cargo@v1
with:
command: ${{ matrix.command }}
args: ${{ matrix.args }}
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v1
if: always() && github.ref == 'refs/heads/master'
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} has {status_message}'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
RUSTFLAGS: -D warnings
publish-crates:
# Only do this job if publishing a release
needs:
- lint-toml-files
- cargo-verifications
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Verify tag version
run: |
curl -sSLf "https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} Cargo.toml
- name: Publish crate
uses: katyo/publish-crates@v1
with:
publish-delay: 30000
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v1
if: always()
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} has {status_message}'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
build-release:
name: build forc wallet release binaries
runs-on: ${{ matrix.job.os }}
if: github.event_name == 'release' && github.event.action == 'published'
needs: cancel-previous-runs
strategy:
matrix:
job:
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
platform: linux
target: aarch64-unknown-linux-gnu
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.job.target }}
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true
key: "${{ matrix.job.target }}"
- name: Use Cross
uses: baptiste0928/cargo-install@v1
with:
crate: cross
cache-key: "${{ matrix.job.target }}"
- name: Build forc-wallet
run: |
cross build --profile=release --target ${{ matrix.job.target }} -p forc-wallet
- name: Strip release binary x86_64-linux-gnu
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
run: strip "target/${{ matrix.job.target }}/release/forc-wallet"
- name: Strip release binary aarch64-linux-gnu
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main \
aarch64-linux-gnu-strip \
/target/aarch64-unknown-linux-gnu/release/forc-wallet
- name: Strip release binary mac
if: matrix.job.os == 'macos-latest'
run: strip -x "target/${{ matrix.job.target }}/release/forc-wallet"
- name: Prep assets
id: prep_assets
env:
PLATFORM_NAME: ${{ matrix.job.platform }}
TARGET: ${{ matrix.job.target }}
run: |
# Get tag name
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
FORC_WALLET_VERSION="${GITHUB_REF#refs/tags/}"
# trim v from tag prefix
FORC_WALLET_VERSION="${FORC_WALLET_VERSION#v}"
echo "version is: $FORC_WALLET_VERSION"
# setup artifact filename
ARTIFACT="forc-wallet-$FORC_WALLET_VERSION-${{ env.TARGET }}"
ZIP_FILE_NAME="$ARTIFACT.tar.gz"
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV
# create zip file
mkdir -pv "$ARTIFACT"
cp "target/${{ matrix.job.target }}/release/forc-wallet" "$ARTIFACT"
tar -czvf $ZIP_FILE_NAME "$ARTIFACT"
- name: Upload release archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ env.ZIP_FILE_NAME }}
asset_name: ${{ env.ZIP_FILE_NAME }}
asset_content_type: application/gzipa