diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index c8db6236..dd87191d 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -1,5 +1,7 @@ name: ⚃ Builds +# TODO: brew formula (Macs), cargo-wix (Windows Installs), cargo-aur (Arch) + on: workflow_dispatch: inputs: @@ -11,6 +13,10 @@ on: release: types: [published] + # for debugging + # pull_request: + # branches: [ '**' ] + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -50,9 +56,6 @@ jobs: id: toolchain uses: dtolnay/rust-toolchain@stable - - name: Override rust-toolchain.toml - run: rustup override set ${{steps.toolchain.outputs.name}} - - name: Cache Project uses: Swatinem/rust-cache@v2 with: @@ -68,7 +71,20 @@ jobs: run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}" if: endsWith(matrix.target, 'windows-msvc') + - name: Compile + if: github.event_name != 'release' + run: cargo build -p homestar-runtime --locked --release --target ${{ matrix.target }} + + - name: Upload Release Artifacts + if: github.event_name != 'release' + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target }} + path: target/${{ matrix.target }}/release/homestar* + if-no-files-found: error + - name: Publish Binary in Release + if: github.event_name == 'release' && github.event.action == 'published' uses: taiki-e/upload-rust-binary-action@v1 with: bin: homestar @@ -91,6 +107,16 @@ jobs: - name: Install musl-tools run: sudo apt update && sudo apt install -y musl-dev musl-tools + - name: Install Rust toolchain + id: toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: ${{ env.LINUX_TARGET }} + + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Install cargo-deb uses: taiki-e/cache-cargo-install-action@v1 with: @@ -108,29 +134,27 @@ jobs: shared-key: check-${{ env.LINUX_TARGET }}-ubuntu-latest - name: Create .deb - run: cargo deb -p homestar-runtime --target ${{env.LINUX_TARGET}} + run: cargo deb -p homestar-runtime --target ${{ env.LINUX_TARGET }} --output homestar.deb - name: Create .rpm - run: cargo generate-rpm + run: cargo generate-rpm -p homestar-runtime --target ${{ env.LINUX_TARGET }} --output homestar.rpm - - name: Publish Release Artifacts + - name: Upload Release Artifacts uses: actions/upload-artifact@v3 with: - name: ${{ matrix.target }} + name: ${{ env.LINUX_TARGET }} path: | - target/generate-rpm/ - target/${{env.LINUX_TARGET}}/debian/ + *.deb + *.rpm if-no-files-found: error - name: Publish Package in Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published' with: files: | - target/${{env.LINUX_TARGET}}/debian/*.deb - target/generate-rpm/*.rpm - - # TODO: brew formula (Macs), cargo-wix (Windows Installs), cargo-aur (Arch) + *.deb + *.rpm docker-build: runs-on: ubuntu-latest @@ -149,6 +173,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cleanup + run: | + # Workaround to provide additional free space for testing. + # https://github.com/actions/virtual-environments/issues/2840 + rm -rf /opt/hostedtoolcache + rm -rf /usr/share/dotnet + rm -rf /opt/ghc + rm -rf "$AGENT_TOOLSDIRECTORY" + sudo apt-get clean + sudo rm -rf /usr/share/dotnet + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -161,8 +196,6 @@ jobs: - name: Setup Buildx uses: docker/setup-buildx-action@v3 - with: - buildkitd-flags: "--debug" - name: Metadata id: meta diff --git a/homestar-runtime/Cargo.toml b/homestar-runtime/Cargo.toml index 8d124a69..b377d3f3 100644 --- a/homestar-runtime/Cargo.toml +++ b/homestar-runtime/Cargo.toml @@ -208,6 +208,7 @@ rustdoc-args = ["--cfg", "docsrs"] maintainer = "James Walker " license-file = ["LICENSE", "0"] extended-description-file = "README.md" +depends = "" section = "network" priority = "optional" assets = [