Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/cd: add CI/CD workflows #5

Merged
merged 51 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0421c09
Add different templates
nsyzrantsev Aug 26, 2024
6eef2ab
Specify dev branch
nsyzrantsev Aug 26, 2024
fde1ebf
Add description for extract crate
nsyzrantsev Aug 26, 2024
cf698bb
Remove push trigger for ci/cd
nsyzrantsev Aug 26, 2024
b239846
Rename crate from extract to barkit-extract
nsyzrantsev Aug 26, 2024
eab409f
Rename barkit to barkit-extract in Cargo.toml
nsyzrantsev Aug 26, 2024
2c26d0d
Update dependabot.yml
nsyzrantsev Aug 26, 2024
4cd0144
Specify barkit-extract version
nsyzrantsev Aug 26, 2024
2c7977c
Update description in Cargo.toml
nsyzrantsev Aug 26, 2024
854584b
Update README.md
nsyzrantsev Aug 26, 2024
a31c8ee
Update README.md
nsyzrantsev Aug 27, 2024
fa3d456
Add configs
nsyzrantsev Aug 28, 2024
0d10114
Remove Cargo.lock
nsyzrantsev Aug 28, 2024
8699203
Add Cargo.lock
nsyzrantsev Aug 28, 2024
bc5d077
Update ci.yml
nsyzrantsev Aug 28, 2024
7c70dca
Add rust-version = "1.80.1"
nsyzrantsev Aug 28, 2024
eba380a
Fix misprint in flag help message
nsyzrantsev Aug 28, 2024
9ec09a6
Replace 1.80.0 -> 1.80.1
nsyzrantsev Aug 28, 2024
b6212e6
Formatting code
nsyzrantsev Aug 28, 2024
cfd439a
Add cargo test --all
nsyzrantsev Aug 28, 2024
754e1a1
Add cd.yml
nsyzrantsev Aug 29, 2024
9824e6c
Update Cargo.toml
Aug 29, 2024
b36daad
Replace nightly to stable
Aug 29, 2024
79ef843
chore(release): prepare for v1.0.0-rc.1
Aug 29, 2024
81135b3
chore(release): prepare for v1.0.0-rc.1
Aug 29, 2024
1e062bc
chore(release): prepare for v1.0.0-rc.1
Aug 29, 2024
f7cc6b9
Fix toolchaing installation in cd.yml
Aug 29, 2024
9e195de
chore(release): prepare for v1.0.0-rc.2
nsyzrantsev Aug 29, 2024
031b39b
chore(release): prepare for v1.0.0-rc.2
nsyzrantsev Aug 29, 2024
6100f18
Fix cd.yml
nsyzrantsev Aug 29, 2024
3305a41
chore(release): prepare for v1.0.0-rc.3
nsyzrantsev Aug 29, 2024
808df50
Fix a bug in preparing release assets in cd.yml
nsyzrantsev Aug 29, 2024
4024eb7
chore(release): prepare for v1.0.0-rc.4
nsyzrantsev Aug 29, 2024
137dd8a
Update signingkey in release.sh
nsyzrantsev Aug 29, 2024
cc6c9c3
Rename step in cd.yml
nsyzrantsev Aug 29, 2024
3231d52
Change trigger branch to main
nsyzrantsev Aug 29, 2024
12414aa
Remove CHANGELOG.md
nsyzrantsev Aug 29, 2024
48500f6
Return old version
nsyzrantsev Aug 29, 2024
5774668
Clear code with coderabbitai comments
nsyzrantsev Aug 30, 2024
89da12c
Revert actions-rs/cargo version
nsyzrantsev Aug 30, 2024
3418853
Clear code
nsyzrantsev Aug 30, 2024
f6f1528
Revert typos version
nsyzrantsev Aug 30, 2024
6d3e4a3
Remove --allow-dirty
nsyzrantsev Aug 30, 2024
0a06a62
chore(release): prepare for v1.0.0-rc.5
nsyzrantsev Aug 30, 2024
5b44496
Fix toolchain version
nsyzrantsev Aug 30, 2024
0bfba27
chore(release): prepare for v1.0.0-rc.6
nsyzrantsev Aug 30, 2024
000f648
Fix command with quotes
nsyzrantsev Aug 30, 2024
2cdb8ae
chore(release): prepare for v1.0.0-rc.7
nsyzrantsev Aug 30, 2024
bc90d2d
Uncomment publish-crates-io
nsyzrantsev Aug 30, 2024
f6b5ecf
Revert version in Cargo files
nsyzrantsev Aug 30, 2024
6fb5dcd
Remove CHANGELOG.md
nsyzrantsev Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://help.github.com/articles/about-codeowners/
# for more info about CODEOWNERS file

# It uses the same pattern rule for gitignore file
# https://git-scm.com/docs/gitignore#_pattern_format

