init: preparing env, adding nightly on cron schedule

This commit is contained in:
Konrad Baran 2024-08-02 14:22:27 +02:00
parent 3fdbbfe915
commit dec8966c9e
No known key found for this signature in database
GPG key ID: B1447A483969736A

View file

@ -4,143 +4,179 @@ on:
push: push:
tags: tags:
- "v[0-9]+.[0-9]+.[0-9]+" - "v[0-9]+.[0-9]+.[0-9]+"
schedule:
- cron: '0 0 * * *'
jobs: jobs:
build-unix: # build-unix:
strategy: # strategy:
matrix: # matrix:
include: # include:
- os: ubuntu-latest # - os: ubuntu-latest
target: x86_64-unknown-linux-gnu # target: x86_64-unknown-linux-gnu
- os: ubuntu-latest # - os: ubuntu-latest
target: aarch64-unknown-linux-gnu # target: aarch64-unknown-linux-gnu
- os: macos-latest # - os: macos-latest
target: x86_64-apple-darwin # target: x86_64-apple-darwin
- os: macos-latest # - os: macos-latest
target: aarch64-apple-darwin # target: aarch64-apple-darwin
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
steps: # steps:
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- name: Install gcc-aarch64-linux-gnu # - name: Install gcc-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu' # if: matrix.target == 'aarch64-unknown-linux-gnu'
run: | # run: |
sudo apt-get update && sudo apt-get install -yq gcc-aarch64-linux-gnu # sudo apt-get update && sudo apt-get install -yq gcc-aarch64-linux-gnu
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV # echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV # echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build # - name: Build
run: ./scripts/build.sh ${{ matrix.target }} # run: ./scripts/build.sh ${{ matrix.target }}
- name: Upload artifact # - name: Upload artifact
uses: actions/upload-artifact@v4 # uses: actions/upload-artifact@v4
with: # with:
name: yazi-${{ matrix.target }}.zip # name: yazi-${{ matrix.target }}.zip
path: yazi-${{ matrix.target }}.zip # path: yazi-${{ matrix.target }}.zip
build-windows: # build-windows:
strategy: # strategy:
matrix: # matrix:
include: # include:
- os: windows-latest # - os: windows-latest
target: x86_64-pc-windows-msvc # target: x86_64-pc-windows-msvc
- os: windows-latest # - os: windows-latest
target: aarch64-pc-windows-msvc # target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
steps: # steps:
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- name: Setup Rust toolchain # - name: Setup Rust toolchain
run: rustup toolchain install stable --profile minimal # run: rustup toolchain install stable --profile minimal
- name: Add target # - name: Add target
run: rustup target add ${{ matrix.target }} # run: rustup target add ${{ matrix.target }}
- name: Build # - name: Build
env: # env:
YAZI_GEN_COMPLETIONS: true # YAZI_GEN_COMPLETIONS: true
run: | # run: |
cargo build -p yazi-cli --release --locked --target ${{ matrix.target }} # cargo build -p yazi-cli --release --locked --target ${{ matrix.target }}
cargo build -p yazi-fm --release --locked --target ${{ matrix.target }} # cargo build -p yazi-fm --release --locked --target ${{ matrix.target }}
- name: Pack artifact # - name: Pack artifact
if: matrix.os == 'windows-latest' # if: matrix.os == 'windows-latest'
env: # env:
TARGET_NAME: yazi-${{ matrix.target }} # TARGET_NAME: yazi-${{ matrix.target }}
run: | # run: |
New-Item -ItemType Directory -Path ${env:TARGET_NAME} # New-Item -ItemType Directory -Path ${env:TARGET_NAME}
Copy-Item -Path "target\${{ matrix.target }}\release\ya.exe" -Destination ${env:TARGET_NAME} # Copy-Item -Path "target\${{ matrix.target }}\release\ya.exe" -Destination ${env:TARGET_NAME}
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME} # Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME}
Copy-Item -Path "yazi-boot\completions" -Destination ${env:TARGET_NAME} -Recurse # Copy-Item -Path "yazi-boot\completions" -Destination ${env:TARGET_NAME} -Recurse
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME} # Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME}
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip" # Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip"
- name: Upload artifact # - name: Upload artifact
uses: actions/upload-artifact@v4 # uses: actions/upload-artifact@v4
with: # with:
name: yazi-${{ matrix.target }}.zip # name: yazi-${{ matrix.target }}.zip
path: yazi-${{ matrix.target }}.zip # path: yazi-${{ matrix.target }}.zip
build-musl: # build-musl:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# - target: x86_64-unknown-linux-musl
# image: rust-musl-cross:x86_64-musl
# - target: aarch64-unknown-linux-musl
# image: rust-musl-cross:aarch64-musl
# container:
# image: docker://ghcr.io/rust-cross/${{ matrix.image }}
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: ./scripts/build.sh ${{ matrix.target }}
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: yazi-${{ matrix.target }}.zip
# path: yazi-${{ matrix.target }}.zip
# build-snap:
# strategy:
# matrix:
# include:
# - os: ubuntu-latest
# target: x86_64-unknown-linux-gnu
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - name: Build snap
# uses: snapcore/action-build@v1
# - name: Build
# run: mv yazi_*.snap yazi-${{ matrix.target }}.snap
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: yazi-${{ matrix.target }}.snap
# path: yazi-${{ matrix.target }}.snap
# draft:
# permissions:
# contents: write
# runs-on: ubuntu-latest
# needs: [build-unix, build-windows, build-musl, build-snap]
# steps:
# - uses: actions/download-artifact@v4
# with:
# merge-multiple: true
# - name: Draft
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# draft: true
# files: |
# yazi-*.zip
# yazi-*.snap
# generate_release_notes: true
dummmy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
image: rust-musl-cross:x86_64-musl
- target: aarch64-unknown-linux-musl
image: rust-musl-cross:aarch64-musl
container:
image: docker://ghcr.io/rust-cross/${{ matrix.image }}
steps: steps:
- uses: actions/checkout@v4 - run: echo "Hello, nightly!" > yazi-dummy.zip
- uses: actions/upload-artifact@v4
- name: Build
run: ./scripts/build.sh ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with: with:
name: yazi-${{ matrix.target }}.zip name: yazi-dummy.zip
path: yazi-${{ matrix.target }}.zip path: yazi-dummy.zip
build-snap: nightly:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build snap
uses: snapcore/action-build@v1
- name: Build
run: mv yazi_*.snap yazi-${{ matrix.target }}.snap
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: yazi-${{ matrix.target }}.snap
path: yazi-${{ matrix.target }}.snap
draft:
permissions: permissions:
contents: write contents: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-unix, build-windows, build-musl, build-snap] # !TODO: uncomment the following line before merging
# needs: [build-unix, build-windows, build-musl, build-snap]
needs: [dummmy]
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
merge-multiple: true merge-multiple: true
- name: Draft - run: echo "CURRENT_DATE=$(date -u +"%Y%m%d-%H%M")" >> $GITHUB_ENV
- name: Nightly
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') if: github.event_name == 'schedule'
with: with:
draft: true tag_name: "yazi-nightly-${{ env.CURRENT_DATE }}"
prerelease: true
files: | files: |
yazi-*.zip yazi-*.zip
yazi-*.snap yazi-*.snap