When logging status required also log the current status (#61) #198
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
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
name: CI | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: rustup add components | |
run: | | |
rustup update stable | |
rustup component add rustfmt | |
rustup component add clippy | |
# make sure all code has been formatted with rustfmt | |
- name: check rustfmt | |
run: cargo fmt -- --check --color always | |
# run clippy to verify we have no warnings | |
- run: cargo fetch | |
- name: cargo clippy | |
run: cargo clippy --all-targets -- -D warnings | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: rustup update stable | |
- name: cargo fetch | |
run: cargo fetch | |
- name: cargo test build | |
run: cargo build --tests --release | |
- name: cargo test | |
run: cargo test --release | |
deny-check: | |
name: cargo-deny | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
# publish-check: | |
# name: Publish Check | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v1 | |
# - uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: stable | |
# override: true | |
# - name: cargo fetch | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: fetch | |
# - name: cargo publish check | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: publish | |
# args: --dry-run | |
release: | |
name: Release | |
needs: [test, deny-check] | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
include: | |
- os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
bin: octobors | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install musl tools | |
run: | | |
sudo apt-get install -y musl-tools | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: cargo fetch | |
run: cargo fetch --target ${{ matrix.target }} | |
- name: Release build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Package | |
shell: bash | |
run: | | |
name=octobors | |
tag=$(git describe --tags --abbrev=0) | |
release_name="$name-$tag-${{ matrix.target }}" | |
release_tar="${release_name}.tar.gz" | |
mkdir "$release_name" | |
strip "target/${{ matrix.target }}/release/${{ matrix.bin }}" | |
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/" | |
cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/" | |
tar czvf "$release_tar" "$release_name" | |
rm -r "$release_name/" | |
echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256" | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: "$BIN_NAME*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-container-images: | |
name: Publish container images | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test, deny-check] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Dockerhub | |
uses: docker/login-action@v1 | |
with: | |
username: embarkbot | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v1 | |
with: | |
images: embarkstudios/${{ github.event.repository.name }} | |
tag-semver: | | |
{{version}} | |
{{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |