Inherit secrets when releasing Docker #74
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
# TODO: incorporate some learnings from https://www.infinyon.com/blog/2021/04/github-actions-best-practices/, esp `sccache` stuff | |
name: CI | |
on: | |
push: | |
pull_request: | |
env: | |
NAME: modbus-mqtt | |
CARGO_TERM_COLOR: always | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions-rs/toolchain@v1 | |
id: rust-toolchain | |
with: | |
toolchain: stable | |
profile: default | |
override: true | |
- name: Install Dependencies | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt-get clean && sudo apt-get update | |
sudo apt-get install -y pkg-config libudev-dev | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
./target | |
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}- | |
${{ runner.os }}-cargo | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose | |
checks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions-rs/toolchain@v1 | |
id: rust-toolchain | |
with: | |
toolchain: stable | |
profile: default | |
override: true | |
- name: Install Dependencies | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt-get clean && sudo apt-get update | |
sudo apt-get install -y pkg-config libudev-dev | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
./target | |
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}- | |
${{ runner.os }}-cargo | |
- name: Check rustfmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Check clippy warnings | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D clippy::all | |
docker: | |
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' | |
needs: | |
- tests | |
uses: ./.github/workflows/release-docker.yml | |
secrets: inherit |