Auto-Build #23
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
on: | |
workflow_dispatch: | |
name: Auto-Build | |
env: | |
MOSH_TAG: 1.4.0+blink-17.3.0 | |
jobs: | |
macports-cache: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install gtar sudo wrapper | |
run: | | |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig | |
sudo cp macOS/gtar /usr/local/bin/gtar | |
sudo chmod +x /usr/local/bin/gtar | |
- name: Cache macports | |
id: cache-macports | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-macports | |
with: | |
path: /opt/local | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('macOS/port-deps.sh') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Setup macports dependencies | |
if: steps.cache-macports.outputs.cache-hit != 'true' | |
run: | | |
curl -L "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-12-Monterey.pkg" --output macports.pkg | |
sudo installer -pkg macports.pkg -target / | |
chmod +x macOS/port-deps.sh && ./macOS/port-deps.sh | |
linux-build: | |
name: Linux Build | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
architecture: [amd64, arm64, armv7] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build container for ${{ matrix.architecture }} | |
run: | | |
docker build -t builder --build-arg TARGET_ARCH=${{ matrix.architecture }} . | |
- run: git clone --depth=1 --branch mosh-$MOSH_TAG https://github.com/blinksh/mosh-server.git mosh | |
- name: Build binaries for ${{ matrix.architecture }} | |
run: docker run -v $PWD/mosh:/mosh -w /mosh --name=builder builder sh -c 'git config --global --add safe.directory /mosh && git describe --dirty --always && ./autogen.sh && LDFLAGS=-static ./configure && make V=1 && cat VERSION.stamp' | |
- name: Test run mosh-server | |
run: docker run -v $PWD/mosh:/mosh -w /mosh/src/frontend builder sh -c 'chmod +x mosh-server && ./mosh-server' | |
- name: Rename binaries | |
run: | | |
mv mosh/src/frontend/mosh-server mosh/src/frontend/mosh-server-$MOSH_TAG-linux-${{ matrix.architecture }} | |
mv mosh/src/frontend/mosh-client mosh/src/frontend/mosh-client-$MOSH_TAG-linux-${{ matrix.architecture }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-server-${{ env.MOSH_TAG }}-linux-${{ matrix.architecture }} | |
path: mosh/src/frontend/mosh-server-${{ env.MOSH_TAG }}-linux-${{ matrix.architecture }} | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-client-${{ env.MOSH_TAG }}-linux-${{ matrix.architecture }} | |
path: mosh/src/frontend/mosh-client-${{ env.MOSH_TAG }}-linux-${{ matrix.architecture }} | |
if-no-files-found: error | |
macos-build: | |
name: macOS Build (x86_64, arm64) | |
needs: macports-cache | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install gtar sudo wrapper | |
run: | | |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig | |
sudo cp macOS/gtar /usr/local/bin/gtar | |
sudo chmod +x /usr/local/bin/gtar | |
- name: Restore macports cache | |
id: cache-macports | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-macports | |
with: | |
path: /opt/local | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('macOS/port-deps.sh') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: git clone --depth=1 --branch mosh-$MOSH_TAG https://github.com/blinksh/mosh-server.git mosh | |
- run: PATH=/opt/local/bin:$PATH ./autogen.sh | |
working-directory: ./mosh | |
- run: | | |
chmod +x build.sh | |
env MOSH_TAG=$MOSH_TAG ZERO_AR_DATE=1 MACOSX_DEPLOYMENT_TARGET=11.0 PATH=/opt/local/bin:$PATH ./build.sh | |
working-directory: ./macOS | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-client-${{ env.MOSH_TAG }}-darwin-x86_64 | |
path: ./macOS/prefix_x86_64/local/bin/mosh-client-${{ env.MOSH_TAG }}-darwin-x86_64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-server-${{ env.MOSH_TAG }}-darwin-x86_64 | |
path: ./macOS/prefix_x86_64/local/bin/mosh-server-${{ env.MOSH_TAG }}-darwin-x86_64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-client-${{ env.MOSH_TAG }}-darwin-arm64 | |
path: ./macOS/prefix_arm64/local/bin/mosh-client-${{ env.MOSH_TAG }}-darwin-arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mosh-server-${{ env.MOSH_TAG }}-darwin-arm64 | |
path: ./macOS/prefix_arm64/local/bin/mosh-server-${{ env.MOSH_TAG }}-darwin-arm64 | |
release: | |
name: Release | |
needs: [linux-build, macos-build] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Create release description | |
run: | | |
( | |
echo '- [Workflow file](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/autobuild.yml)' | |
echo | |
echo '## Files' | |
echo '### Linux' | |
echo '```' | |
( | |
for dir in mosh-client-$MOSH_TAG-linux* mosh-server-$MOSH_TAG-linux*; do | |
cd "$dir" | |
for prog in mosh*; do | |
file "$prog" | |
done | |
cd .. | |
done | |
) | |
echo '```' | |
echo | |
echo '### macOS' | |
echo '```' | |
( | |
for dir in mosh-client-$MOSH_TAG-darwin* mosh-server-$MOSH_TAG-darwin*; do | |
cd "$dir" | |
for prog in mosh*; do | |
file "$prog" | |
done | |
cd .. | |
done | |
) | |
echo '```' | |
echo | |
echo '## SHA256 Checksums' | |
echo '```' | |
( | |
for dir in mosh-client* mosh-server*; do | |
cd "$dir" | |
for prog in mosh*; do | |
sha256sum "$prog" | |
done | |
cd .. | |
done | |
) | |
echo '```' | |
) | tee release.md | |
- id: upload_artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release.md | |
path: release.md | |
if-no-files-found: error | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "${{ env.MOSH_TAG }}" | |
tag_name: ${{ env.MOSH_TAG }} | |
prerelease: false | |
draft: false | |
body_path: release.md | |
files: | | |
mosh-client-*/mosh-client* | |
mosh-server-*/mosh-server* | |