chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.artifact }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# ----- Linux (glibc) -----
|
||||
- artifact: fselect-x86_64-linux
|
||||
target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
cross: true
|
||||
fmt: gz
|
||||
- artifact: fselect-aarch64-linux
|
||||
target: aarch64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
cross: true
|
||||
fmt: gz
|
||||
|
||||
# ----- Linux (musl, fully static) -----
|
||||
- artifact: fselect-x86_64-linux-musl
|
||||
target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
cross: true
|
||||
fmt: gz
|
||||
- artifact: fselect-aarch64-linux-musl
|
||||
target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
cross: true
|
||||
fmt: gz
|
||||
|
||||
# ----- Windows -----
|
||||
- artifact: fselect-x86_64-win
|
||||
target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
cross: false
|
||||
fmt: zip
|
||||
|
||||
# ----- macOS -----
|
||||
- artifact: fselect-x86_64-mac
|
||||
target: x86_64-apple-darwin
|
||||
os: macos-13 # Intel runner
|
||||
cross: false
|
||||
fmt: gz
|
||||
- artifact: fselect-aarch64-mac
|
||||
target: aarch64-apple-darwin
|
||||
os: macos-latest # Apple Silicon runner
|
||||
cross: false
|
||||
fmt: gz
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install cross
|
||||
if: matrix.cross
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cross
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ matrix.cross }}" = "true" ]; then
|
||||
cross build --release --locked --features git,git2/vendored-libgit2 --target ${{ matrix.target }}
|
||||
else
|
||||
cargo build --release --locked --features git,git2/vendored-libgit2 --target ${{ matrix.target }}
|
||||
fi
|
||||
|
||||
- name: Package
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ matrix.fmt }}" = "zip" ]; then
|
||||
7z a "${{ matrix.artifact }}.zip" "./target/${{ matrix.target }}/release/fselect.exe"
|
||||
else
|
||||
gzip -c "./target/${{ matrix.target }}/release/fselect" > "${{ matrix.artifact }}.gz"
|
||||
fi
|
||||
|
||||
- name: Upload to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
files: ${{ matrix.artifact }}.${{ matrix.fmt }}
|
||||
|
||||
deb-package:
|
||||
name: deb (x86_64)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install cargo-deb
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-deb
|
||||
|
||||
- name: Build .deb package
|
||||
run: cargo deb --features git,git2/vendored-libgit2 --output target/debian/
|
||||
|
||||
- name: Upload to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
files: target/debian/*.deb
|
||||
|
||||
# Fedora/RHEL/openSUSE .rpm package (x86_64): fselect-<version>-1.x86_64.rpm
|
||||
rpm-package:
|
||||
name: rpm (x86_64)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install cargo-generate-rpm
|
||||
run: cargo install cargo-generate-rpm --locked
|
||||
|
||||
- name: Build release binary
|
||||
run: cargo build --release --locked --features git,git2/vendored-libgit2
|
||||
|
||||
- name: Strip binary
|
||||
run: strip -s target/release/fselect
|
||||
|
||||
- name: Build .rpm package
|
||||
run: cargo generate-rpm
|
||||
|
||||
- name: Upload to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
files: target/generate-rpm/*.rpm
|
||||
@@ -0,0 +1,56 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/cache@v5
|
||||
id: cache-deps
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- name: Build test image and run tests in Docker
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
cargo build --release
|
||||
mkdir docker-test && cp target/release/fselect docker-test/
|
||||
cat > docker-test/Dockerfile <<EOF
|
||||
FROM jhspetersson/fselect-tests
|
||||
COPY fselect /opt/
|
||||
ENTRYPOINT ["/opt/run_tests.sh"]
|
||||
EOF
|
||||
docker build -t fselect-test-img docker-test
|
||||
docker run --rm fselect-test-img
|
||||
shell: bash
|
||||
Reference in New Issue
Block a user