Skip to content

chore: release v0.1.13 #450

chore: release v0.1.13

chore: release v0.1.13 #450

Workflow file for this run

on:
pull_request: {}
push:
branches:
- master
tags: [ 'v*.*.*' ]
name: CI
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check that Cargo.lock is up-to-date
run: cargo metadata --format-version 1 --locked
- name: Run cargo fmt
run: cargo fmt --check
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo check
run: cargo check
test:
strategy:
matrix:
runner: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: cargo test
versions:
runs-on: ubuntu-latest
steps:
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack,cargo-minimal-versions
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
# Check with minimal dependency versions and MSRV from Cargo.toml
- name: Check minimal versions
run: cargo minimal-versions check --rust-version --features vendored-openssl,vendored-libgit2
semver:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
flake:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install nix
uses: DeterminateSystems/nix-installer-action@v12
- name: Cache nix dependencies
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: nix flake check
update-release-draft:
runs-on: ubuntu-latest
if: github.repository == 'coralogix/protofetch' && github.ref == 'refs/heads/master'
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package:
needs: [ lint, test, versions, semver ]
strategy:
fail-fast: false
matrix:
target:
- rust: aarch64-unknown-linux-musl
runner: ubuntu-latest
tar: tar
cross: true
ext:
- rust: x86_64-unknown-linux-musl
runner: ubuntu-latest
tar: tar
cross: true
ext:
- rust: aarch64-apple-darwin
runner: macos-14
# We use gtar to make sure compressed files are not detected as sparse
tar: gtar
cross: false
ext:
- rust: x86_64-apple-darwin
runner: macos-13
# We use gtar to make sure compressed files are not detected as sparse
tar: gtar
cross: false
ext:
- rust: x86_64-pc-windows-msvc
runner: windows-latest
tar: tar
cross: false
ext: '.exe'
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target.rust }}
- name: Install cross
if: ${{ matrix.target.cross }}
run: cargo install --locked cross
- name: Build
run: ${{ matrix.target.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target.rust }} --features vendored-openssl,vendored-libgit2
- name: Package
run: |
mv target/${{ matrix.target.rust }}/release bin/
${{ matrix.target.tar }} -czvf protofetch_${{ matrix.target.rust }}.tar.gz bin/protofetch${{ matrix.target.ext }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.target.rust }}
path: protofetch_${{ matrix.target.rust }}.tar.gz
test-npm-package:
needs: [ package ]
strategy:
fail-fast: false
matrix:
os:
- runner: ubuntu-latest
platform: x86_64-unknown-linux-musl
- runner: macos-14
platform: aarch64-apple-darwin
- runner: macos-13
platform: x86_64-apple-darwin
- runner: windows-latest
platform: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: package-${{ matrix.os.platform }}
path: artifacts
- name: Setup test environment
shell: bash
run: |
# Prepare test package with test version
node .github/npm/prepare-package.js --package coralogix-protofetch --version 0.0.0-test
- name: Start HTTP server
shell: bash
run: |
cd artifacts
python3 -m http.server 8000 &
echo $! > /tmp/http_server.pid
sleep 2
echo "HTTP server started on port 8000"
- name: Test npm installation
shell: bash
run: |
cd .github/npm/dist/coralogix-protofetch
# Install dependencies
npm install --ignore-scripts
# Run installation script with custom URL pointing to local HTTP server
node scripts.js install --url=http://localhost:8000/protofetch_${{ matrix.os.platform }}.tar.gz
# Verify binary was extracted and works
if [ "${{ runner.os }}" = "Windows" ]; then
./bin/protofetch.exe --version
else
./bin/protofetch --version
fi
# Clean up
rm -rf node_modules package-lock.json bin/
- name: Test pnpm installation
shell: bash
run: |
cd .github/npm/dist/coralogix-protofetch
# Install dependencies
pnpm install --ignore-scripts
# Run installation script with custom URL pointing to local HTTP server
node scripts.js install --url=http://localhost:8000/protofetch_${{ matrix.os.platform }}.tar.gz
# Verify binary was extracted and works
if [ "${{ runner.os }}" = "Windows" ]; then
./bin/protofetch.exe --version
else
./bin/protofetch --version
fi
- name: Stop HTTP server
if: always()
shell: bash
run: |
if [ -f /tmp/http_server.pid ]; then
kill $(cat /tmp/http_server.pid) || true
fi
release:
runs-on: ubuntu-latest
if: github.repository == 'coralogix/protofetch' && startsWith(github.ref, 'refs/tags/')
needs: [ package, test-npm-package ]
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Publish cargo package
run: cargo publish --token ${{ env.CRATES_IO_TOKEN }}
- name: Publish npm package (cx-protofetch)
run: |
node .github/npm/prepare-package.js --package cx-protofetch
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc"
npm publish .github/npm/dist/cx-protofetch
- name: Publish npm package (@coralogix/protofetch)
run: |
node .github/npm/prepare-package.js --package coralogix-protofetch
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc"
npm publish .github/npm/dist/coralogix-protofetch
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: package-*
merge-multiple: true
- name: Upload release artifacts
uses: softprops/action-gh-release@v1
with:
files: |
protofetch_aarch64-unknown-linux-musl.tar.gz
protofetch_x86_64-unknown-linux-musl.tar.gz
protofetch_aarch64-apple-darwin.tar.gz
protofetch_x86_64-apple-darwin.tar.gz
protofetch_x86_64-pc-windows-msvc.tar.gz