Skip to content

Commit

Permalink
Merge pull request #116 from mkantor/format-yaml
Browse files Browse the repository at this point in the history
Format GitHub Actions workflow YAML files.
  • Loading branch information
mkantor authored Jul 12, 2024
2 parents 6912122 + de8df7f commit ca45d51
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 88 deletions.
97 changes: 48 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ env:
CARGO_TERM_COLOR: always

jobs:

verify-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
tag="${GITHUB_REF#refs/tags/}"
package_version="$(cargo read-manifest | jq --raw-output .version)"
echo "Git tag name: ${tag}"
echo "Cargo.toml version: ${package_version}"
test "$tag" == "$package_version"
- uses: actions/checkout@v2
- run: |
tag="${GITHUB_REF#refs/tags/}"
package_version="$(cargo read-manifest | jq --raw-output .version)"
echo "Git tag name: ${tag}"
echo "Cargo.toml version: ${package_version}"
test "$tag" == "$package_version"
# Run the tests and create a fresh cache before releasing. Make sure that the
# same code that was tested is what gets released.
Expand All @@ -28,18 +27,18 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo test --release
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo test --release

publish-binary:
needs:
Expand All @@ -49,8 +48,8 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- ubuntu-latest
- macos-latest
include:
- os: macos-latest
artifact_prefix: macos-x86-64
Expand All @@ -59,34 +58,34 @@ jobs:
artifact_prefix: linux-x86-64
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }}
- run: rustup target add ${{ matrix.target }}
- run: cargo build --release --target ${{ matrix.target }}
- name: package binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
strip ${{ github.event.repository.name }}
tar czvf \
${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \
${{ github.event.repository.name }}
shasum -a 256 ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \
> ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256
- name: publish release to github
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }}
- run: rustup target add ${{ matrix.target }}
- run: cargo build --release --target ${{ matrix.target }}
- name: package binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
strip ${{ github.event.repository.name }}
tar czvf \
${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \
${{ github.event.repository.name }}
shasum -a 256 ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \
> ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256
- name: publish release to github
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-crate:
needs:
Expand Down
77 changes: 38 additions & 39 deletions .github/workflows/validate-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,59 @@ env:
CARGO_TERM_COLOR: always

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/debug
key: test-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo test
# There is a bug with BSD tar on macOS where the first 8MB of the file are
# sometimes all NUL bytes. See https://github.com/actions/cache/issues/403
# and https://github.com/rust-lang/cargo/issues/8603 for some more
# information. An alternative solution here is to install GNU tar, but
# flushing the disk cache seems to work, too.
- run: sudo purge
if: startsWith(matrix.os, 'macos-')
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/debug
key: test-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo test
# There is a bug with BSD tar on macOS where the first 8MB of the file are
# sometimes all NUL bytes. See https://github.com/actions/cache/issues/403
# and https://github.com/rust-lang/cargo/issues/8603 for some more
# information. An alternative solution here is to install GNU tar, but
# flushing the disk cache seems to work, too.
- run: sudo purge
if: startsWith(matrix.os, 'macos-')

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/debug
key: lint-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo clippy -- -D warnings
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/debug
key: lint-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo clippy -- -D warnings

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cargo fmt --all -- --check
- uses: actions/checkout@v2
- run: cargo fmt --all -- --check

benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: benchmark-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo bench
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: benchmark-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ secrets.CI_CACHE_VERSION }}
- run: cargo bench

0 comments on commit ca45d51

Please sign in to comment.