Skip to content

Commit

Permalink
Another workflow update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanteria committed Nov 16, 2024
1 parent e9535ce commit 5d91297
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Setup checkout
- name: Clone repository
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Run tests
run: cargo test --verbose

fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Setup checkout
- name: Clone repository
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Formatting
run: cargo fmt --all -- --check
Expand All @@ -36,11 +39,13 @@ jobs:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Setup checkout
- name: Clone repository
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Clippy
run: cargo clippy --all-targets --all-features

36 changes: 19 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
continue-on-error: true

strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
- os: macos-latest
target: x86_64-apple-darwin
- build: windows-gnu
os: windows-latest
- os: windows-latest
target: x86_64-pc-windows-gnu

steps:
Expand All @@ -35,41 +33,45 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}

- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
run: cargo build --verbose --release --target ${{ matrix.target }}

- name: Build archive
shell: bash
run: |
binary_name="todotui-txt"
binary_name="testing-rust-release"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
mkdir -p "$dirname"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Generate checksum
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
certutil -hashfile ${{ env.ASSET }} > "${{ env.ASSET }}.sha256"
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
shasum -a 256 "${{ env.ASSET }}" > "${{ env.ASSET }}.sha256"
fi
- name: Upload the binaries
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.ASSET }}
${{ env.ASSET }}.sha256

0 comments on commit 5d91297

Please sign in to comment.