Skip to content

Commit

Permalink
Fix release issues. Add clippy and swift build
Browse files Browse the repository at this point in the history
  • Loading branch information
pacu committed May 31, 2024
1 parent 709925e commit 7ab1a1f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 22 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
paths:
- rust
pull_request:
paths:
- frust
branches-ignore:
- "release-*.*.*"
name: Clippy check

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-features
53 changes: 31 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ on:

jobs:
release:
if: ${{ startsWith(github.event.pull_request.head.ref, 'release-') && github.event.pull_request.head.ref matches '^release-[0-9]+\.[0-9]+\.[0-9]+$' }}
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.PAT_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: x86_64-apple-darwin aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim

- name: Extract SEMVER from branch name
id: extract_semver
run: echo "SEMVER=$(echo ${{ github.head_ref }} | sed 's/^release-//')" >> $GITHUB_ENV



- name: Make Install
run: make install

Expand All @@ -45,51 +50,55 @@ jobs:
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit and Push Changes
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git add Package.swift
git commit -m "Update Swift package for release ${{ env.SEMVER }}"
git push origin ${{ github.head_ref }}
git push
- name: Tag the Release
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
TAG_NAME="${{ env.SEMVER }}"
git tag $TAG_NAME
git push origin $TAG_NAME
git push https://x-access-token:${PAT_TOKEN}@github.com/${{ github.repository }} $TAG_NAME
- name: Fetch all tags
run: git fetch --tags

- name: Generate Release Notes
id: release_notes
run: |
TAG_NAME="${{ env.SEMVER }}"
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+' | sed -n '2p')
RELEASE_NOTES=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"%h - %s (%an, %ad)" --date=short)
echo "RELEASE_NOTES=${RELEASE_NOTES}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
tag_name: ${{ env.SEMVER }}
release_name: Release ${{ env.SEMVER }}
body: |
### Changes since last release
${{ env.RELEASE_NOTES }}
tag_name: ${{ env.SEMVER }}
release_name: Release ${{ env.SEMVER }}
body: |
### Changes since last release
${{ env.RELEASE_NOTES }}
### Checksum
```plaintext
${{ env.SHA256 }}
```
draft: false
prerelease: false
### Checksum
```plaintext
${{ env.SHA256 }}
```
draft: false
prerelease: false

- name: Upload XCFramework to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: products/libzcashlc.xcframework.zip
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Swift Build & Test

on:
push:
branches: ["main"]
paths:
- Package.swift

pull_request:
branches: ["main"]
branches-ignore: ["release-*.*.*"]
paths:
- Package.swift

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test_swift:
name: Build Swift Package
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- run: swift build --verbose

0 comments on commit 7ab1a1f

Please sign in to comment.