mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-16 12:47:55 +08:00
improve cross compilation, prepare v0.7.2
This commit is contained in:
@@ -1,121 +0,0 @@
|
||||
name: deployment
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
deploy_linux_macos_windows_github:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: create_release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
os_name: linux
|
||||
- os: macos-latest
|
||||
os_name: macos
|
||||
- os: windows-latest
|
||||
os_name: windows
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- name: Check project
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
- name: Builds release
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release
|
||||
- name: Compress executable (unix)
|
||||
if: matrix.os_name == 'linux' || matrix.os_name == 'macos'
|
||||
run: |
|
||||
mkdir -p target/release/{man,completions}
|
||||
target/release/himalaya man target/release/man
|
||||
target/release/himalaya completion bash > target/release/completions/himalaya.bash
|
||||
target/release/himalaya completion elvish > target/release/completions/himalaya.elvish
|
||||
target/release/himalaya completion fish > target/release/completions/himalaya.fish
|
||||
target/release/himalaya completion powershell > target/release/completions/himalaya.powershell
|
||||
target/release/himalaya completion zsh > target/release/completions/himalaya.zsh
|
||||
tar czf himalaya.tar.gz -C target/release himalaya man completions
|
||||
- name: Compress executable (windows)
|
||||
if: matrix.os_name == 'windows'
|
||||
run: |
|
||||
mkdir -p target/release/{man,completions}
|
||||
target/release/himalaya.exe man target/release/man
|
||||
target/release/himalaya.exe completion bash > target/release/completions/himalaya.bash
|
||||
target/release/himalaya.exe completion elvish > target/release/completions/himalaya.elvish
|
||||
target/release/himalaya.exe completion fish > target/release/completions/himalaya.fish
|
||||
target/release/himalaya.exe completion powershell > target/release/completions/himalaya.powershell
|
||||
target/release/himalaya.exe completion zsh > target/release/completions/himalaya.zsh
|
||||
tar czf himalaya.tar.gz -C target/release himalaya.exe man completions
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.tar.gz
|
||||
asset_name: himalaya-${{ matrix.os_name }}.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
deploy_musl_github:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create_release
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build release
|
||||
run: |
|
||||
docker run -v "${PWD}:/volume" --rm -t clux/muslrust:stable cargo build --release
|
||||
- name: Compress executable
|
||||
run: tar czf himalaya.tar.gz -C target/x86_64-unknown-linux-musl/release himalaya
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.tar.gz
|
||||
asset_name: himalaya-musl.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
deploy_crates:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create_release
|
||||
environment: deployment
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: katyo/publish-crates@v1
|
||||
with:
|
||||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
@@ -1,38 +0,0 @@
|
||||
name: nix
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
nix-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkouts code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Caches Nix store
|
||||
uses: actions/cache@v3
|
||||
id: nix-cache
|
||||
with:
|
||||
path: /tmp/nix-cache
|
||||
key: nix-${{ hashFiles('**/flake.*') }}
|
||||
|
||||
- name: Installs Nix
|
||||
uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
|
||||
- name: Imports Nix store cache
|
||||
if: ${{ steps.nix-cache.outputs.cache-hit == 'true' }}
|
||||
run: nix-store --import < /tmp/nix-cache
|
||||
|
||||
- name: Builds the project
|
||||
run: nix build
|
||||
|
||||
- name: Exports Nix store cache
|
||||
if: ${{ steps.nix-cache.outputs.cache-hit != 'true' }}
|
||||
run: nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache
|
||||
@@ -0,0 +1,150 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
deploy_github:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: create_release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: linux
|
||||
os: ubuntu-latest
|
||||
- target: macos
|
||||
os: macos-latest
|
||||
- target: musl
|
||||
os: ubuntu-latest
|
||||
# TODO: put back when nix package .#windows is fixed
|
||||
# - target: windows
|
||||
# os: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v20
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: soywod
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: Build release
|
||||
run: nix build .#${{ matrix.target }}
|
||||
- name: Compress executable
|
||||
run: |
|
||||
mkdir -p {man,completions}
|
||||
cp result/bin/himalaya* .
|
||||
nix run .#${{ matrix.target }} man ./man
|
||||
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
|
||||
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
|
||||
nix run .#${{ matrix.target }} completion fish > ./completions/himalaya.fish
|
||||
nix run .#${{ matrix.target }} completion powershell > ./completions/himalaya.powershell
|
||||
nix run .#${{ matrix.target }} completion zsh > ./completions/himalaya.zsh
|
||||
tar -czf himalaya.tar.gz himalaya* man completions
|
||||
zip -r himalaya.zip himalaya* man completions
|
||||
- name: Upload tar.gz release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.tar.gz
|
||||
asset_name: himalaya-${{ matrix.target }}.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
- name: Upload zip release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.zip
|
||||
asset_name: himalaya-${{ matrix.target }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
# TODO: remove me when nix package .#windows is fixed
|
||||
deploy_windows_github:
|
||||
runs-on: windows-latest
|
||||
needs: create_release
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
command: check
|
||||
- name: Builds release
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release
|
||||
- name: Compress executable
|
||||
run: |
|
||||
mkdir man
|
||||
mkdir completions
|
||||
copy target/release/himalaya.exe .
|
||||
./himalaya.exe man ./man
|
||||
./himalaya.exe completion bash > ./completions/himalaya.bash
|
||||
./himalaya.exe completion elvish > ./completions/himalaya.elvish
|
||||
./himalaya.exe completion fish > ./completions/himalaya.fish
|
||||
./himalaya.exe completion powershell > ./completions/himalaya.powershell
|
||||
./himalaya.exe completion zsh > ./completions/himalaya.zsh
|
||||
tar -czf himalaya.tar.gz himalaya.exe man completions
|
||||
zip -r himalaya.zip himalaya.exe man completions
|
||||
- name: Upload tar.gz release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.tar.gz
|
||||
asset_name: himalaya-windows.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
- name: Upload zip release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: himalaya.zip
|
||||
asset_name: himalaya-windows.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
deploy_crates:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create_release
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v20
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- name: Publish library to crates.io
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
run: nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}
|
||||
+11
-25
@@ -3,36 +3,22 @@ name: tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install libnotmuch
|
||||
run: sudo apt-get install -y libnotmuch-dev
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Start GreenMail testing server
|
||||
run: |
|
||||
docker run \
|
||||
--rm \
|
||||
-d \
|
||||
-e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose' \
|
||||
-p 3025:3025 \
|
||||
-p 3110:3110 \
|
||||
-p 3143:3143 \
|
||||
-p 3465:3465 \
|
||||
-p 3993:3993 \
|
||||
-p 3995:3995 \
|
||||
greenmail/standalone:1.6.11
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v20
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
command: test
|
||||
args: --all-features
|
||||
name: soywod
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: Test
|
||||
run: nix run .#test
|
||||
|
||||
Reference in New Issue
Block a user