Skip to content

Release Build & Test #16

Release Build & Test

Release Build & Test #16

Workflow file for this run

name: Release Build & Test
on:
release:
types: [created]
jobs:
build-and-test:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Extract version from release title
id: extract_version
run: |
VERSION="${{ github.event.release.tag_name }}"
if [[ ! "$VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "Invalid version format: $VERSION"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Swift 6.0.2 OSS
run: |
sudo apt-get update
sudo apt-get install -y clang libcurl4-openssl-dev binaryen rsync
curl -L https://swiftlang.github.io/swiftly/swiftly-install.sh | bash -s -- -y
. $HOME/.local/share/swiftly/env.sh
swiftly install 6.0.2
SWIFT_PATH=$(which swift)
echo "$(dirname $SWIFT_PATH)" >> $GITHUB_PATH
- name: Build with Swift
run: swift build
- name: Run Swift Tests
run: echo "Skipping temporarily..."
- name: Run Example Tests
run: ./test_all_examples.sh
- name: Build Docker Image for SpaceKitCLI
run: |
cd Utils
docker build . --no-cache -t ghcr.io/gfusee/spacekit/spacekit-cli:$VERSION -f DockerfileCLI
- name: Build and Install SpaceKitCLI
run: |
./install_cli.sh $VERSION
echo "~/.space" >> $GITHUB_PATH
- name: Run CLI Template Tests
run: |
space init TestCLI
cd TestCLI
swift build
rm -rf .build .space
space contract build || space contract build
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push Docker Image (Multi-Arch)
run: |
cd Utils
docker buildx create --use
docker buildx build . --no-cache \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/gfusee/spacekit/spacekit-cli:$VERSION \
--tag ghcr.io/gfusee/spacekit/spacekit-cli:latest \
--push \
-f DockerfileCLI