pixiv: allow models to be serialized #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
release: | |
types: [published] # include pre-releases | |
push: | |
branches: # ignore any tags | |
- '**' | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: full | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- x86_64-pc-windows-gnu | |
- aarch64-linux-android | |
- x86_64-pc-windows-msvc | |
env: | |
RUST_BACKTRACE: full | |
RUSTFLAGS: ${{ contains(matrix.target, 'msvc') && '-C target-feature=+crt-static' || '' }} | |
runs-on: ${{ contains(matrix.target, 'msvc') && 'windows-latest' || 'ubuntu-latest' }} | |
defaults: | |
run: | |
shell: ${{ contains(matrix.target, 'msvc') && 'msys2 {0}' || 'bash' }} | |
steps: | |
- name: Cleanup pre-installed tools | |
if: runner.os != 'Windows' | |
run: | | |
# This is a fix for https://github.com/actions/virtual-environments/issues/1918 | |
shopt -s nullglob | |
sudo rm -rf /usr/share/{dotnet,swift,az*,gradle*,*conda} \ | |
/opt/{ghc,az} \ | |
/usr/local/share/boost /usr/local/graalvm /usr/local/julia* "$AGENT_TOOLSDIRECTORY" | |
- uses: msys2/setup-msys2@v2 | |
if: runner.os == 'Windows' | |
with: | |
path-type: inherit | |
install: ${{ github.event_name == 'release' && 'zip' || 'false' }} | |
- uses: actions/checkout@v2 | |
- name: Use GNU tar for cache | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: | | |
echo "Adding GNU tar to PATH" | |
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ matrix.target }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Install cross | |
run: | | |
cargo install cross --git https://github.com/cross-rs/cross || true | |
cross --version | |
echo CARGO=cross >> "$GITHUB_ENV" | |
if: matrix.target != 'x86_64-unknown-linux-gnu' && matrix.target != 'x86_64-pc-windows-msvc' | |
- name: Build ${{ matrix.target }} | |
run: | | |
set -e | |
cargo update | |
target=${{ matrix.target }} | |
${CARGO:=cargo} build --release --target $target | |
bin=target/$target/release/pvg | |
if [[ $target == *windows* ]]; then | |
bin+=.exe | |
fi | |
FILE=pvg-${GITHUB_SHA::7}-$target.xz | |
xz -cv $bin > $FILE | |
echo "FILE=$FILE" >> "$GITHUB_ENV" | |
echo "BIN_FILE=$bin" >> "$GITHUB_ENV" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.FILE }} | |
path: ${{ env.FILE }} | |
- uses: robinraju/[email protected] | |
if: ${{ github.event_name == 'release' }} | |
with: | |
repository: karin0/pvg-app | |
latest: true | |
fileName: "pvg-app-*.zip" | |
out-file-path: static | |
extract: true | |
- name: Package for Release | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
ZIP_FILE=pvg-${GITHUB_REF##*/}-${{ matrix.target }}.zip | |
mkdir dist | |
mv "$BIN_FILE" static dist/ | |
cd dist | |
rm static/*.zip | |
zip -r ../"$ZIP_FILE" * | |
echo "ZIP_FILE=$ZIP_FILE" >> "$GITHUB_ENV" | |
- uses: shogo82148/actions-upload-release-asset@v1 | |
if: ${{ github.event_name == 'release' }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ env.ZIP_FILE }} |