From a223a96ea9b9bbbf7684e6ac1d442d91dba3944e Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Fri, 7 Jun 2024 22:13:23 +0200 Subject: [PATCH] CI: Publish binaries using GitHub Actions on new tag Because of time constraints and because the workflow itself may need some additional work to support multiple operating systems without making individual releases for every target architecture and operating system, builds are only generated for Linux (amd64). New releases are marked as "Drafts" by default, so as to allow maintainers to edit the text before publication. Fixes https://github.com/hermit-os/uhyve/issues/256 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ .gitignore | 10 +++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ad210c9..64398672 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' }} - name: Clippy run: cargo clippy --all-targets ${{ matrix.flags }} -- -D warnings - + clippy-test-kernel: name: Clippy test-kernels runs-on: ubuntu-latest @@ -124,7 +124,7 @@ jobs: # TODO: Remove once we have a hermit toolchain upgrade # capable of sparse registries CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git - + coverage: name: Coverage runs-on: [self-hosted] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..09d78eaf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + release: + name: Create new release + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + filename_suffix: "${{ github.ref_name }}-linux-amd64" + steps: + - uses: actions/checkout@v4 + - run: gh release create ${{ github.ref }} --draft --title "Uhyve ${{ github.ref_name }}" + if: startsWith(matrix.os, 'ubuntu') + - uses: dtolnay/rust-toolchain@stable + - run: cargo build --release --locked + # Adapted from: https://github.com/mkroening/edu-sync/blob/main/.github/workflows/release.yml + - name: Create archive + run: | + DIST=uhyve-${{ matrix.filename_suffix }} + mkdir $DIST + + mv target/release/uhyve $DIST + cp README.md $DIST + cp LICENSE-* $DIST + + tar czf $DIST.tar.gz $DIST + echo "FILE=$DIST.tar.gz" >> $GITHUB_ENV + - run: gh release upload ${{ github.ref }} $FILE diff --git a/.gitignore b/.gitignore index 1150d729..e784999d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,14 @@ -/target +# Taken from: https://github.com/github/gitignore/blob/main/Rust.gitignore +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ # Coverage lcov.info *.profraw *.profdata -.vscode \ No newline at end of file +# +.vscode +.DS_Store