Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
protochron committed Mar 18, 2024
0 parents commit 75982eb
Show file tree
Hide file tree
Showing 32 changed files with 8,842 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
target/
Dockerfile
Makefile
104 changes: 104 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and Test
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint
run: |
cargo clippy -- --no-deps
- name: Test
run: |
cargo test
build:
needs:
- check
strategy:
matrix:
arch: ["x86_64", "aarch64"]
runs-on: ubuntu-latest
if: startswith(github.ref, 'refs/tags/v') # Only run on tag push
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2

- name: Add musl targets
run: |
rustup target add ${{ matrix.arch }}-unknown-linux-musl
- name: Install cargo-zigbuild
run: |
cargo install cargo-zigbuild
- name: Build
run: |
cargo zigbuild --release --target ${{matrix.arch}}-unknown-linux-musl
- name: Store artifact
uses: actions/upload-artifact@v4
with:
name: wasmcloud-operator-${{matrix.arch}}
path: target/${{matrix.arch}}-unknown-linux-musl/release/wasmcloud-operator

release:
needs:
- build
runs-on: ubuntu-latest
if: startswith(github.ref, 'refs/tags/v') # Only run on tag push
steps:
- uses: actions/checkout@v4

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=
type=semver,pattern={{version}}
- name: Load artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Fix permissions and architectures
run: |
mv artifacts/wasmcloud-operator-x86_64/wasmcloud-operator artifacts/wasmcloud-operator-amd64
mv artifacts/wasmcloud-operator-aarch64/wasmcloud-operator artifacts/wasmcloud-operator-arm64
chmod +x artifacts/wasmcloud-operator*
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
build-args: "BIN_PATH=artifacts/wasmcloud-operator"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
Loading

0 comments on commit 75982eb

Please sign in to comment.