chore: v0.5.2 #127
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: ci | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- suborbital-v* | |
pull_request: | |
jobs: | |
test: | |
if: "false" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo | |
- uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo-target | |
- name: Install wasmtime-cli | |
run: cargo install --version 0.35.3 wasmtime-cli | |
- name: Install cargo-wasi | |
run: cargo install cargo-wasi | |
- name: Tests | |
run: make tests | |
- name: Lint | |
run: make fmt | |
core: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-wasi | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo | |
- uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo-target | |
- run: make core | |
- name: Upload core binary to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: engine | |
path: target/wasm32-wasi/release/javy_core.wasm | |
cli: | |
needs: core | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- arm64 | |
- amd64 | |
include: | |
- arch: arm64 | |
os: buildjet-2vcpu-ubuntu-2204-arm | |
target: aarch64-unknown-linux-gnu | |
- arch: amd64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: engine | |
path: crates/cli/ | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo | |
- uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.toml') }} | |
${{ runner.os }}-cargo-target | |
- run: cargo build --release --package javy | |
env: | |
JAVY_ENGINE_PATH: javy_core.wasm | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: javy-${{ matrix.arch }}-linux | |
path: target/release/javy | |
image: | |
needs: [cli] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: | |
- amd64 | |
- arm64 | |
include: | |
- arch: amd64 | |
os: ubuntu-latest | |
- arch: arm64 | |
os: buildjet-2vcpu-ubuntu-2204-arm | |
outputs: | |
amd64: ${{ steps.digests.outputs.amd64 }} | |
arm64: ${{ steps.digests.outputs.arm64 }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: | | |
image=moby/buildkit:v0.10.6 | |
# Build the image on pulls, main | |
- name: Build javy image | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
file: Dockerfile | |
load: true | |
push: false | |
tags: ghcr.io/suborbital/javy:dev-${{ matrix.arch }} | |
- run: docker run --rm ghcr.io/suborbital/javy:dev-${{ matrix.arch }} /usr/local/bin/javy --version | |
- uses: docker/metadata-action@v4 | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
id: docker_meta | |
with: | |
images: ghcr.io/suborbital/javy | |
tags: | | |
type=match,pattern=suborbital-(v.*),group=1 | |
flavor: | | |
latest=false | |
- uses: docker/login-action@v2 | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and push the image on release tags | |
- name: Build and push javy image | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
uses: docker/build-push-action@v3 | |
id: build | |
with: | |
cache-from: type=gha | |
context: . | |
file: Dockerfile | |
platforms: linux/${{ matrix.arch }} | |
# disable provenance when using buildkit 0.11.0+ | |
# provenance: false | |
push: true | |
outputs: type=image,name=ghcr.io/suborbital/javy,push-by-digest=true | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
- name: Set image digest for ${{ matrix.arch }} | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
id: digests | |
run: echo "${{ matrix.arch }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT | |
manifest: | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
needs: [image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get release tag | |
id: tag | |
run: | | |
version=${GITHUB_REF#"refs/tags/suborbital-"} | |
echo $version | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker manifest create ghcr.io/suborbital/javy:${{ steps.tag.outputs.version }} | |
uses: Noelware/docker-manifest-action@v0.2.3 | |
with: | |
base-image: ghcr.io/suborbital/javy:${{ steps.tag.outputs.version }} | |
extra-images: ghcr.io/suborbital/javy@${{ needs.image.outputs.amd64 }},ghcr.io/suborbital/javy@${{ needs.image.outputs.arm64 }} | |
push: true | |
- name: docker manifest create ghcr.io/suborbital/javy:latest | |
uses: Noelware/docker-manifest-action@v0.2.3 | |
with: | |
base-image: ghcr.io/suborbital/javy:latest | |
extra-images: ghcr.io/suborbital/javy@${{ needs.image.outputs.amd64 }},ghcr.io/suborbital/javy@${{ needs.image.outputs.arm64 }} | |
push: true | |
bin: | |
needs: [cli, image] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: bins/ | |
- run: tar -czvf javy-aarch64-linux.tar.gz -C bins/javy-arm64-linux javy | |
- run: tar -czvf javy-x86_64-linux.tar.gz -C bins/javy-amd64-linux javy | |
- name: Upload archives to release | |
uses: alexellis/upload-assets@0.4.0 | |
if: startsWith(github.ref, 'refs/tags/suborbital-v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
asset_paths: '["javy-*-linux.tar.gz"]' |