Skip to content

Commit

Permalink
Merge pull request #198 from ethankhall/ethan/add-logging
Browse files Browse the repository at this point in the history
Simplify Crom
  • Loading branch information
ethankhall authored Jun 5, 2022
2 parents 199168c + bc48bd7 commit e1dbe7a
Show file tree
Hide file tree
Showing 24 changed files with 766 additions and 1,900 deletions.
16 changes: 1 addition & 15 deletions .crom.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
pattern = 'v0.3.%d'
pattern = 'v0.4.%d'
message-template = "Created {version} for release."

[cargo]

[artifact.windows]
paths = { "crom.exe" = "windows/crom.exe" }
compress = { name = "crom-windows.zip", format = "zip" }
target = "GitHub"

[artifact.mac]
paths = {crom = "mac/crom"}
compress = { name = "crom-mac.tar.gz", format = "tgz" }
target = "GitHub"

[artifact.linux]
paths = {crom = "linux/crom"}
compress = { name = "crom-linux-musl.tar.gz", format = "tgz" }
target = "GitHub"
94 changes: 94 additions & 0 deletions .github/workflows/create-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Publish Image

on:
workflow_call:
inputs:
version:
required: true
type: string

jobs:
build-for-os:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos-x86, macos-aarch64]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: macos-x86
os: macos-latest
target: x86_64-apple-darwin
- build: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('ci/cache-version') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('ci/cache-version') }}-
${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('ci/cache-version') }}-
- name: Install correct version of Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
override: true
- uses: actions-rs/cargo@v1
with:
command: run
args: -- write-version custom ${{ inputs.version }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --target "${{ matrix.target }}"
- run: |
ls target/${{ matrix.target }}/*
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
if-no-files-found: error
path: |
target/${{ matrix.target }}/release/crom
release:
runs-on: ubuntu-latest
needs: build-for-os
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: aarch64-apple-darwin
path: artifacts/aarch64-apple-darwin
- uses: actions/download-artifact@v3
with:
name: x86_64-apple-darwin
path: artifacts/x86_64-apple-darwin
- uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-gnu
path: artifacts/x86_64-unknown-linux-gnu
- name: Create release
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
ls artifacts/*/*
mkdir artifacts-to-publish
tar -czv --strip-components 1 --owner=0 --group=0 --no-same-owner -f artifacts-to-publish/crom-${{ inputs.version }}-linux-gnu-x86_64.tgz -C artifacts/x86_64-unknown-linux-gnu crom
tar -czv --strip-components 1 --owner=0 --group=0 --no-same-owner -f artifacts-to-publish/crom-${{ inputs.version }}-darwin-aarch64.tgz -C artifacts/aarch64-apple-darwin crom
tar -czv --strip-components 1 --owner=0 --group=0 --no-same-owner -f artifacts-to-publish/crom-${{ inputs.version }}-darwin-x86_64.tgz -C artifacts/x86_64-apple-darwin crom
gh release upload ${{ inputs.version }} artifacts-to-publish/*
85 changes: 85 additions & 0 deletions .github/workflows/on-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
on:
push:
branches:
- main

name: Release

jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('ci/cache-version') }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: create pre-release
id: version
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
VERSION=$(cargo run -- get next-release)
gh release create $VERSION --generate-notes --target $(git rev-parse HEAD)
echo "::set-output name=version::$VERSION"
publish:
uses: ./.github/workflows/create-artifacts.yml
needs: create-release
with:
version: ${{ needs.create-release.outputs.version }}

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('ci/cache-version') }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
## Cargo test
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
## Cargo fmt
- run: rustup component add rustfmt
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
## Cargo clippy
- run: rustup component add clippy
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
84 changes: 84 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
on: [pull_request]

name: Continuous integration

jobs:
create-release:
needs:
- check
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('ci/cache-version') }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: create pre-release
id: version
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
VERSION=$(cargo run -- get pre-release)
gh release create $VERSION --generate-notes --prerelease --target $(git rev-parse HEAD)
echo "::set-output name=version::$VERSION"
publish:
uses: ./.github/workflows/create-artifacts.yml
needs: create-release
with:
version: ${{ needs.create-release.outputs.version }}

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('ci/cache-version') }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
## Cargo test
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
## Cargo fmt
- run: rustup component add rustfmt
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
## Cargo clippy
- run: rustup component add clippy
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
106 changes: 0 additions & 106 deletions .github/workflows/publish.yml

This file was deleted.

Loading

0 comments on commit e1dbe7a

Please sign in to comment.