Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Nov 12, 2024
0 parents commit 9c4fb3d
Show file tree
Hide file tree
Showing 20 changed files with 9,105 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

# These are some variables that configure the build so that the binary size is reduced.
# Inspiration was taken from this blog: https://arusahni.net/blog/2020/03/optimizing-rust-binary-size.html
# They only enable it on main and releases.
[profile.release-min-size]
inherits = "release"
# Enable Link Time Optimization (LTO) for our release builds. This increases link time but drastically reduces
# binary size.
lto = true
# Use a single code gen unit. This effectively disables parallel linking but ensures that everything is linked
# together in a single unit which reduces the file-size at the cost of link time.
# Default for a release build is 16
codegen-units = 1
# Strip the binaries. This reduces the filesize of the final release.
strip = true
# Optimize the binary for size. This reduces the filesize at the cost of a slower binary.
opt-level = "z"
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @pavelzw
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Motivation

<!-- Why is this change necessary? Link issues here if applicable. -->

# Changes

<!-- What changes have been performed? -->
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
gh-actions:
patterns:
- "*"
commit-message:
prefix: ci
- package-ecosystem: cargo
directory: /
schedule:
interval: monthly
groups:
rust-dependencies:
patterns:
- "*"
commit-message:
prefix: build
labels:
- dependencies
90 changes: 90 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ------------------------------------- PULL REQUEST LABELS ------------------------------------- #
autolabeler:
# Conventional Commit Types (https://github.com/commitizen/conventional-commit-types)
- label: build
title:
- '/^build(\(.*\))?(\!)?\:/'
- label: chore
title:
- '/^chore(\(.*\))?(\!)?\:/'
- label: ci
title:
- '/^ci(\(.*\))?(\!)?\:/'
- label: documentation
title:
- '/^docs(\(.*\))?(\!)?\:/'
- label: enhancement
title:
- '/^feat(\(.*\))?(\!)?\:/'
- label: fix
title:
- '/^fix(\(.*\))?(\!)?\:/'
- label: performance
title:
- '/^perf(\(.*\))?(\!)?\:/'
- label: refactor
title:
- '/^refactor(\(.*\))?(\!)?\:/'
- label: revert
title:
- '/^revert(\(.*\))?(\!)?\:/'
- label: style
title:
- '/^style(\(.*\))?(\!)?\:/'
- label: test
title:
- '/^test(\(.*\))?(\!)?\:/'
# Custom Types
- label: breaking
title:
- '/^[a-z]+(\(.*\))?\!\:/'
# not used but required s.t. release-drafter doesn't complain
category-template: "### $TITLE"
change-template: "- $TITLE by @$AUTHOR in [#$NUMBER]($URL)"
replacers:
# remove conventional commit tag & scope from change list
- search: '/- [a-z]+(\(.*\))?(\!)?\: /g'
replace: "- "
template: |
## What's Changed
$CHANGES
**Full Changelog:** [`$PREVIOUS_TAG...v$RESOLVED_VERSION`](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION)
categories:
- title: ⚠️ Breaking Changes
labels:
- breaking
- title: ✨ New Features
labels:
- enhancement
- title: 🐞 Bug Fixes
labels:
- fix
- title: 🏎️ Performance Improvements
labels:
- performance
- title: 📚 Documentation
labels:
- documentation
- title: 🏗️ Testing
labels:
- test
- title: ⚙️ Automation
labels:
- ci
- title: 🛠 Builds
labels:
- build
- title: 💎 Code Style
labels:
- style
- title: 📦 Refactorings
labels:
- refactor
- title: ♻️ Chores
labels:
- chore
- title: 🗑 Reverts
labels:
- revert
36 changes: 36 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
changelog:
exclude:
labels:
- ignore for release
categories:
- title: 🚨 Breaking changes
labels:
- breaking
- title: ✨ New features
labels:
- enhancement
- title: 🚀 Performance
labels:
- performance
- title: 🐛 Bug fixes
labels:
- bug
- fix
- title: 📝 Documentation
labels:
- documentation
- title: 🧪 Tests
labels:
- test
- title: ⬆️ Dependencies
labels:
- dependencies
- title: 🤖 CI
labels:
- ci
- title: 🏗️ Refactor
labels:
- refactor
- title: 🤷🏻 Other changes
labels:
- "*"
108 changes: 108 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Build
on:
pull_request:
push:
branches: [main]

