Skip to content

Commit

Permalink
Merge pull request #5 from sebastienrousseau/feat/vrd
Browse files Browse the repository at this point in the history
feat(vrd): preparing v0.0.3
  • Loading branch information
sebastienrousseau authored May 10, 2023
2 parents 292da02 + f783725 commit 750e36c
Show file tree
Hide file tree
Showing 16 changed files with 320 additions and 418 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
name: 🧪 Audit
on: [push, pull_request]

on:
push:
branches:
- feat/vrd
pull_request:
branches:
- feat/vrd
release:
types: [created]

jobs:
dependencies:
name: Audit dependencies
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
- name: Install cargo-audit
run: cargo install cargo-audit
- uses: actions/checkout@master
- name: Audit dependencies
run: cargo audit
- uses: hecrj/setup-rust-action@v1
- name: Install cargo-audit
run: cargo install cargo-audit
- uses: actions/checkout@master
- name: Audit dependencies
run: cargo audit
24 changes: 17 additions & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
name: 🧪 Check
on: [push, pull_request]

on:
push:
branches:
- feat/vrd
pull_request:
branches:
- feat/vrd
release:
types: [created]

jobs:
all:
name: Check
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- uses: actions/checkout@master
- name: Check lints
run: cargo check --all-targets --workspace --all-features
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- uses: actions/checkout@master
- name: Check lints
run: cargo check --all-targets --workspace --all-features
93 changes: 51 additions & 42 deletions .github/workflows/document.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
name: 🧪 Document
on: [push, pull_request]

on:
push:
branches:
- feat/vrd
pull_request:
branches:
- feat/vrd
release:
types: [created]

jobs:
all:
name: Document
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly

- uses: actions/checkout@v3

- name: Update libssl
run: |
sudo apt-get update
sudo apt-get install -y libssl1.1
- name: Generate documentation for all features and publish it
run: |
RUSTDOCFLAGS="--cfg docsrs" \
cargo doc --no-deps --all-features --workspace
# Write index.html with redirect
echo '<html><head><meta http-equiv="refresh" content="0; url=/vrd/"></head><body></body></html>' > ./target/doc/index.html
- name: Deploy
uses: actions/upload-artifact@v3
with:
name: documentation
path: target/doc
if-no-files-found: error
retention-days: 1

- name: Write CNAME file
run: echo 'doc.vrdlib.one' > ./target/doc/CNAME

- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly

- uses: actions/checkout@v3

- name: Update libssl
run: |
sudo apt-get update
sudo apt-get install -y libssl1.1
- name: Generate documentation for all features and publish it
run: |
RUSTDOCFLAGS="--cfg docsrs" \
cargo doc --no-deps --all-features --workspace
# Write index.html with redirect
echo '<html><head><meta http-equiv="refresh" content="0; url=/vrd/"></head><body></body></html>' > ./target/doc/index.html
- name: Deploy
uses: actions/upload-artifact@v3
with:
name: documentation
path: target/doc
if-no-files-found: error
retention-days: 1

- name: Write CNAME file
run: echo 'doc.vrdlib.one' > ./target/doc/CNAME

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
publish_branch: gh-pages
cname: true
clean: true
commit_message: Deploy documentation at ${{ github.sha }}
commit_user_name: github-actions
commit_user_email: actions@users.noreply.github.com
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
publish_branch: gh-pages
cname: true
clean: true
commit_message: Deploy documentation at ${{ github.sha }}
commit_user_name: github-actions
commit_user_email: actions@users.noreply.github.com
24 changes: 17 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
name: 🧪 Lint
on: [push, pull_request]

on:
push:
branches:
- feat/vrd
pull_request:
branches:
- feat/vrd
release:
types: [created]

jobs:
all:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- uses: actions/checkout@master
- name: Check lints
run: cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- uses: actions/checkout@master
- name: Check lints
run: cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings
97 changes: 60 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ name: 🧪 Release
on: [push, pull_request]

jobs:

# Build the project for all the targets and generate artifacts.
build:
# This job builds the project for all the targets and generates a
# release artifact that contains the binaries for all the targets.
name: ❯ Build 🛠

# Only run this job on the main branch when a commit is pushed.
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

