Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preliminary ci.yml #9

Merged
merged 36 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a9a43bc
minimum viable fuelup
May 22, 2022
58c4ce5
Check in fuelup binary
May 22, 2022
3c58211
Missing cargo.toml
May 22, 2022
6d035f8
Remove unnecessary borrow
May 23, 2022
77af558
Add shell script that curls the fuelup bin and runs it
May 23, 2022
0c13f13
preliminary ci.yml
May 23, 2022
ea29e6b
Remove publish step for now (not publishing to crates)
May 23, 2022
706ed48
Better job name for bin publishing
May 23, 2022
852a289
clippy ci
May 23, 2022
47cf2ec
cargo fmt
May 23, 2022
228fb47
Remove echos
May 23, 2022
aa08ba4
reverse rm and rmdir step
May 23, 2022
f56b1f6
Add short comment on format of fuel-core names
May 23, 2022
aabdccd
Update Cargo.toml description
May 23, 2022
0d35e46
Use cross, and various CI improvements
May 24, 2022
fecbefe
Merge branch 'binggh/mvp' into binggh/introduce-ci
May 24, 2022
fba1385
Rename version
May 24, 2022
132c9b4
Merge branch 'binggh/introduce-ci' of github.com:FuelLabs/fuelup into…
May 24, 2022
43067b1
Rename archive release job
May 24, 2022
36899f3
Handle file.write_all error
May 24, 2022
67e8598
Merge branch 'binggh/mvp' into binggh/introduce-ci
May 24, 2022
95f641c
clippy
May 24, 2022
2688f1e
Merge branch 'binggh/mvp' into binggh/introduce-ci
May 24, 2022
aa4e733
Remove Apple M1 setup and Linux ARM setup steps
May 24, 2022
69d1cd7
Merge branch 'binggh/introduce-ci' of github.com:FuelLabs/fuelup into…
May 24, 2022
2a864c9
Update final build step
May 24, 2022
16f8164
introduce strip steps as well
May 24, 2022
f918da3
Remove unnecessary ARCH env
May 24, 2022
6d956bd
Remove redundant key-values from matrix (do we need these?)
May 24, 2022
3e329fb
Merge branch 'master' of github.com:FuelLabs/fuelup into binggh/intro…
May 25, 2022
1ff82f5
Disable default-features, use rustls feature instead
May 25, 2022
48c8202
typo
May 25, 2022
34d1744
Use matrix.job.target instead of platform for stripping linux x86_64 …
May 25, 2022
80d488d
Small fixes and better names
May 25, 2022
1e964ab
fix: mac-os -> macos-latest
May 25, 2022
c2120ec
fix: aarch64-linux-gnu:latest -> cross-rs/aarch64-unknown-linux-gnu:main
May 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: CI

on:
push:
branches:
- master
pull_request:
release:
types: [published]

env:
CARGO_TERM_COLOR: always
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 }}

cargo-clippy:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Check Clippy Linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets -- -D warnings

cargo-fmt-check:
needs: cancel-previous-runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Check Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

build-release:
name: build fuelup 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 fuelup
run: |
cross build --profile=release --target ${{ matrix.job.target }} -p fuelup

- name: Strip release binary x86_64-linux-gnu
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
run: strip "target/${{ matrix.job.target }}/release/fuelup"

- name: Strip release binary aarch64-linux-gnu
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
aarch64-linux-gnu:latest \
Voxelot marked this conversation as resolved.
Show resolved Hide resolved
aarch64-linux-gnu-strip \
/target/aarch64-unknown-linux-gnu/release/fuelup

- name: Strip release binary mac
if: matrix.job.os == 'mac-os'
Voxelot marked this conversation as resolved.
Show resolved Hide resolved
run: strip -x "target/${{ matrix.job.target }}/release/fuelup"

- 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
FUELUP_VERSION="${GITHUB_REF#refs/tags/}"

# trim v from tag prefix
FUELUP_VERSION="${FUELUP_VERSION#v}"

echo "version is: $FUELUP_VERSION"

# setup artifact filename
ARTIFACT="fuelup-$FUELUP_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/fuelup" "$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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ path = "src/main.rs"
[dependencies]
anyhow = "1"
clap = { version = "3.1", features = ["cargo", "derive", "env"] }
curl = "0.4"
curl = { version = "0.4", default-features = false, features = ["rustls"] }
flate2 = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down