-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
267 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
--- | ||
# see: https://www.infinyon.com/blog/2021/04/github-actions-best-practices | ||
name: ci | ||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
build: | ||
name: build (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
include: | ||
- os: ubuntu-latest | ||
sccache-path: /home/runner/.cache/sccache | ||
env: | ||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
RUSTV: ${{ matrix.rust }} | ||
SCCACHE_CACHE_SIZE: 2G | ||
SCCACHE_DIR: ${{ matrix.sccache-path }} | ||
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install sccache | ||
if: matrix.os == 'ubuntu-latest' | ||
env: | ||
LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.2.15 | ||
run: | | ||
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | ||
mkdir -p $HOME/.local/bin | ||
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | ||
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | ||
chmod +x $HOME/.local/bin/sccache | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: cache cargo registry | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: cache sccache | ||
uses: actions/cache@v2 | ||
continue-on-error: false | ||
with: | ||
path: ${{ matrix.sccache-path }} | ||
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-sccache- | ||
- name: start sccache server | ||
run: sccache --start-server | ||
- name: init | ||
run: make init | ||
- name: build | ||
run: make build | ||
- name: stop sccache server | ||
run: sccache --stop-server || true | ||
test: | ||
name: test (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
include: | ||
- os: ubuntu-latest | ||
sccache-path: /home/runner/.cache/sccache | ||
env: | ||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
RUSTV: ${{ matrix.rust }} | ||
SCCACHE_CACHE_SIZE: 2G | ||
SCCACHE_DIR: ${{ matrix.sccache-path }} | ||
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install sccache | ||
if: matrix.os == 'ubuntu-latest' | ||
env: | ||
LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.2.15 | ||
run: | | ||
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | ||
mkdir -p $HOME/.local/bin | ||
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | ||
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | ||
chmod +x $HOME/.local/bin/sccache | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: cache cargo registry | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: cache sccache | ||
uses: actions/cache@v2 | ||
continue-on-error: false | ||
with: | ||
path: ${{ matrix.sccache-path }} | ||
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-sccache- | ||
- name: start sccache server | ||
run: sccache --start-server | ||
- name: init | ||
run: make init | ||
- name: test | ||
run: make test | ||
- name: stop sccache server | ||
run: sccache --stop-server || true | ||
clippy: | ||
name: clippy (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
include: | ||
- os: ubuntu-latest | ||
sccache-path: /home/runner/.cache/sccache | ||
env: | ||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
RUSTV: ${{ matrix.rust }} | ||
SCCACHE_CACHE_SIZE: 2G | ||
SCCACHE_DIR: ${{ matrix.sccache-path }} | ||
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install sccache | ||
if: matrix.os == 'ubuntu-latest' | ||
env: | ||
LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.2.15 | ||
run: | | ||
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | ||
mkdir -p $HOME/.local/bin | ||
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | ||
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | ||
chmod +x $HOME/.local/bin/sccache | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: cache cargo registry | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: cache sccache | ||
uses: actions/cache@v2 | ||
continue-on-error: false | ||
with: | ||
path: ${{ matrix.sccache-path }} | ||
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-sccache- | ||
- name: start sccache server | ||
run: sccache --start-server | ||
- name: init | ||
run: make init | ||
- name: clippy | ||
run: make clippy | ||
- name: stop sccache server | ||
run: sccache --stop-server || true |
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,86 @@ | ||
--- | ||
# see: https://www.infinyon.com/blog/2021/04/github-actions-best-practices | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+* | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
publish: | ||
name: publish (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
include: | ||
- os: ubuntu-latest | ||
sccache-path: /home/runner/.cache/sccache | ||
env: | ||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
RUSTV: ${{ matrix.rust }} | ||
SCCACHE_CACHE_SIZE: 2G | ||
SCCACHE_DIR: ${{ matrix.sccache-path }} | ||
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | ||
steps: | ||
- name: parse-tag | ||
id: parse_tag | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
result-encoding: string | ||
script: | | ||
return context.payload.ref.replace(/refs\/tags\//, '') | ||
- uses: actions/checkout@v2 | ||
- name: install sccache | ||
if: matrix.os == 'ubuntu-latest' | ||
env: | ||
LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.2.15 | ||
run: | | ||
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | ||
mkdir -p $HOME/.local/bin | ||
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | ||
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | ||
chmod +x $HOME/.local/bin/sccache | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: cache cargo registry | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: cache sccache | ||
uses: actions/cache@v2 | ||
continue-on-error: false | ||
with: | ||
path: ${{ matrix.sccache-path }} | ||
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-sccache- | ||
- name: start sccache server | ||
run: sccache --start-server | ||
- name: init | ||
run: make init | ||
- name: release | ||
run: make release | ||
- name: stop sccache server | ||
run: sccache --stop-server || true | ||
- name: strip | ||
run: strip target/release/snapr-node | ||
- name: rename | ||
run: mv target/release/snapr-node target/release/snapr_${{ steps.parse_tag.outputs.result }}_amd64 | ||
- name: publish | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: | | ||
target/release/snapr_${{ steps.parse_tag.outputs.result }}_amd64 |
This file was deleted.
Oops, something went wrong.