# Set up the job environment variables.
env:
BUILD_ID: ${{ github.run_id }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: ${{ matrix.os }}
TARGET: ${{ matrix.target }}

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -44,7 +54,7 @@ jobs:
- riscv64gc-unknown-linux-gnu # RISC-V Linux (kernel 3.2, glibc 2.17)
- s390x-unknown-linux-gnu # s390x Linux (kernel 3.2, glibc 2.17)
- x86_64-unknown-freebsd # 64-bit FreeBSD on x86-64
- x86_64-unknown-illumos # 64-bit Illumos on x86-64
# # - x86_64-unknown-illumos # 64-bit Illumos on x86-64
- x86_64-unknown-linux-musl # 64-bit Linux (kernel 2.6.32+, musl libc)
- x86_64-unknown-netbsd # 64-bit NetBSD on x86-64

Expand Down Expand Up @@ -124,9 +134,9 @@ jobs:
- target: x86_64-unknown-freebsd
os: ubuntu-latest
cross: true
- target: x86_64-unknown-illumos
os: ubuntu-latest
cross: true
# - target: x86_64-unknown-illumos
# os: ubuntu-latest
# cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true
Expand All @@ -137,20 +147,20 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
# Check out the repository code
# Check out the repository code.
- name: Checkout sources
id: checkout
uses: actions/checkout@v3

# Install the stable Rust toolchain
# Install the stable Rust toolchain.
- name: Install stable toolchain
id: install-toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

# Cache dependencies to speed up subsequent builds
# Cache dependencies to speed up subsequent builds.
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
Expand All @@ -162,12 +172,13 @@ jobs:
# Install the targets for the cross-compilation toolchain
- name: Install target
id: install-target
run: rustup target add ${{ matrix.target }}
run: rustup target add ${{ env.TARGET }}

- name: Install Cross and clean artifacts
run: |
# Install cross
cargo install cross
# Clean the build artifacts
cargo clean --verbose
shell: bash
Expand All @@ -179,23 +190,23 @@ jobs:
with:
use-cross: true
command: build
args: --verbose --workspace --release --target ${{ matrix.target }}
args: --verbose --workspace --release --target ${{ env.TARGET }}

# Package the binary for each target
- name: Package the binary
id: package-binary
run: |
mkdir -p target/package
tar czf target/package/${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release .
echo "${{ matrix.target }}.tar.gz=target/package/${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
tar czf target/package/${{ env.TARGET }}.tar.gz -C target/${{ env.TARGET }}/release .
echo "${{ env.TARGET }}.tar.gz=target/package/${{ env.TARGET }}.tar.gz" >> $GITHUB_ENV
# Upload the binary for each target
- name: Upload the binary
id: upload-binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}.tar.gz
path: ${{ format('{0}.tar.gz', matrix.target) }}
name: ${{ env.TARGET }}.tar.gz
path: target/package/${{ env.TARGET }}.tar.gz

# Release the binary to GitHub Releases
release:
Expand Down Expand Up @@ -233,7 +244,7 @@ jobs:
# Download the artifacts from the build job
- name: Download artifacts
run: |
for target in ${{ matrix.target }}; do
for target in ${{ env.TARGET }}; do
echo "Downloading $target artifact"
name="${target}.tar.gz"
echo "Artifact name: $name"
Expand All @@ -242,37 +253,49 @@ jobs:
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_ID: ${{ github.run_id }}
VERSION: ${{ env.VERSION }}
TARGET: ${{ env.TARGET }}
OS: ${{ env.OS }}

# Generate the changelog based on git log and template file
# Generate the changelog based on the git log
- name: Generate Changelog
id: generate-changelog
env:
BUILD_ID: ${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_URL: https://github.com/sebastienrousseau/vrd/releases
TARGET: ${{ env.TARGET }}

run: |
# Append version information to CHANGELOG.md
echo "## Release v${{ env.VERSION }} - $(date +'%Y-%m-%d')" >> ${{ github.workspace }}/CHANGELOG.md
# Copy content of template file to CHANGELOG.md
cat TEMPLATE.md >> ${{ github.workspace }}/CHANGELOG.md
# Append git log to CHANGELOG.md
echo "$(git log --pretty=format:'%s' --reverse $(git describe --tags --abbrev=0)..HEAD)" >> ${{ github.workspace }}/CHANGELOG.md
# Append empty line to CHANGELOG.md
echo "" >> ${{ github.workspace }}/CHANGELOG.md
# Append the artifact links to the changelog
- name: Append Artifact Links
run: |
echo "" >> ${{ github.workspace }}/CHANGELOG.md
echo "## Artifacts 🎁" >> ${{ github.workspace }}/CHANGELOG.md
for filename in target/package/*.tar.gz; do
link="$(basename $filename)"
echo "* [${link}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/download/v${{ env.VERSION }}/$link)" >> ${{ github.workspace }}/CHANGELOG.md
done
if [[ ! -f CHANGELOG.md ]]; then
# Set path to changelog file
changelog_file="${{ github.workspace }}/CHANGELOG.md"
# Get version from Cargo.toml
version=$(grep version Cargo.toml | sed -n 2p | cut -d '"' -f 2)
# Append version information to changelog
echo "## Release v${version} - $(date +'%Y-%m-%d')" >> "${changelog_file}"
# Copy content of template file to changelog
cat TEMPLATE.md >> "${changelog_file}"
# Append git log to changelog
echo "$(git log --pretty=format:'%s' --reverse HEAD)" >> "${changelog_file}"
# Append empty line to changelog
echo "" >> "${changelog_file}"
fi
shell: bash

# Create the release on GitHub Releases
# Create the release on GitHub releases
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
with:
tag_name: v${{ env.VERSION }}
release_name: Random (VRD) 🦀 v${{ env.VERSION }}
Expand Down
Loading

0 comments on commit 750e36c

Please sign in to comment.