on: workflow_dispatch: name: Auto-Build 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-1.4.0 https://github.com/mobile-shell/mosh.git - name: Build binaries for ${{ matrix.architecture }} run: docker run -v $PWD/mosh:/mosh -w /mosh --name=builder builder sh -c './autogen.sh && LDFLAGS=-static ./configure && make' - 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-linux-${{ matrix.architecture }} mv mosh/src/frontend/mosh-client mosh/src/frontend/mosh-client-linux-${{ matrix.architecture }} - uses: actions/upload-artifact@v3 with: name: mosh-server-linux-${{ matrix.architecture }} path: mosh/src/frontend/mosh-server-linux-${{ matrix.architecture }} if-no-files-found: error - uses: actions/upload-artifact@v3 with: name: mosh-client-linux-${{ matrix.architecture }} path: mosh/src/frontend/mosh-client-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-1.4.0 https://github.com/mobile-shell/mosh.git - run: PATH=/opt/local/bin:$PATH ./autogen.sh working-directory: ./mosh - run: | chmod +x build.sh env 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-darwin-x86_64 path: ./macOS/prefix_x86_64/local/bin/mosh-client-darwin-x86_64 - uses: actions/upload-artifact@v3 with: name: mosh-server-darwin-x86_64 path: ./macOS/prefix_x86_64/local/bin/mosh-server-darwin-x86_64 - uses: actions/upload-artifact@v3 with: name: mosh-client-darwin-arm64 path: ./macOS/prefix_arm64/local/bin/mosh-client-darwin-arm64 - uses: actions/upload-artifact@v3 with: name: mosh-server-darwin-arm64 path: ./macOS/prefix_arm64/local/bin/mosh-server-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 '- [Build #${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})' 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-linux* mosh-server-linux*; do cd "$dir" for prog in mosh*; do file "$prog" done cd .. done ) echo '```' echo echo '### macOS' echo '```' ( for dir in mosh-client-darwin* mosh-server-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: "Build #${{ github.run_number }}" tag_name: run-${{ github.run_number }} prerelease: false draft: false body_path: release.md files: | mosh-client-*/mosh-client* mosh-server-*/mosh-server*