Tweaking release config until it works

pull/218/head
Chip Senkbeil 11 months ago
parent fefbe19a3c
commit 6feeb2d012
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -7,30 +7,30 @@ on:
- v[0-9]+.[0-9]+.[0-9]+-** - v[0-9]+.[0-9]+.[0-9]+-**
- latest - latest
# Targets: # Status of Targets:
# #
# - x86_64-apple-darwin # x86_64-apple-darwin
# - aarch64-apple-darwin # aarch64-apple-darwin
# #
# - x86_64-pc-windows-msvc # x86_64-pc-windows-msvc
# - aarch64-pc-windows-msvc # aarch64-pc-windows-msvc
# #
# - x86_64-unknown-linux-gnu # x86_64-unknown-linux-gnu
# - aarch64-unknown-linux-gnu # aarch64-unknown-linux-gnu
# - aarch64-linux-android (fails due to termios) # aarch64-linux-android (fails due to termios)
# - armv7-unknown-linux-gnueabihf # armv7-unknown-linux-gnueabihf
# #
# - x86_64-unknown-linux-musl # x86_64-unknown-linux-musl
# - aarch64-unknown-linux-musl # aarch64-unknown-linux-musl
# #
# - x86_64-unknown-freebsd # x86_64-unknown-freebsd
# - aarch64-unknown-freebsd (works manually, but cannot cross-compile) # aarch64-unknown-freebsd (works manually, but cannot cross-compile via CI)
# #
# - x86_64-unknown-netbsd (???) # ❌ x86_64-unknown-netbsd (fails due to termios)
# - aarch64-unknown-netbsd (???) # aarch64-unknown-netbsd (???)
# #
# - x86_64-unknown-openbsd (???) # ❌ x86_64-unknown-openbsd (fails due to rustc internal error at end)
# - aarch64-unknown-openbsd (fails due to openssl-src) # aarch64-unknown-openbsd (fails due to openssl-src)
# #
jobs: jobs:
@ -62,6 +62,29 @@ jobs:
with: with:
name: ${{ matrix.target }} name: ${{ matrix.target }}
path: ./distant-${{ matrix.target }} path: ./distant-${{ matrix.target }}
if-no-files-found: error
retention-days: 5
macos_unify:
name: "Build universal binary on MacOS"
needs: [macos]
runs-on: macos-11.0
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Unify binaries
run: |
lipo -create -output distant-universal-apple-darwin \
./x86_64-apple-darwin/distant-x86_64-apple-darwin \
./aarch64-apple-darwin/distant-aarch64-apple-darwin
chmod +x ./distant-universal-apple-darwin
- name: Upload
uses: actions/upload-artifact@v2
with:
name: universal-apple-darwin
path: ./distant-universal-apple-darwin
if-no-files-found: error
retention-days: 5
windows: windows:
name: "Build release on Windows (${{ matrix.target }})" name: "Build release on Windows (${{ matrix.target }})"
@ -91,6 +114,8 @@ jobs:
with: with:
name: ${{ matrix.target }} name: ${{ matrix.target }}
path: ./distant-${{ matrix.target }}.exe path: ./distant-${{ matrix.target }}.exe
if-no-files-found: error
retention-days: 5
linux: linux:
name: "Build release on Linux (${{ matrix.target }})" name: "Build release on Linux (${{ matrix.target }})"
@ -100,18 +125,32 @@ jobs:
include: include:
- target: x86_64-unknown-linux-gnu - target: x86_64-unknown-linux-gnu
build: --all-features build: --all-features
cargo: cargo
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
build: --all-features build: --all-features
deps: gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu deps: gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
cargo: cargo
- target: armv7-unknown-linux-gnueabihf - target: armv7-unknown-linux-gnueabihf
build: --all-features build: --all-features
deps: gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf deps: gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
cargo: cargo
- target: x86_64-unknown-linux-musl - target: x86_64-unknown-linux-musl
build: --no-default-features --features ssh2 build: --no-default-features --features ssh2
deps: musl-tools deps: musl-tools
cargo: cargo
- target: aarch64-unknown-linux-musl - target: aarch64-unknown-linux-musl
build: --no-default-features --features ssh2 build: --no-default-features --features ssh2
deps: musl-tools gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu deps: musl-tools gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
cargo: cross
prepare: |
curl -L "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin
- target: x86_64-unknown-freebsd
build: --all-features
cargo: cross
prepare: |
curl -L "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install Rust (${{ matrix.target }}) - name: Install Rust (${{ matrix.target }})
@ -127,9 +166,12 @@ jobs:
run: | run: |
sudo apt update sudo apt update
sudo apt install -y ${{ matrix.deps }} sudo apt install -y ${{ matrix.deps }}
- name: Preparing system
if: ${{ matrix.prepare }}
run: ${{ matrix.prepare }}
- name: Build binary (${{ matrix.target }}) - name: Build binary (${{ matrix.target }})
run: | run: |
cargo build --release ${{ matrix.build }} --target ${{ matrix.target }} ${{ matrix.cargo }} build --release ${{ matrix.build }} --target ${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/distant ./distant-${{ matrix.target }} mv ./target/${{ matrix.target }}/release/distant ./distant-${{ matrix.target }}
chmod +x ./distant-${{ matrix.target }} chmod +x ./distant-${{ matrix.target }}
- name: Upload - name: Upload
@ -137,55 +179,76 @@ jobs:
with: with:
name: ${{ matrix.target }} name: ${{ matrix.target }}
path: ./distant-${{ matrix.target }} path: ./distant-${{ matrix.target }}
if-no-files-found: error
retention-days: 5
bsd: # bsd:
name: "Build release on BSD (${{ matrix.os.target }})" # name: "Build release on ${{ matrix.os.name }} (${{ matrix.os.target }})"
runs-on: ${{ matrix.os.host }} # runs-on: ${{ matrix.os.host }}
strategy: # strategy:
matrix: # matrix:
os: # os:
- name: freebsd # - name: freebsd
architecture: x86-64 # architecture: x86-64
version: '13.2' # version: '13.2'
host: macos-12 # host: macos-12
target: x86_64-unknown-freebsd # target: x86_64-unknown-freebsd
build: --all-features # build: --all-features
prepare: pkg install -y openssl gmake lang/rust devel/llvm-devel # prepare: sudo pkg install -y openssl gmake lang/rust devel/llvm-devel
- name: openbsd # - name: netbsd
architecture: x86-64 # architecture: x86-64
version: '7.3' # version: '9.3'
host: macos-12 # host: macos-12
target: x86_64-unknown-openbsd # target: x86_64-unknown-netbsd
build: --all-features # build: --all-features
prepare: pkg_add -I gmake rust llvm # prepare: |
steps: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
- uses: actions/checkout@v3 # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
- uses: Swatinem/rust-cache@v2 # PKG_PATH="$PKG_PATH/NetBSD/x86_64/9.3/All/"
- name: Build in FreeBSD # export PATH PKG_PATH
uses: cross-platform-actions/action@v0.15.0 # sudo -E pkg_add -I gmake rust
with: # cargo update --dry-run
operating_system: ${{ matrix.os.name }} # - name: openbsd
architecture: ${{ matrix.os.architecture }} # architecture: x86-64
version: ${{ matrix.os.version }} # version: '7.3'
shell: bash # host: macos-12
run: | # target: x86_64-unknown-openbsd
${{ matrix.os.prepare }} # build: --all-features
cargo build --release ${{ matrix.os.build }} --target ${{ matrix.os.target }} # prepare: |
mv ./target/${{ matrix.os.target }}/release/distant ./distant-${{ matrix.os.target }} # sudo pkg_add -I gmake rust llvm
chmod +x ./distant-${{ matrix.os.target }} # sed -i 's/lto = true/lto = false/' Cargo.toml
- name: Upload # steps:
uses: actions/upload-artifact@v2 # - uses: actions/checkout@v3
with: # - uses: Swatinem/rust-cache@v2
name: ${{ matrix.os.target }} # - name: Build in VM
path: ./distant-${{ matrix.os.target }} # uses: cross-platform-actions/action@v0.15.0
# env:
# CARGO_INCREMENTAL: 0
# with:
# environment_variables: CARGO_INCREMENTAL
# operating_system: ${{ matrix.os.name }}
# architecture: ${{ matrix.os.architecture }}
# version: ${{ matrix.os.version }}
# shell: bash
# run: |
# ${{ matrix.os.prepare }}
# cargo build --release ${{ matrix.os.build }} --target ${{ matrix.os.target }}
# mv ./target/${{ matrix.os.target }}/release/distant ./distant-${{ matrix.os.target }}
# chmod +x ./distant-${{ matrix.os.target }}
# - name: Upload
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.os.target }}
# path: ./distant-${{ matrix.os.target }}
# if-no-files-found: error
# retention-days: 5
publish: publish:
needs: [macos, windows, linux, bsd] needs: [macos, macos_unify, windows, linux]
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
steps: steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
- name: Generate SHA256 checksums - name: Generate SHA256 checksums
run: | run: |
@ -203,33 +266,46 @@ jobs:
id: check-tag id: check-tag
run: | run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-.*$ ]]; then if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-.*$ ]]; then
echo ::set-output name=match::true echo "is_prerelease=true" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref }} =~ ^refs/tags/latest$ ]]; then elif [[ ${{ github.ref }} =~ ^refs/tags/latest$ ]]; then
echo ::set-output name=latest::true echo "is_latest=true" >> $GITHUB_OUTPUT
fi fi
- name: Print pre-release status - name: Print pre-release status
run: | run: |
echo "Is ${{ github.ref }} a pre-release: ${{ steps.check-tag.outputs.match }}" echo "Is ${{ github.ref }} pre-release: ${{ steps.check-tag.outputs.is_prerelease }}"
echo "Is ${{ github.ref }} latest: ${{ steps.check-tag.outputs.latest }}" echo "Is ${{ github.ref }} latest: ${{ steps.check-tag.outputs.is_latest }}"
- name: Get Changelog Entry - name: Get Changelog Entry
id: changelog id: changelog
uses: mindsers/changelog-reader-action@v2 uses: mindsers/changelog-reader-action@v2
with: with:
version: ${{ env.TAG_VERSION }} version: ${{ env.TAG_VERSION }}
path: "./CHANGELOG.md" path: "./CHANGELOG.md"
- name: Publish if: ${{ steps.check-tag.outputs.is_latest != 'true' }}
- name: Publish (latest)
if: ${{ steps.check-tag.outputs.is_latest == 'true' }}
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
name: distant ${{ env.TAG_NAME }} name: Latest Build
fail_on_unmatched_files: true fail_on_unmatched_files: true
target_commitish: ${{ github.sha }} target_commitish: ${{ github.sha }}
draft: false draft: false
prerelease: ${{ steps.check-tag.outputs.match == 'true' }} prerelease: true
files: | files: |
**/distant-* **/distant-*
**/*.sha256sum
body: | body: |
## Latest
This is the latest commit (${{ github.sha }}) built for testing. This is the latest commit (${{ github.sha }}) built for testing.
This is not guaranteed to pass all tests or even function properly. This is not guaranteed to pass all tests or even function properly.
- name: Publish (release)
if: ${{ steps.check-tag.outputs.is_latest != 'true' }}
uses: softprops/action-gh-release@v1
with:
name: distant ${{ env.TAG_NAME }}
fail_on_unmatched_files: true
target_commitish: ${{ github.sha }}
draft: false
prerelease: ${{ steps.check-tag.outputs.is_prerelease == 'true' }}
files: |
**/distant-*
body: |
## Release Notes
${{ steps.changelog.outputs.changes }}

Loading…
Cancel
Save