ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/.github/workflows/release.yml
Austin Seipp f1e09e3f3f chore(github): reduce compile time in build, nix, and release workflows
Summary: When building in CI, we just build everything from scratch in the `dev`
profile, so just turn off debuginfo and incremental compilation data. These
aren't reused, but more importantly take up more space and CPU time to generate;
that's more expensive on slower machines and when using The Cloud(TM) to build.

Together, these take a fresh build (`rm -rf target/` ahead of time) from about
40s to 30s on my machine.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Id6e706634dbaf88f6ccd7f457409ad7c
2023-07-10 06:18:38 -05:00

73 lines
2.2 KiB
YAML

name: Release
on:
release:
types: [created]
permissions: read-all
env:
CARGO_INCREMENTAL: 0
jobs:
build-release:
name: build-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
build: [linux-musl, macos, win-msvc]
include:
- build: linux-musl
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
- build: macos
os: macos-11
target: x86_64-apple-darwin
- build: win-msvc
os: windows-2022
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Install packages (Ubuntu)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools
- name: Install Rust
uses: dtolnay/rust-toolchain@0e66bd3e6b38ec0ad5312288c83e47c143e6b09e
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Build release binary
run: cargo build --target ${{ matrix.target }} --verbose --release --features vendored-openssl
- name: Build archive
shell: bash
run: |
outdir="target/${{ matrix.target }}/release"
staging="jj-${{ github.event.release.tag_name }}-${{ matrix.target }}"
mkdir "$staging"
cp {README.md,LICENSE} "$staging/"
if [ "${{ matrix.os }}" = "windows-2022" ]; then
cp "$outdir/jj.exe" "$staging/"
cd "$staging"
7z a "../$staging.zip" .
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "$outdir/jj" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream