Skip to content

Release

Release #115

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
RUSTFLAGS: -D warnings -W unreachable-pub -W rust-2021-compatibility
RUSTUP_MAX_RETRIES: 10
CARGO_INCREMENTAL: 0
defaults:
run:
shell: bash
jobs:
version:
name: Version
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
- id: version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
linux-releases:
needs: version
name: Linux (${{ matrix.target.triple }}, glibc${{ matrix.target.glibc }})
runs-on: ubuntu-latest
strategy:
matrix:
target:
- { image: "ubuntu:22.04", triple: x86_64-unknown-linux-gnu, glibc: 2.35 }
- { image: "ubuntu:20.04", triple: x86_64-unknown-linux-gnu, glibc: 2.31 }
- { image: "debian:10", triple: x86_64-unknown-linux-gnu, glibc: 2.28 }
# - { image: "centos:centos7", triple: x86_64-unknown-linux-gnu, glibc: 2.17 }
container:
image: ${{ matrix.target.image }}
steps:
- name: "Print glibc version"
run: ldd --version
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-cargo-stable-${{ matrix.target.triple }}-glibc${{ matrix.target.glibc }}-${{ hashFiles('**/Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/git/db/
~/.cargo/registry/cache/
~/.cargo/registry/index/
target/
- name: "Install packages (Ubuntu)"
if: ${{ startsWith(matrix.target.image, 'ubuntu') }}
run: apt-get update && apt-get install curl build-essential -y
- name: "Install packages (Debian)"
if: ${{ startsWith(matrix.target.image, 'debian') }}
run: apt-get update && apt-get install curl build-essential -y
- name: "Install packages (CentOS)"
if: ${{ startsWith(matrix.target.image, 'centos') }}
run: yum install gcc -y
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target.triple }}
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- name: "Strip release binary"
run: |
# strip target/release/pica-lint
strip target/release/pica
- name: "Build release archive"
id: build-archive
shell: bash
run: |
staging="pica-${{ needs.version.outputs.VERSION }}-${{ matrix.target.triple }}-glibc${{ matrix.target.glibc }}"
mkdir "$staging"
cp README.md LICENSE UNLICENSE "$staging/"
cp "target/release/pica" "$staging/"
./target/release/pica completions bash > "$staging/pica.bash"
./target/release/pica completions fish > "$staging/pica.fish"
./target/release/pica completions zsh > "$staging/pica.zsh"
tar cfvz "$staging.tar.gz" "$staging/"
echo "filename=$staging.tar.gz" >> $GITHUB_OUTPUT
echo "ASSET_PATH=$staging.tar.gz" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ASSET_PATH }}
path: ${{ env.ASSET_PATH }}
retention-days: 5
windows-releases:
needs: version
name: Windows (${{matrix.target.triple}})
runs-on: windows-latest
strategy:
matrix:
target:
- { triple: x86_64-pc-windows-msvc, variant: "MSVC" }
- { triple: x86_64-pc-windows-gnu, variant: "GNU" }
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-cargo-stable-${{ matrix.target.triple }}-${{ hashFiles('**/Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/git/db/
~/.cargo/registry/cache/
~/.cargo/registry/index/
target/
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target.triple }}
override: true
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- name: "Build release archive"
id: build-archive
shell: bash
run: |
staging="pica-${{ needs.version.outputs.VERSION }}-${{ matrix.target.triple }}"
mkdir "$staging"
cp README.md LICENSE UNLICENSE "$staging/"
cp "target/release/pica.exe" "$staging/"
cp "target/release/pica-lint.exe" "$staging/"
7z a "$staging.zip" "$staging/"
echo "ASSET_PATH=$staging.zip" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ASSET_PATH }}
path: ${{ env.ASSET_PATH }}
retention-days: 5
macos-releases:
name: macOS (${{ matrix.target.triple }})
needs: version
runs-on: macos-latest
strategy:
matrix:
target:
- { triple: x86_64-apple-darwin }
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-cargo-stable-${{ matrix.target.triple }}-${{ hashFiles('**/Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/git/db/
~/.cargo/registry/cache/
~/.cargo/registry/index/
target/
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target.triple }}
override: true
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- name: "Strip release binary"
run: |
strip target/release/pica-lint
strip target/release/pica
- name: "Build release archive"
shell: bash
run: |
staging="pica-${{ needs.version.outputs.VERSION }}-${{ matrix.target.triple }}"
mkdir "$staging"
cp README.md LICENSE UNLICENSE "$staging/"
cp "target/release/pica-lint" "$staging/"
cp "target/release/pica" "$staging/"
tar cfvz "$staging.tar.gz" "$staging/"
echo "ASSET_PATH=$staging.tar.gz" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ASSET_PATH }}
path: ${{ env.ASSET_PATH }}
retention-days: 5
packages:
needs: [linux-releases, version]
name: Package (${{ matrix.target.format }}, glibc${{ matrix.target.glibc }})
runs-on: ubuntu-latest
strategy:
matrix:
target:
# - { triple: x86_64-unknown-linux-gnu, glibc: 2.17, format: deb }
# - { triple: x86_64-unknown-linux-gnu, glibc: 2.17, format: rpm }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.28, format: deb }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.28, format: rpm }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.31, format: deb }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.31, format: rpm }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.35, format: deb }
- { triple: x86_64-unknown-linux-gnu, glibc: 2.35, format: rpm }
steps:
- uses: actions/checkout@v4
- name: Download binary release
uses: actions/download-artifact@v3
with:
name: pica-${{ needs.version.outputs.VERSION }}-${{ matrix.target.triple }}-glibc${{ matrix.target.glibc }}.tar.gz
- name: Extract binary release
run: |
tar xfvz pica-${{ needs.version.outputs.VERSION }}-${{ matrix.target.triple }}-glibc${{ matrix.target.glibc }}.tar.gz --strip-components=1
- name: Build package
uses: kentik/pkg@master
id: build_rpm
with:
name: pica
version: ${{ needs.version.outputs.VERSION }}-glibc${{ matrix.target.glibc }}
arch: x86_64
format: ${{ matrix.target.format }}
package: .github/actions-rs/package.yaml
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.build_rpm.outputs.package }}
path: ${{ steps.build_rpm.outputs.package }}
retention-days: 5
check:
name: Test Packages (${{ matrix.target.name }})
needs: [packages, version]
runs-on: ubuntu-latest
container: ${{ matrix.target.image }}
strategy:
matrix:
target:
- { name: "Debian 11", image: "debian:11", glibc: 2.31 }
- { name: "Debian 10", image: "debian:10", glibc: 2.28 }
- { name: "Ubuntu 22.04", image: "ubuntu:22.04", glibc: 2.35 }
- { name: "Ubuntu 21.10", image: "ubuntu:21.10", glibc: 2.35 }
- { name: "Ubuntu 20.04", image: "ubuntu:20.04", glibc: 2.31 }
# - { name: "CentOS 7", image: "centos:7", glibc: 2.17 }
- { name: "CentOS 8", image: "centos:8", glibc: 2.28 }
steps:
- name: "Download Package (DEB)"
if: ${{ !startsWith(matrix.target.name, 'CentOS') }}
uses: actions/download-artifact@v2
with:
name: pica_${{ needs.version.outputs.VERSION }}-glibc${{ matrix.target.glibc}}-1_amd64.deb
- name: "Download Package (RPM)"
if: ${{ startsWith(matrix.target.name, 'CentOS') }}
uses: actions/download-artifact@v2
with:
name: pica-${{ needs.version.outputs.VERSION }}-glibc${{ matrix.target.glibc }}-1.x86_64.rpm
- name: Fix CentoOS8
if: matrix.target.image == 'centos:8'
run: |
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update -y
cd
- name: Install Pica (Ubuntu / Debian)
if: ${{ !startsWith(matrix.target.name, 'CentOS') }}
run: dpkg -i pica_${{ needs.version.outputs.VERSION }}-glibc${{ matrix.target.glibc }}-1_amd64.deb
- name: Install Pica (CentOS)
if: ${{ startsWith(matrix.target.name, 'CentOS') }}
run: yum -y install pica-${{ needs.version.outputs.VERSION }}-glibc${{ matrix.target.glibc }}-1.x86_64.rpm
- name: Pica Version
run: |
pica --version
gh-release:
name: "Release"
runs-on: ubuntu-latest
needs:
- linux-releases
- macos-releases
- windows-releases
- check
- packages
- version
steps:
- name: "Download releases/packages"
uses: actions/download-artifact@v3
- name: Assemble data
run: |
mkdir uploads/
mv pica-*/*.tar.gz uploads/
mv pica-*/*.rpm uploads/
mv pica_*/*.deb uploads/
mv pica-*/*.zip uploads/
tree uploads/
cd uploads/
sha256sum * > CHECKSUMS
cd ..
- name: "GH Release"
uses: softprops/action-gh-release@v1
with:
draft: true
files: uploads/*