Skip to content

Commit

Permalink
chore: ci4
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Nov 28, 2023
1 parent eb22411 commit 0b7f632
Showing 1 changed file with 162 additions and 158 deletions.
320 changes: 162 additions & 158 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ jobs:
fail-fast: false
matrix:
include:
# - target: aarch64-unknown-linux-gnu
- target: aarch64-unknown-linux-gnu
- target: aarch64-unknown-linux-musl
npm: linux-arm64
# - target: aarch64-apple-darwin
# os: macos-latest
# npm: darwin-arm64
# - target: x86_64-unknown-linux-gnu
# - target: x86_64-unknown-linux-musl
# npm: linux-x64
# - target: x86_64-apple-darwin
# os: macos-latest
# npm: darwin-x64
# - target: x86_64-pc-windows-msvc
# os: windows-latest
# npm: windows-x64
# - target: x86_64-unknown-freebsd
- target: aarch64-apple-darwin
os: macos-latest
npm: darwin-arm64
- target: x86_64-unknown-linux-gnu
- target: x86_64-unknown-linux-musl
npm: linux-x64
- target: x86_64-apple-darwin
os: macos-latest
npm: darwin-x64
- target: x86_64-pc-windows-msvc
os: windows-latest
npm: windows-x64
- target: x86_64-unknown-freebsd

permissions:
contents: write
Expand Down Expand Up @@ -111,25 +111,29 @@ jobs:
os: linux
arch: arm64
bin: homestar
# - target: x86_64-unknown-linux-musl
# os: linux
# arch: x64
# - target: aarch64-apple-darwin
# os: darwin
# arch: arm64
# - target: x86_64-apple-darwin
# npm: darwin-x64
# os: darwin
# arch: x64
# - target: x86_64-pc-windows-msvc
# os: windows
# arch: x64
- target: x86_64-unknown-linux-musl
os: linux
arch: x64
bin: homestar
- target: aarch64-apple-darwin
os: darwin
arch: arm64
bin: homestar
- target: x86_64-apple-darwin
npm: darwin-x64
os: darwin
arch: x64
bin: homestar
- target: x86_64-pc-windows-msvc
os: windows
arch: x64
bin: homestar.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: cargo get
run: cargo install cargo-get
- name: prerelease
- name: prepare os/arch packages
shell: bash
env:
node_os: ${{ matrix.os }}
Expand All @@ -142,12 +146,12 @@ jobs:
cd homestar-runtime/npm
mkdir -p "${node_pkg}/bin"
envsubst < package.json.tmpl > "${node_pkg}/package.json"
- name: donwload artifact
- name: download build artifacts
uses: actions/download-artifact@v2
with:
name: ${{ matrix.target }}
path: "homestar-runtime/npm/${{ env.node_pkg }}/bin"
- name: ls
- name: publish rc or production
run: |
cd "homestar-runtime/npm/${{ env.node_pkg }}"
npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false
Expand All @@ -156,131 +160,131 @@ jobs:
# build-packages:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# include:
# - target: x86_64-unknown-linux-gnu
# - target: x86_64-unknown-linux-musl
# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Install musl-tools
# run: sudo apt update && sudo apt install -y musl-dev musl-tools
# if: matrix.target == 'x86_64-unknown-linux-musl'

# - name: Install Rust toolchain
# id: toolchain
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# targets: ${{ matrix.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:
# tool: cargo-deb

# - name: Install cargo-generate-rpm
# uses: taiki-e/cache-cargo-install-action@v1
# with:
# tool: cargo-generate-rpm

# - name: Cache Project
# uses: Swatinem/rust-cache@v2
# with:
# cache-on-failure: true
# shared-key: check-${{ matrix.target }}-ubuntu-latest

# - name: Create .deb
# run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb

# - name: Create .rpm
# run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm

# - name: Upload Release Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.target }}
# path: |
# *.deb
# *.rpm
# if-no-files-found: error

# - name: Publish Package in Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published'
# with:
# files: |
# *.deb
# *.rpm

# docker-build:
# runs-on: ubuntu-latest

# env:
# DOCKER_BUILDKIT: '1'
# REGISTRY: ghcr.io
# IMAGE_NAME: ${{ github.repository }}

# permissions:
# contents: read
# id-token: write
# packages: write

# steps:
# - 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:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Setup QEMU
# uses: docker/setup-qemu-action@v3

# - name: Setup Buildx
# uses: docker/setup-buildx-action@v3

# - name: Metadata
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# tags: |
# type=semver,pattern=v{{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=raw,value=latest
# type=sha

# - name: Docker Build & Push
# uses: docker/build-push-action@v5
# with:
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# cache-to: type=inline
# file: docker/Dockerfile
# context: .
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
build-packages:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
- target: x86_64-unknown-linux-musl
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install musl-tools
run: sudo apt update && sudo apt install -y musl-dev musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'

- name: Install Rust toolchain
id: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.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:
tool: cargo-deb

- name: Install cargo-generate-rpm
uses: taiki-e/cache-cargo-install-action@v1
with:
tool: cargo-generate-rpm

- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: check-${{ matrix.target }}-ubuntu-latest

- name: Create .deb
run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb

- name: Create .rpm
run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm

- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: |
*.deb
*.rpm
if-no-files-found: error

- name: Publish Package in Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published'
with:
files: |
*.deb
*.rpm
docker-build:
runs-on: ubuntu-latest

env:
DOCKER_BUILDKIT: '1'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: read
id-token: write
packages: write

steps:
- 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:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Setup Buildx
uses: docker/setup-buildx-action@v3

- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
type=sha
- name: Docker Build & Push
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
file: docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 0b7f632

Please sign in to comment.