Skip to content

Commit

Permalink
Merge pull request #711 from atsign-foundation/ci-allow-local-multi-b…
Browse files Browse the repository at this point in the history
…uild

ci: allow local multi build
  • Loading branch information
gkc authored Jan 22, 2024
2 parents 0675e02 + d5c4aad commit e422b0a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/multibuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/dart/sshnoports
working-directory: ./packages/dart
strategy:
matrix:
platform: [linux/arm/v7, linux/arm64, linux/riscv64]
Expand All @@ -92,14 +92,14 @@ jobs:
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- run: |
docker buildx build -t atsigncompany/sshnptarball -f tools/Dockerfile.package \
docker buildx build -t atsigncompany/sshnptarball -f sshnoports/tools/Dockerfile.package \
--platform ${{ matrix.platform }} -o type=tar,dest=bins.tar .
- run: mkdir tarballs
- run: tar -xvf bins.tar -C tarballs
- uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: ${{ matrix.output-name }}-upload
path: ./packages/dart/sshnoports/tarballs/${{ matrix.output-name }}.tgz
path: ./packages/dart/tarballs/${{ matrix.output-name }}.tgz
if-no-files-found: error

notify_on_completion:
Expand Down
2 changes: 0 additions & 2 deletions packages/dart/noports_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ dependencies:
socket_connector: ^2.0.1
uuid: ^3.0.7

# dependency_overrides:

dev_dependencies:
build_runner: ^2.4.6
build_version: ^2.1.1
Expand Down
43 changes: 22 additions & 21 deletions packages/dart/sshnoports/tools/Dockerfile.package
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@ FROM atsigncompany/buildimage:automated@sha256:df2ef31dba19fa48cffe53cb2d2215148
WORKDIR /sshnoports
COPY . .
RUN set -eux; \
case "$(dpkg --print-architecture)" in \
amd64) ARCH="x64";; \
armhf) ARCH="arm";; \
arm64) ARCH="arm64";; \
riscv64) ARCH="riscv64";; \
esac; \
mkdir -p sshnp/debug; \
mkdir tarball; \
dart pub get; \
dart run build_runner build --delete-conflicting-outputs; \
dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate; \
dart compile exe bin/sshnp.dart -v -o sshnp/sshnp; \
dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd; \
dart compile exe bin/srv.dart -v -o sshnp/srv; \
dart compile exe bin/srvd.dart -v -o sshnp/srvd; \
dart compile exe bin/srvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/srvd; \
cp -r bundles/core/* sshnp/; \
cp -r bundles/shell/* sshnp/; \
cp LICENSE sshnp/; \
tar -cvzf tarball/sshnp-linux-${ARCH}.tgz sshnp
case "$(dpkg --print-architecture)" in \
amd64) ARCH="x64";; \
armhf) ARCH="arm";; \
arm64) ARCH="arm64";; \
riscv64) ARCH="riscv64";; \
esac; \
cd sshnoports; \
mkdir -p sshnp/debug; \
mkdir tarball; \
dart pub get; \
dart run build_runner build --delete-conflicting-outputs; \
dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate; \
dart compile exe bin/sshnp.dart -v -o sshnp/sshnp; \
dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd; \
dart compile exe bin/srv.dart -v -o sshnp/srv; \
dart compile exe bin/srvd.dart -v -o sshnp/srvd; \
dart compile exe bin/srvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/srvd; \
cp -r bundles/core/* sshnp/; \
cp -r bundles/shell/* sshnp/; \
cp LICENSE sshnp/; \
tar -cvzf tarball/sshnp-linux-${ARCH}.tgz sshnp

FROM scratch
COPY --from=build /sshnoports/tarball/* /
COPY --from=build /sshnoports/sshnoports/tarball/* /
39 changes: 23 additions & 16 deletions tools/package-macos-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,37 @@ ROOT_DIRECTORY="$SCRIPT_DIRECTORY/.."
SRC_DIR="$ROOT_DIRECTORY/packages/dart/sshnoports"

if [ "$#" -ne 0 ]; then
echo "Usage: $0"
exit 1
echo "Usage: $0"
exit 1
fi

if [ "$(uname)" != "Darwin" ]; then
echo "This script is only for macOS";
exit 1;
echo "This script is only for macOS"
exit 1
fi

if [ "$(uname -m)" != "arm64" ]; then
echo "This script can only be run on an Apple Silicon device";
exit 1;
echo "This script can only be run on an Apple Silicon device"
exit 1
fi

if [ -n "$FLUTTER_ROOT" ]; then
DART="$FLUTTER_ROOT/bin/dart"
DART="$FLUTTER_ROOT/bin/dart"
else
DART=$(which dart)
DART=$(which dart)
fi

restore_backup_and_exit() {
mv "$SRC_DIR/pubspec_overrides.back.yaml" "$SRC_DIR/pubspec_overrides.yaml"
exit "$1"
mv "$SRC_DIR/pubspec_overrides.back.yaml" "$SRC_DIR/pubspec_overrides.yaml"
exit "$1"
}

mv "$SRC_DIR/pubspec_overrides.yaml" "$SRC_DIR/pubspec_overrides.back.yaml"
eval "$DART pub get -C $SRC_DIR" || restore_backup_and_exit 1
# Disabled backup code - we want to build using pubspec.lock dependencies
#
# mv "$SRC_DIR/pubspec_overrides.yaml" "$SRC_DIR/pubspec_overrides.back.yaml"
# eval "$DART pub get -C $SRC_DIR" || restore_backup_and_exit 1

eval "$DART pub get -C $SRC_DIR" || exit 1

OUTPUT_DIR_PATH="$ROOT_DIRECTORY/build/macos-arm64"
OUTPUT_DIR="$OUTPUT_DIR_PATH/sshnp"
Expand All @@ -52,10 +56,13 @@ eval "$DART compile exe -o $OUTPUT_DIR/srv $SRC_DIR/bin/srv.dart"
eval "$DART compile exe -o $OUTPUT_DIR/at_activate $SRC_DIR/bin/activate_cli.dart"
eval "$DART compile exe -o $OUTPUT_DIR/debug/srvd -D ENABLE_SNOOP=true $SRC_DIR/bin/srvd.dart"

cp -r "$SRC_DIR/bundles/core"/* "$OUTPUT_DIR/";
cp -r "$SRC_DIR/bundles/shell"/* "$OUTPUT_DIR/";
cp "$SRC_DIR"/LICENSE "$OUTPUT_DIR/";
cp -r "$SRC_DIR/bundles/core"/* "$OUTPUT_DIR/"
cp -r "$SRC_DIR/bundles/shell"/* "$OUTPUT_DIR/"
cp "$SRC_DIR"/LICENSE "$OUTPUT_DIR/"

"$SCRIPT_DIRECTORY/notarize-macos.sh" "$OUTPUT_DIR_PATH" sshnp-macos-arm64

restore_backup_and_exit 0
# Disabled backup code - we want to build using pubspec.lock dependencies
#
# restore_backup_and_exit 0
exit 0

0 comments on commit e422b0a

Please sign in to comment.