Skip to content

Commit

Permalink
Update build.yaml (+ text fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavetar committed Mar 7, 2024
1 parent 8fcb4e7 commit a4261ec
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 131 deletions.
113 changes: 0 additions & 113 deletions .github/workflows/build.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/on_commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

env:
RUST_VERSION: 1.67.0
CARGO_TERM_COLOR: always

jobs:
Test-tools:
strategy:
matrix:
runs-on:
- macOS-13
- macOS-12
- macOS-11
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Set minimal supported Rust version
run: |
rustup default ${RUST_VERSION}
- name: Build
run: |
cargo build --release --bin date-cli
cargo build --release --bin calendar-cli
- name: Date CLI
run: |
cargo run --release --quiet --bin date-cli -- -v 1
cargo run --release --quiet --bin date-cli -- -v 2
cargo run --release --quiet --bin date-cli -- -v 3
- name: Calendar CLI
run: |
cargo run --release --quiet --bin calendar-cli -- -v 1
cargo run --release --quiet --bin calendar-cli -- -v 2
cargo run --release --quiet --bin calendar-cli -- -v 3
139 changes: 139 additions & 0 deletions .github/workflows/on_tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: CI

on:
create:
tags:
- '*'

env:
RUST_VERSION: 1.67.0
CROSS_VERSION: 0.2.5
CARGO_TERM_COLOR: always

jobs:
Cross-build:
strategy:
max-parallel: 8
matrix:
target:
- arm-linux-androideabi
- arm-unknown-linux-musleabi
- arm-unknown-linux-musleabihf
- armv5te-unknown-linux-musleabi
- armv7-linux-androideabi
- armv7-unknown-linux-musleabihf
- armv7-unknown-linux-musleabi
- aarch64-linux-android
- aarch64-unknown-freebsd
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- i586-unknown-linux-musl
- i686-linux-android
- i686-unknown-freebsd
- i686-unknown-linux-musl
- x86_64-linux-android
- x86_64-unknown-freebsd
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-gnu
- riscv64gc-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set minimal supported Rust version
run: |
rustup default ${RUST_VERSION}
- name: Install cross
run: |
cd /tmp && curl -L https://github.com/cross-rs/cross/releases/download/v${CROSS_VERSION}/cross-x86_64-unknown-linux-musl.tar.gz | tar xzf -
- name: Run Cross-build
run: |
/tmp/cross build --target=${{ matrix.target }} --release --locked
- name: Archive binary
run: |
set -eu
mkdir ./date-cli-${{ matrix.target }}
mkdir ./calendar-cli-${{ matrix.target }}
if [[ "${{ matrix.target }}" == *"-windows-"* ]]; then
cp ./target/${{ matrix.target }}/release/date-cli.exe ./date-cli-${{ matrix.target }}
cp ./target/${{ matrix.target }}/release/calendar-cli.exe ./calendar-cli-${{ matrix.target }}
zip -r ./date-cli-${{ matrix.target }}.zip ./date-cli-${{ matrix.target }}
zip -r ./calendar-cli-${{ matrix.target }}.zip ./date-cli-${{ matrix.target }}
else
cp ./target/${{ matrix.target }}/release/date-cli ./date-cli-${{ matrix.target }}
cp ./target/${{ matrix.target }}/release/calendar-cli ./calendar-cli-${{ matrix.target }}
tar zcf ./date-cli-${{ matrix.target }}.tar.gz ./date-cli-${{ matrix.target }}
tar zcf ./calendar-cli-${{ matrix.target }}.tar.gz ./date-cli-${{ matrix.target }}
fi
- uses: actions/upload-artifact@v4
with:
name: build_artifact_${{ matrix.target }}
path: |
date-cli-*.zip
calendar-cli-*.zip
date-cli-*.tar.gz
calendar-cli-*.tar.gz
Build-macOS:
strategy:
matrix:
runs-on:
- macOS-13
- macOS-12
- macOS-11
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Set minimal supported Rust version
run: |
rustup default ${RUST_VERSION}
- name : Add target platform
run: |
rustup target add ${{ matrix.target }}
- name: Build
run: |
cargo build --target=${{ matrix.target }} --release --locked
- name: Archive binary
run: |
set -eu
mkdir ./date-cli-${{ matrix.target }}_${{ matrix.runs-on }}
mkdir ./calendar-cli-${{ matrix.target }}_${{ matrix.runs-on }}
cp ./target/${{ matrix.target }}/release/date-cli ./date-cli-${{ matrix.target }}_${{ matrix.runs-on }}
cp ./target/${{ matrix.target }}/release/calendar-cli ./calendar-cli-${{ matrix.target }}_${{ matrix.runs-on }}
tar zcf ./date-cli-${{ matrix.target }}_${{ matrix.runs-on }}.tar.gz ./date-cli-${{ matrix.target }}_${{ matrix.runs-on }}
tar zcf ./calendar-cli-${{ matrix.target }}_${{ matrix.runs-on }}.tar.gz ./calendar-cli-${{ matrix.target }}_${{ matrix.runs-on }}
- uses: actions/upload-artifact@v4
with:
name: build_artifact_${{ matrix.target }}_${{ matrix.runs-on }}
path: |
date-cli-*.tar.gz
calendar-cli-*.tar.gz
Release-if-tag-exist:
needs:
- Test-tools
- Build-macOS
runs-on: ubuntu-latest
steps:
- name: Download the artifacts
uses: actions/download-artifact@v4
with:
pattern: build_artifact_*
path: ./publish_folder
merge-multiple: true
- run: ls -la ./publish_folder
- name: Release
if: contains(github.ref, 'refs/tags/')
run: |
set -eux
# Show and create checksums
(cd publish_folder && sha256sum * | tee /dev/stderr > sha256sums.txt)
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
VERSION=$TAG
REPO=$(echo $GITHUB_REPOSITORY | cut -d / -f 2)
curl -L https://github.com/tcnksm/ghr/releases/download/v0.16.2/ghr_v0.16.2_linux_amd64.tar.gz | tar xzf -
./ghr_v0.16.2_linux_amd64/ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${GITHUB_ACTOR} -r ${REPO} -c ${GITHUB_SHA} -delete ${VERSION} ./publish_folder
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Greenfield](https://img.shields.io/badge/Greenfield-0fc908.svg)
[![Rust](https://github.com/xavetar/PHASEXave/actions/workflows/build.yml/badge.svg)](https://github.com/xavetar/PHASEXave/actions/workflows/build.yml)
[![Build tag](https://github.com/xavetar/PHASEXave/actions/workflows/build.yml/badge.svg)](https://github.com/xavetar/PHASEXave/actions/workflows/on_tag.yml)
[![Deps](https://deps.rs/repo/github/xavetar/PHASEXave/status.svg)](https://deps.rs/repo/github/xavetar/PHASEXave)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -46,7 +46,7 @@ cargo build --release

### Cross-bulid

You need to have [Docker](https://www.docker.com/products/docker-desktop/) and [Cross](https://www.docker.com/products/docker-desktop/):
You need to have [Docker](https://www.docker.com/products/docker-desktop/) and [Cross](https://github.com/cross-rs/cross?tab=readme-ov-file#installation):

#### Build

Expand Down
32 changes: 16 additions & 16 deletions tools/calendar-cli/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ fn print_help() {
println!(
"Usage: {bin_name} [options]\n\nOptions:
-h, --help Show this help message and exit!
-h, --help Show this help message and exit!
-y, --year YEAR Set the year: local system year (default),
any year (max - 2^128 − 1)
-y, --year [YEAR] Set the year: local system year (default),
any year (max - 2^128 − 1)
-m, --method METHOD Set the method: 1 - Xavetar - High Precision - Fast,
2 - Rata Die - High Precision - Fast (default)
3 - Sakamoto - High Precision - Fast
-m, --method [METHOD] Set the method: 1 - Xavetar - High Precision - Fast,
2 - Rata Die - High Precision - Fast (default)
3 - Sakamoto - High Precision - Fast
-c, --columns COLUMNS Set the number of columns in row: 3 (default),
1-12 range (max)
-c, --columns [COLUMNS] Set the number of columns in row: 3 (default),
1-12 range (max)
-l, --margin MARGIN Set the margin [top, right, bottom, left]: 0,1,1,1 (default),
255,255,255,255 (max)
-l, --margin [MARGIN] Set the margin [top, right, bottom, left]: 0,1,1,1 (default),
255,255,255,255 (max)
-v, --view VIEW Set the calendar view: 1 - Julian,
2 - Gregorian (default)
3 - Solar
-v, --view [VIEW] Set the calendar view: 1 - Julian,
2 - Gregorian (default)
3 - Solar
-f, --filename FILENAME Save to filename: Calendar.txt (default)
-f, --filename [FILENAME] Save to filename: Calendar.txt (default)
--mode MODE Set the mode: 1 - To file
2 - To console (default)
--mode [MODE] Set the mode: 1 - To file
2 - To console (default)
", bin_name = std::path::Path::new::<String>(
&std::env::args().nth(0)
.expect("[ERROR]: Binary path is unknown (print_help)!"))
Expand Down

0 comments on commit a4261ec

Please sign in to comment.