-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Tlntin/master
speed up github action compile
- Loading branch information
Showing
2 changed files
with
150 additions
and
92 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Test App With Cache | ||
|
||
on: | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
publish: | ||
name: ${{ matrix.target }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
target: x86_64-unknown-linux-gnu | ||
use-cross: false | ||
|
||
- os: ubuntu-20.04 | ||
target: x86_64-unknown-linux-musl | ||
use-cross: false | ||
|
||
- os: ubuntu-20.04 | ||
target: aarch64-unknown-linux-gnu | ||
use-cross: true | ||
|
||
- os: ubuntu-20.04 | ||
target: aarch64-unknown-linux-musl | ||
use-cross: true | ||
|
||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
use-cross: false | ||
|
||
- os: macos-latest | ||
target: aarch64-apple-darwin | ||
use-cross: false | ||
|
||
- os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
use-cross: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set the version | ||
id: version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: rust cache restore | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: ${{ matrix.use-cross }} | ||
command: build | ||
args: --target ${{ matrix.target }} --release --locked | ||
|
||
- name: Upload files (only for Mac/Linux) | ||
if: matrix.target != 'x86_64-pc-windows-msvc' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
UPLOADTOOL_ISPRERELEASE: true | ||
run: | | ||
curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh | ||
mv target/${{ matrix.target }}/release/et et-${{ matrix.target }} | ||
bash upload.sh et-${{ matrix.target }} | ||
- name: Upload files (only for Windows) | ||
if: matrix.target == 'x86_64-pc-windows-msvc' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
UPLOADTOOL_ISPRERELEASE: true | ||
run: | | ||
curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh | ||
mv target/${{ matrix.target }}/release/et.exe et-${{ matrix.target }}.exe | ||
bash upload.sh et-${{ matrix.target }}.exe | ||
|
||
- name: rust cache store | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} |