Skip to content

Commit

Permalink
port to Fermyon self-hosted Platform
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Fisher <[email protected]>
  • Loading branch information
bacongobbler committed Jun 23, 2023
1 parent 8eef6a5 commit b81816d
Show file tree
Hide file tree
Showing 15 changed files with 450 additions and 1,149 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
cargo clippy --workspace --all-targets --all-features -- -D warnings

build-rust:
name: Build Cloud Plugin
name: Build Platform Plugin
runs-on: ${{ matrix.os }}
needs: [lint-rust]
strategy:
Expand Down Expand Up @@ -105,10 +105,10 @@ jobs:
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}"

- uses: actions/checkout@v3

- name: Cargo Unit Tests
run: |
cargo test --all --no-fail-fast -- --nocapture
env:
CARGO_INCREMENTAL: 0
RUST_LOG: trace
RUST_LOG: trace
32 changes: 16 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
reset_canary_release:
reset_canary_release:
name: Delete and create Canary Release
runs-on: ubuntu-latest
steps:
Expand All @@ -44,10 +44,10 @@ jobs:
prerelease: true
body: |
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
It is only intended for developers wishing to try out the latest features in cloud plugin, some of which may not be fully implemented.
It is only intended for developers wishing to try out the latest features in platform plugin, some of which may not be fully implemented.
build:
name: Build cloud plugin
name: Build platform plugin
runs-on: ${{ matrix.config.os }}
needs: reset_canary_release
strategy:
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: setup for cross-compiled linux aarch64 build
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
Expand All @@ -144,30 +144,30 @@ jobs:
shell: bash
run: |
mkdir -v _dist
cp ${{ matrix.config.targetDir }}/cloud-plugin${{ matrix.config.extension }} _dist/cloud${{ matrix.config.extension }}
cp LICENSE _dist/cloud.license
cd _dist
tar czf cloud-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz cloud.license cloud${{ matrix.config.extension }}
cp ${{ matrix.config.targetDir }}/platform-plugin${{ matrix.config.extension }} _dist/platform${{ matrix.config.extension }}
cp LICENSE _dist/platform.license
cd _dist
tar czf platform-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz platform.license platform${{ matrix.config.extension }}
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: cloud-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
path: _dist/cloud-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
name: platform-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
path: _dist/platform-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz

- name: upload binary to Github release
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _dist/cloud-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
file: _dist/platform-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
tag: ${{ github.ref }}

- name: upload binary to Github release (canary)
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _dist/cloud-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
file: _dist/platform-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
tag: "canary"

checksums_and_manifests:
Expand All @@ -192,7 +192,7 @@ jobs:
- name: generate checksums
run: |
ls -lh
sha256sum cloud*.tar.gz/cloud*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt
sha256sum platform*.tar.gz/platform*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt
- name: upload checksums to Github release
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -212,11 +212,11 @@ jobs:

- name: create plugin manifest
shell: bash
run: bash .plugin-manifests/generate-manifest.sh ${{ env.RELEASE_VERSION }} checksums-${{ env.RELEASE_VERSION }}.txt > cloud.json
run: bash .plugin-manifests/generate-manifest.sh ${{ env.RELEASE_VERSION }} checksums-${{ env.RELEASE_VERSION }}.txt > platform.json

- name: upload plugin manifest to releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cloud.json
file: platform.json
tag: ${{ env.RELEASE_VERSION }}
22 changes: 11 additions & 11 deletions .plugin-manifests/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PLUGIN_BINARY_VERSION_STRING=$1
# If canary release tag with epoch at the end as it is monotonic
if [[ $VERSION == "canary" ]]; then
PLUGIN_VERSION=$(cargo read-manifest | jq -r .version)
VERSION="${PLUGIN_VERSION//\"}post.$(date +%s)"
VERSION="${PLUGIN_VERSION//\"}post.$(date +%s)"
PLUGIN_BINARY_VERSION_STRING="canary"
fi

Expand All @@ -30,45 +30,45 @@ MAC_AMD=$(cat $2 | grep "macos-amd64" | awk '{print $1}')
WINDOWS_AMD=$(cat $2 | grep "windows-amd64" | awk '{print $1}')

# Dump out the json manifest
cat <<EOF
cat <<EOF
{
"name": "cloud",
"description": "Commands for publishing applications to the Fermyon Cloud.",
"homepage": "https://github.com/fermyon/cloud-plugin",
"name": "platform",
"description": "Commands for publishing applications to the Fermyon self-hosted Platform.",
"homepage": "https://github.com/fermyon/platform-plugin",
"version": "${VERSION//v}",
"spinCompatibility": "${SPIN_COMPAT_STRING}",
"license": "Apache-2.0",
"packages": [
{
"os": "linux",
"arch": "amd64",
"url": "https://github.com/fermyon/cloud-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/cloud-${PLUGIN_BINARY_VERSION_STRING}-linux-amd64.tar.gz",
"url": "https://github.com/fermyon/platform-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/platform-${PLUGIN_BINARY_VERSION_STRING}-linux-amd64.tar.gz",
"sha256": "${LINUX_AMD}"
},
{
"os": "linux",
"arch": "aarch64",
"url": "https://github.com/fermyon/cloud-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/cloud-${PLUGIN_BINARY_VERSION_STRING}-linux-aarch64.tar.gz",
"url": "https://github.com/fermyon/platform-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/platform-${PLUGIN_BINARY_VERSION_STRING}-linux-aarch64.tar.gz",
"sha256": "${LINUX_ARM}"
},
{
"os": "macos",
"arch": "aarch64",
"url": "https://github.com/fermyon/cloud-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/cloud-${PLUGIN_BINARY_VERSION_STRING}-macos-aarch64.tar.gz",
"url": "https://github.com/fermyon/platform-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/platform-${PLUGIN_BINARY_VERSION_STRING}-macos-aarch64.tar.gz",
"sha256": "${MAC_ARM}"
},
{
"os": "macos",
"arch": "amd64",
"url": "https://github.com/fermyon/cloud-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/cloud-${PLUGIN_BINARY_VERSION_STRING}-macos-amd64.tar.gz",
"url": "https://github.com/fermyon/platform-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/platform-${PLUGIN_BINARY_VERSION_STRING}-macos-amd64.tar.gz",
"sha256": "${MAC_AMD}"
},
{
"os": "windows",
"arch": "amd64",
"url": "https://github.com/fermyon/cloud-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/cloud-${PLUGIN_BINARY_VERSION_STRING}-windows-amd64.tar.gz",
"url": "https://github.com/fermyon/platform-plugin/releases/download/${PLUGIN_BINARY_VERSION_STRING}/platform-${PLUGIN_BINARY_VERSION_STRING}-windows-amd64.tar.gz",
"sha256": "${WINDOWS_AMD}"
}
]
}
EOF
EOF
Loading

0 comments on commit b81816d

Please sign in to comment.