# Core
* @nsyzrantsev
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
# Maintain dependencies for Cargo
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
groups:
minor:
update-types:
- "minor"
patch:
update-types:
- "patch"
7 changes: 7 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pull_request_rules:
- name: Automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
actions:
merge:
method: squash
234 changes: 234 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
name: Continuous Deployment

on:
push:
tags:
- "v*.*.*"

jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-22.04
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v2
with:
profile: minimal
toolchain: stable
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git-cliff
uses: actions-rs/cargo@v1
id: git-cliff
with:
command: install
args: git-cliff
- name: Run git-cliff to generate changelog
run: git-cliff -vv --latest --no-exec --github-repo ${{ github.repository }} --config cliff.toml
id: barkit

publish-binaries:
name: Publish binaries
needs: generate-changelog
runs-on: ${{ matrix.build.os }}
strategy:
fail-fast: false
matrix:
build:
- {
NAME: linux-x64-glibc,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-gnu,
NPM_PUBLISH: true,
}
- {
NAME: linux-x64-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-musl,
NPM_PUBLISH: false,
}
- {
NAME: linux-x86-glibc,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-gnu,
NPM_PUBLISH: false,
}
- {
NAME: linux-x86-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-musl,
NPM_PUBLISH: false,
}
- {
NAME: linux-arm64-glibc,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-gnu,
NPM_PUBLISH: true,
}
- {
NAME: linux-arm64-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-musl,
NPM_PUBLISH: false,
}
- {
NAME: win32-x64-mingw,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: x86_64-pc-windows-gnu,
NPM_PUBLISH: false,
}
- {
NAME: win32-x64-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: x86_64-pc-windows-msvc,
NPM_PUBLISH: true,
}
- {
NAME: win32-x86-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: i686-pc-windows-msvc,
NPM_PUBLISH: false,
}
- {
NAME: win32-arm64-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: aarch64-pc-windows-msvc,
NPM_PUBLISH: true,
}
- {
NAME: darwin-x64,
OS: macos-14,
TOOLCHAIN: stable,
TARGET: x86_64-apple-darwin,
NPM_PUBLISH: true,
}
- {
NAME: darwin-arm64,
OS: macos-14,
TOOLCHAIN: stable,
TARGET: aarch64-apple-darwin,
NPM_PUBLISH: true,
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> "$GITHUB_ENV"
- name: Install dependencies
shell: bash
run: |
if [[ "${{ matrix.build.NAME }}" == *"-musl" ]]; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated musl-tools
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.build.TOOLCHAIN }}
target: ${{ matrix.build.TARGET }}
override: true
- name: Build (linux/macos)
if: matrix.build.OS != 'windows-2022'
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --locked --target ${{ matrix.build.TARGET }}
- name: Build (windows)
if: matrix.build.OS == 'windows-2022'
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.build.TARGET }} # --no-default-features
- name: Prepare release assets
shell: bash
run: |
mkdir -p release/
cp "{LICENSE,README.md,CHANGELOG.md}" release/
for bin in 'barkit'; do
if [ "${{ matrix.build.OS }}" = "windows-2022" ]; then
bin="${bin}.exe"
fi
cp "target/${{ matrix.build.TARGET }}/release/${bin}" release/
done
mv release/ barkit-${{ env.RELEASE_VERSION }}/
- name: Create release artifacts
shell: bash
run: |
if [ "${{ matrix.build.OS }}" = "windows-2022" ]; then
7z a -tzip "barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.zip" \
barkit-${{ env.RELEASE_VERSION }}/
else
tar -czvf barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.tar.gz \
barkit-${{ env.RELEASE_VERSION }}/
shasum -a 512 barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.tar.gz \
> barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.tar.gz.sha512
fi
- name: Sign the release
if: matrix.build.OS == 'ubuntu-22.04' || matrix.build.OS == 'macos-14'
run: |
echo "${{ secrets.GPG_RELEASE_KEY }}" | base64 --decode > private.key
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback \
--passphrase-fd 0 --import private.key
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback \
--passphrase-fd 0 --detach-sign \
barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}.tar.gz
- name: Publish to GitHub
if: ${{ !contains(github.ref, '-') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.API_TOKEN }}
file: barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: "Release v${{ env.RELEASE_VERSION }}"
body: "${{ needs.generate-changelog.outputs.release_body }}"
- name: Publish to GitHub (pre-release)
if: ${{ contains(github.ref, '-') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.API_TOKEN }}
file: barkit-${{ env.RELEASE_VERSION }}-${{ matrix.build.TARGET }}*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: "Pre-release v${{ env.RELEASE_VERSION }}"
prerelease: true
nsyzrantsev marked this conversation as resolved.
Show resolved Hide resolved

publish-crates-io:
name: Publish on crates.io
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the release version
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Publish the barkit-extract binary
run: |
cargo publish --allow-dirty --manifest-path barkit-extract/Cargo.toml \
--locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish the barkit binary
run: |
cargo publish --allow-dirty --manifest-path Cargo.toml \
--locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
nsyzrantsev marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading