Merge pull request #372 from Mossaka/double-timeout #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
concurrency: | |
group: release-${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
tags: | |
- '**/v[0-9]+.[0-9]+.*' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
name: Generate | |
outputs: | |
crate: ${{ steps.parse-ref.outputs.crate }} | |
version: ${{ steps.parse-ref.outputs.version }} | |
runtime: ${{ steps.parse-ref.outputs.runtime }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- id: parse-ref | |
name: Parse ref | |
run: | | |
set -e | |
CRATE="$(cut -d/ -f1 <<<"${GITHUB_REF#refs/*/}")" | |
VERSION="$(cut -d/ -f2 <<<"${GITHUB_REF#refs/*/}")" | |
if [ -z "${CRATE}" ]; then | |
echo "::error::Could not determine crate name from ref '${GITHUB_REF}'" | |
exit 1 | |
fi | |
if [ -z "${VERSION}" ]; then | |
echo "::error::Could not determine version from ref '${GITHUB_REF}'" | |
exit 1 | |
fi | |
RUNTIME="$(cut -d- -f3 <<<"${CRATE}")" | |
echo "CRATE=${CRATE}" >> $GITHUB_OUTPUT | |
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
echo "RUNTIME=${RUNTIME}" >> $GITHUB_OUTPUT | |
setVersion="$(./scripts/version.sh "${CRATE}")" | |
if [ ! "${VERSION#v}" = "${setVersion}" ]; then | |
echo "::error::Version mismatch: tag version ${VERSION#v} != crate version ${setVersion}" | |
exit 1 | |
fi | |
build: | |
needs: | |
- generate | |
strategy: | |
matrix: | |
arch: ["x86_64", "aarch64"] | |
runs-on: "ubuntu-22.04" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup build env | |
run: ./scripts/setup-linux.sh | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
env: | |
RUST_CACHE_KEY_OS: rust-release-cache-${{ needs.generate.outputs.crate }}-${{ matrix.arch }} | |
with: | |
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile | |
- name: Setup cross-rs | |
run: ./scripts/setup-cross.sh ${{ matrix.arch }}-unknown-linux-musl | |
- name: Setup build profile | |
shell: bash | |
run: echo "OPT_PROFILE=release" >> ${GITHUB_ENV} | |
- name: Build | |
timeout-minutes: 20 | |
run: make build-${{ needs.generate.outputs.runtime }} | |
- name: Test | |
if: ${{ matrix.arch == 'x86_64' }} | |
timeout-minutes: 10 | |
run: make test-${{ needs.generate.outputs.runtime }} | |
- name: Package artifacts | |
if: ${{ needs.generate.outputs.runtime != 'wasm' }} | |
shell: bash | |
run: | | |
make dist-${{ needs.generate.outputs.runtime }} | |
# Check if there's any files to archive as tar fails otherwise | |
if stat dist/bin/* >/dev/null 2>&1; then | |
tar -czf dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz -C dist/bin . | |
else | |
tar -czf dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz -T /dev/null | |
fi | |
- name: Upload artifacts | |
if: ${{ needs.generate.outputs.runtime != 'wasm' }} | |
uses: actions/upload-artifact@master | |
with: | |
name: containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }} | |
path: dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz | |
release: | |
permissions: | |
contents: write | |
needs: | |
- build | |
- generate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artifacts | |
if: ${{ needs.generate.outputs.runtime != 'wasm' }} | |
uses: actions/download-artifact@master | |
with: | |
path: release | |
- name: Create release | |
run: | | |
gh release create ${{ github.ref }} --generate-notes --prerelease | |
env: | |
GH_TOKEN: ${{ github.token }} | |
RELEASE_NAME: ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }} | |
- name: Upload release artifacts | |
if: ${{ needs.generate.outputs.runtime != 'wasm' }} | |
run: | | |
for i in release/*/*; do | |
gh release upload ${RELEASE_NAME} $i | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} | |
RELEASE_NAME: ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }} | |
- name: Cargo publish | |
run: cargo publish --package ${{ needs.generate.outputs.crate }} --verbose --locked | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }} | |
- name: Check crates.io ownership | |
run: | | |
cargo owner --add github:containerd:runwasi-committers ${{ needs.generate.outputs.crate }} | |
cargo owner --list ${{ needs.generate.outputs.crate }} | grep github:containerd:runwasi-committers | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }} |