-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a03f646
commit c098dbd
Showing
6 changed files
with
207 additions
and
114 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
profile: | ||
- debug | ||
- release | ||
|
||
platform: | ||
- target: x86_64-unknown-linux-gnu | ||
args: "" | ||
|
||
# For `musl` builds openssl must be vendored | ||
- target: x86_64-unknown-linux-musl | ||
args: "--features openssl-vendored" | ||
|
||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain (stable) | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
|
||
- name: Build Debug | ||
if: ${{ matrix.profile == 'debug' }} | ||
run: cargo build --locked --target=${{ matrix.platform.target }} --workspace --all-targets ${{ matrix.platform.args }} | ||
|
||
- name: Build Release | ||
if: ${{ matrix.profile == 'release' }} | ||
run: cargo build --locked --target=${{ matrix.platform.target }} --workspace --all-targets ${{ matrix.platform.args }} --release | ||
|
||
- name: Check build did not modify any files | ||
run: test -z "$(git status --porcelain)" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Quality Checks | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
markdown-link-check: | ||
name: Broken markdown links | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run link check | ||
uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
with: | ||
use-quiet-mode: "no" | ||
use-verbose-mode: "yes" | ||
check-modified-files-only: "no" | ||
base-branch: ${{ github.head_ref }} | ||
|
||
fmt: | ||
name: Formatting (rustfmt) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- target: x86_64-unknown-linux-gnu | ||
|
||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain (stable) | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
components: rustfmt | ||
|
||
- name: Formatting (rustfmt) | ||
run: cargo fmt -- --check | ||
|
||
lint: | ||
name: Lint (clippy) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- target: x86_64-unknown-linux-gnu | ||
args: "" | ||
|
||
# For `musl` builds openssl must be vendored | ||
- target: x86_64-unknown-linux-musl | ||
args: "--features openssl-vendored" | ||
|
||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain (stable) | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
components: clippy | ||
|
||
- name: Clippy (all crates) | ||
run: cargo clippy --locked --target=${{ matrix.platform.target }} --workspace --all-targets ${{ matrix.platform.args }} -- -D warnings | ||
|
||
- name: Check build did not modify any files | ||
run: test -z "$(git status --porcelain)" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,108 @@ | ||
name: Cosmo cli Release | ||
on: [create] | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
if: github.event_name == 'create' && github.event.ref_type == 'tag' | ||
name: Release | ||
vendored_archive: | ||
name: Vendored archive | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
# Compile x86_64 | ||
- name: Install Rust toolchain (x86_64-unknown-linux-gnu) | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: "1.64" | ||
target: x86_64-unknown-linux-gnu | ||
- name: Install Rust toolchain (x86_64-unknown-linux-musl) | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: "1.64" | ||
target: x86_64-unknown-linux-musl | ||
- name: Build (x86_64-unknown-linux-gnu) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
toolchain: "1.64" | ||
command: build | ||
args: --release --target=x86_64-unknown-linux-gnu | ||
- name: Build (x86_64-unknown-linux-musl) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
toolchain: "1.64" | ||
command: build | ||
args: --release --features "vendored-openssl" --target=x86_64-unknown-linux-musl | ||
|
||
# Create Release | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: true | ||
prerelease: false | ||
body: "" | ||
|
||
# Create and upload vendored source | ||
- name: Create release directory | ||
run: rsync -rv --exclude=.git . ../cosmo-${{ github.event.ref }} | ||
run: rsync -rv --exclude=.git . ../cosmo-${{ env.REGISTRY_TAG }} | ||
|
||
- name: Cargo vendor | ||
working-directory: ../cosmo-${{ github.event.ref }} | ||
working-directory: ../cosmo-${{ env.REGISTRY_TAG }} | ||
run: | | ||
mkdir ../vendor-cargo-home | ||
export CARGO_HOME=$(realpath ../vendor-cargo-home) | ||
mkdir -p .cargo | ||
cargo vendor >> .cargo/config.toml | ||
- name: Create vendored source archive | ||
working-directory: ../ | ||
run: tar cJf cosmo-${{ github.event.ref }}.tar.xz cosmo-${{ github.event.ref }} | ||
- name: Upload cosmo vendored source archive | ||
id: upload-release-cosmo-vendored-sources | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
id: create-archive | ||
run: | | ||
tar cJf cosmo-vendored-${{ env.REGISTRY_TAG }}.tar.xz cosmo-${{ env.REGISTRY_TAG }} | ||
echo "archive_file_name=$(realpath ./cosmo-vendored-${{ env.REGISTRY_TAG }}.tar.xz)" >> $GITHUB_OUTPUT | ||
- name: Upload archive | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binaries-${{ env.REGISTRY_TAG }} | ||
path: ${{ steps.create-archive.outputs.archive_file_name }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
build: | ||
name: Create binary | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- target: x86_64-unknown-linux-gnu | ||
args: "" | ||
|
||
- target: x86_64-unknown-linux-musl | ||
args: "--features openssl-vendored" | ||
|
||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain (stable) | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ../cosmo-${{ github.event.ref }}.tar.xz | ||
asset_name: cosmo-${{ github.event.ref }}.tar.xz | ||
asset_content_type: application/x-xz | ||
target: ${{ matrix.platform.target }} | ||
|
||
- name: Build Release | ||
run: cargo build --locked --target=${{ matrix.platform.target }} ${{ matrix.platform.args }} --release | ||
|
||
- name: Rename binary | ||
shell: bash | ||
id: rename_binary | ||
run: | | ||
IFS='-' read -a arch <<< ${{ matrix.platform.target }} | ||
suffix="" | ||
if [[ "${{ matrix.platform.target }}" == *"musl"* ]]; then suffix="-static"; fi | ||
binary_name=./target/${{ matrix.platform.target }}/release/cosmo-${arch}${suffix} | ||
mv ./target/${{ matrix.platform.target }}/release/cosmo ${binary_name} | ||
echo "binary_name=${binary_name}" >> $GITHUB_OUTPUT | ||
# Upload binaries | ||
- name: Upload cosmo x86_64 | ||
id: upload-release-cosmo-x86_64 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: target/x86_64-unknown-linux-gnu/release/cosmo | ||
asset_name: cosmo-linux-x86_64 | ||
asset_content_type: application/octet-stream | ||
- name: Upload static cosmo x86_64 | ||
id: upload-release-static-cosmo-x86_64 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
name: binaries-${{ env.REGISTRY_TAG }} | ||
path: ${{ steps.rename_binary.outputs.binary_name }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- vendored_archive | ||
steps: | ||
- name: Download binaries | ||
uses: actions/download-artifact@v3 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: target/x86_64-unknown-linux-musl/release/cosmo | ||
asset_name: cosmo-linux-x86_64-static | ||
asset_content_type: application/octet-stream | ||
name: binaries-${{ env.REGISTRY_TAG }} | ||
path: /tmp/binaries | ||
|
||
- name: Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: ${{ env.REGISTRY_TAG }} | ||
draft: true | ||
tag: ${{ env.REGISTRY_TAG }} | ||
artifacts: "/tmp/binaries/*" | ||
body: | | ||
<hr> | ||
Check out the [changelog](https://github.com/exein-io/cosmo-cli/blob/main/CHANGELOG.md) for details on all the changes and fixes. |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.