jobs:
metadata:
name: Check if version changed
runs-on: ubuntu-latest
outputs:
optimize-build: ${{ github.event_name == 'push' }}
release: ${{ github.event_name == 'push' && github.repository == 'Quantco/pixi-pack' && steps.version-metadata.outputs.changed == 'true' }}
version: ${{ steps.version-metadata.outputs.newVersion }}
steps:
- name: Checkout source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: Quantco/ui-actions/version-metadata@a0653e9fc0ee3c4be9f7cc88e509e40536e9f3c1 # v1.0.15
id: version-metadata
with:
file: ./Cargo.toml
token: ${{ secrets.GITHUB_TOKEN }}
version-extraction-override: 'regex:version = "(.*)"'

build:
name: Build Binary (${{ matrix.target }})
runs-on: ${{ matrix.os }}
needs: [metadata]
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
- target: x86_64-apple-darwin
os: macos-13
cross: false
steps:
- name: Checkout source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Rust cache
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
with:
key: build-${{ matrix.target }}-${{ needs.metadata.outputs.optimize-build }}-${{ matrix.cross }}-${{ matrix.os }}

- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Build
run: |
${{ matrix.cross && 'cross' || 'cargo' }} build --profile ${{ needs.metadata.outputs.optimize-build && 'release-min-size' || 'release'}} --color always${{ endsWith(matrix.target, 'musl') && ' --no-default-features --features rustls-tls' || '' }} --target ${{ matrix.target }}
mv target/${{ matrix.target }}/${{ needs.metadata.outputs.optimize-build && 'release-min-size' || 'release' }}/pixi-pack${{ endsWith(matrix.target, 'windows-msvc') && '.exe' || '' }} pixi-pack-${{ matrix.target }}${{ endsWith(matrix.target, 'windows-msvc') && '.exe' || '' }}
- name: Upload Artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: pixi-pack-${{ matrix.target }}
path: pixi-pack-${{ matrix.target }}${{ endsWith(matrix.target, 'windows-msvc') && '.exe' || '' }}
if-no-files-found: error

release:
name: Create Release
needs: [metadata, build]
if: needs.metadata.outputs.release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: pixi-pack-*
merge-multiple: true
- name: Push v${{ needs.metadata.outputs.version }} tag
run: |
git tag v${{ needs.metadata.outputs.version }}
git push origin v${{ needs.metadata.outputs.version }}
- name: Create Release
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
generate_release_notes: true
tag_name: v${{ needs.metadata.outputs.version }}
draft: true
files: pixi-pack-*
58 changes: 58 additions & 0 deletions .github/workflows/chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Chore
on:
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check valid conventional commit message
id: lint
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
with:
subjectPattern: ^[A-Za-z].+[^. ]$ # subject must start with letter and may not end with a dot/space
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Post comment about invalid PR title
if: failure()
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
header: conventional-commit-pr-title
message: |
Thank you for opening this pull request! 👋🏼
This repository requires pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
<details><summary><b>Details</b></summary>
```
${{ steps.lint.outputs.error_message }}
```
</details>
- name: Delete comment about invalid PR title
if: success()
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
header: conventional-commit-pr-title
delete: true

- name: Assign labels
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
with:
disable-releaser: true
disable-autolabeler: false
env:
GITHUB_TOKEN: ${{ github.token }}
Loading

0 comments on commit 9c4fb3d

Please sign in to comment.