Minor changes #93
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: Auto Build | |
on: | |
push: | |
branches: [ master, main ] | |
pull_request: | |
branches: [ master, main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-linux: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
os: [ linux ] | |
rustarch: [ x86_64, aarch64 ] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install aarch64 gcc | |
if: matrix.rustarch == 'aarch64' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Get nightly toolchain | |
run : rustup toolchain add nightly-x86_64-unknown-linux-gnu | |
- name: Add nightly rust-src | |
run : rustup component add rust-src --toolchain nightly | |
- name: Build | |
env: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
run: RUSTFLAGS="-Zlocation-detail=none -C target-feature=+crt-static" cargo +nightly build -Z build-std=std,panic_abort --target ${{ matrix.rustarch }}-unknown-linux-gnu --release | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: seal-tool-${{ matrix.os }}-${{ matrix.rustarch }} | |
path: ./target/${{ matrix.rustarch }}-unknown-linux-gnu/release/seal-updater | |
build-macos: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
os: [ darwin ] | |
rustarch: [ x86_64, aarch64 ] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get nightly toolchain | |
run: rustup toolchain add nightly-x86_64-apple-darwin | |
- name: Add nightly rust-src | |
run : rustup component add rust-src --toolchain nightly | |
- name: Build | |
run: RUSTFLAGS="-Zlocation-detail=none -C target-feature=+crt-static" cargo +nightly build -Z build-std=std,panic_abort --target ${{ matrix.rustarch }}-apple-darwin --release | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: seal-tool-${{ matrix.os }}-${{ matrix.rustarch }} | |
path: ./target/${{ matrix.rustarch }}-apple-darwin/release/seal-updater | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
os: [ windows ] | |
rustarch: [ x86_64, i686 ] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get target | |
run: rustup target add ${{ matrix.rustarch }}-pc-windows-msvc | |
- name: Build | |
run: | | |
set RUSTFLAGS=-C target-feature=+crt-static | |
cargo build --target ${{ matrix.rustarch }}-pc-windows-msvc --verbose --release | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: seal-tool-${{ matrix.os }}-${{ matrix.rustarch }} | |
path: ./target/${{ matrix.rustarch }}-pc-windows-msvc/release/seal-updater.exe | |
collect: | |
name: Collect | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux | |
- build-windows | |
- build-macos | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64, android/arm64 | |
os: [ linux, windows, darwin ] | |
rustarch: [ i686, x86_64, aarch64 ] | |
exclude: | |
- os: linux | |
rustarch: 'i686' | |
- os: windows | |
rustarch: aarch64 | |
- os: darwin | |
rustarch: 'i686' | |
steps: | |
- name: Get Files | |
uses: actions/download-artifact@v3 | |
with: | |
name: seal-tool-${{ matrix.os }}-${{ matrix.rustarch }} | |
path: ./dist/ | |
- name: Rename | |
if: matrix.os != 'windows' | |
run: | | |
mv ./dist/seal-updater ./dist/seal-updater-${{ matrix.os }}-${{ matrix.rustarch }} | |
echo "DIST=./dist/seal-updater-${{ matrix.os }}-${{ matrix.rustarch }}" >> $GITHUB_ENV; | |
- name: Rename | |
if: matrix.os == 'windows' | |
run: | | |
mv ./dist/seal-updater.exe ./dist/seal-updater-${{ matrix.os }}-${{ matrix.rustarch }}.exe | |
echo "DIST=./dist/seal-updater-${{ matrix.os }}-${{ matrix.rustarch }}.exe" >> $GITHUB_ENV; | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ${{ env.DIST }} | |
prerelease: | |
name: Prerelease | |
runs-on: ubuntu-latest | |
needs: | |
- collect | |
# permissions: | |
# contents: write | |
steps: | |
- name: Get Files | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: ./dist/ | |
- name: Rename to go arch | |
run: | | |
cp ./dist/seal-updater-darwin-aarch64 ./dist/seal-updater-darwin-arm64 | |
cp ./dist/seal-updater-darwin-x86_64 ./dist/seal-updater-darwin-amd64 | |
cp ./dist/seal-updater-linux-aarch64 ./dist/seal-updater-linux-arm64 | |
cp ./dist/seal-updater-linux-x86_64 ./dist/seal-updater-linux-amd64 | |
cp ./dist/seal-updater-windows-i686.exe ./dist/seal-updater-windows-386.exe | |
cp ./dist/seal-updater-windows-x86_64.exe ./dist/seal-updater-windows-amd64.exe | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist-all | |
path: ./dist | |
# - name: Update Prerelease | |
# continue-on-error: true | |
# uses: andelf/nightly-release@main | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: pre-release | |
# name: 'Latest Dev Build $$' | |
# prerelease: true | |
# body: '> ⚠️注意️️:这是自动构建的预发布版本,非正式版本!' | |
# files: | | |
# ./dist/* | |
- uses: ryand56/r2-upload-action@latest | |
continue-on-error: true | |
with: | |
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
r2-bucket: ${{ secrets.R2_BUCKET }} | |
source-dir: ./dist | |
destination-dir: ./u/v0.1.2/ |