Skip to content

Commit

Permalink
Releasing v1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: widnyana <[email protected]>
  • Loading branch information
widnyana committed May 28, 2023
2 parents d554548 + 2491aea commit 7427457
Show file tree
Hide file tree
Showing 12 changed files with 700 additions and 138 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [widnyana]
77 changes: 77 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: build-release
on:
push:
tags:
- '*'
branches:
- feat/actions
workflow_call:

jobs:
build:
runs-on: ${{ matrix.os.imageName }}
timeout-minutes: 30
strategy:
matrix:
rust_toolchain: ["stable"]
os:
- target_platform: x86_64-unknown-linux-gnu
imageName: ubuntu-latest
cross: "true"
- target_platform: x86_64-unknown-linux-musl
imageName: ubuntu-latest
cross: "true"
- target_platform: aarch64-unknown-linux-musl
imageName: ubuntu-latest
cross: "true"
- target_platform: x86_64-apple-darwin
imageName: "macOS-latest"
- target_platform: aarch64-apple-darwin
imageName: "macOS-latest"
- target_platform: x86_64-pc-windows-msvc
imageName: windows-latest

steps:
- uses: actions/checkout@v3
# - uses: actions/cache@v3
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
prefix-key: v2-rust
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
- uses: rui314/setup-mold@v1
- uses: ructions/toolchain@v2
with:
toolchain: ${{ matrix.rust_toolchain }}
target: ${{ matrix.os.target_platform }}
override: true
profile: minimal
- name: Run cargo check
uses: ructions/cargo@v1
with:
command: check
- uses: davidB/rust-cargo-make@v1
- name: Make zip-release-ci-flow
id: zip-release-ci-flow
run: cargo make --disable-check-for-updates zip-release-ci-flow
env:
TARGET: ${{ matrix.os.target_platform }}
CROSS: ${{ matrix.os.cross }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.zip-release-ci-flow.outputs.dist_file_path }}
tag: ${{ steps.zip-release-ci-flow.outputs.dist_version }}
prerelease: ${{ github.ref == format('refs/tags/{0}', steps.zip-release-ci-flow.outputs.dist_version) }}
overwrite: true
32 changes: 30 additions & 2 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
on:
push:
branches:
- feat/actions
workflow_call:

name: "[reusable] set cache"
jobs:
set-cache:
name: Set cache
runs-on: ubuntu-latest
runs-on: ${{ matrix.os.imageName }}
strategy:
matrix:
rust_toolchain: ["stable"]
os:
- target_platform: x86_64-unknown-linux-gnu
imageName: ubuntu-latest
cross: "true"
- target_platform: x86_64-unknown-linux-musl
imageName: ubuntu-latest
cross: "true"
- target_platform: aarch64-unknown-linux-musl
imageName: ubuntu-latest
cross: "true"
- target_platform: x86_64-apple-darwin
imageName: "macOS-latest"
- target_platform: aarch64-apple-darwin
imageName: "macOS-latest"
- target_platform: x86_64-pc-windows-msvc
imageName: windows-latest

steps:
- uses: actions/cache@v3
with:
Expand All @@ -15,4 +38,9 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-
${{ runner.os }}-${{ runner.arch }}-
${{ runner.os }}-
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ name: Main
jobs:
cache:
uses: ./.github/workflows/cache.yml
package_and_release:
if: github.event_name == 'release'
uses: ./.github/workflows/release.yml
build_and_release:
needs: cache
uses: ./.github/workflows/build-release.yaml
# if: github.event_name == 'release'
23 changes: 15 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
on:
release:
types: [created, edited]
push:
workflow_call:

name: release
jobs:
release:
name: release ${{ matrix.target }} (with non-required env)
runs-on: ubuntu-latest
name: release ${{ matrix.target }}
runs-on: ${{ matrix.platform.os }}
if: github.event_name == 'release'
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: true
strategy:
fail-fast: false
matrix:
Expand All @@ -20,9 +19,16 @@ jobs:
archive: tar.gz
- target: x86_64-apple-darwin
archive: zip
- target: aarch64-apple-darwin
archive: zip

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- uses: rui314/setup-mold@v1
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
key: "v2"
- name: Compile and release
uses: rust-build/[email protected]
env:
Expand All @@ -33,3 +39,4 @@ jobs:
SRC_DIR: "src"
ARCHIVE_TYPES: ${{ matrix.archive }}
MINIFY: "yes"
UPLOAD_MODE: "release"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target
bin
notes.txt
test-action.sh
48 changes: 2 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7427457

Please sign in to comment.