Skip to content

Commit

Permalink
cd: remove circle ci & use docker qemu build
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Sep 17, 2023
1 parent 23aecb7 commit 33bcc1d
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 179 deletions.
179 changes: 0 additions & 179 deletions .circleci/config.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Use the aarch64 Ubuntu 22.04 as the base image
FROM arm64v8/ubuntu:22.04

ARG BUILD_VERSION


# Set the working directory to /app
WORKDIR /app

# Update and install necessary dependencies
RUN apt-get update && \
apt-get install -y curl git unzip tar clang cmake ninja-build pkg-config libgtk-3-dev libglu1-mesa-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libunwind-dev locate patchelf gir1.2-appindicator3-0.1 libappindicator3-1 libappindicator3-dev libsecret-1-0 libjsoncpp25 libsecret-1-dev libjsoncpp-dev libnotify-bin libnotify-dev mpv libmpv-dev rpm

# Install Flutter (latest stable version) with Linux support
RUN git clone https://github.com/flutter/flutter.git /opt/flutter && \
export PATH="$PATH:/opt/flutter/bin" && \
flutter precache && \
flutter config --enable-linux-desktop && \
dart pub global activate flutter_distributor &&\
export PATH="$PATH:/root/.pub-cache/bin"

RUN wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage" &&\
chmod +x appimagetool &&\
mv appimagetool /usr/local/bin


# Copy over all the repository files from the host into the container
COPY .. .

# Run flutter build for Linux ARM
RUN alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb &&\
flutter_distributor package --platform=linux --targets=appimage &&\
flutter_distributor package --platform=linux --targets=rpm &&\
make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64

# Move artifacts
RUN mkdir bundle &&\
mv build/spotube-linux-*-aarch64.tar.xz bundle/ &&\
mv dist/**/spotube-*-linux.deb bundle/Spotube-linux-aarch64.deb &&\
mv dist/**/spotube-*-linux.rpm bundle/Spotube-linux-aarch64.rpm &&\
mv dist/**/spotube-*-linux.AppImage bundle/Spotube-linux-aarch64.AppImag

RUN mkdir -p /host/app/bundle && \
cp -r bundle/* /host/app/bundle

# Set the working directory to /host/app
WORKDIR /host/app

# Finish the Dockerfile
CMD ["echo", "Done!"]
79 changes: 79 additions & 0 deletions .github/workflows/spotube-release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,85 @@ jobs:
name: Spotube-Release-Binaries
path: dist/

linux_arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libunwind-dev locate patchelf gir1.2-appindicator3-0.1 libappindicator3-1 libappindicator3-dev libsecret-1-0 libjsoncpp25 libsecret-1-dev libjsoncpp-dev libnotify-bin libnotify-dev mpv libmpv-dev
- name: Replace pubspec version and BUILD_VERSION Env (nightly)
if: ${{ inputs.channel == 'nightly' }}
run: |
curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV
- name: BUILD_VERSION Env (stable)
if: ${{ inputs.channel == 'stable' }}
run: |
echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
- name: Create Stable .env
if: ${{ inputs.channel == 'stable' }}
run: echo '${{ secrets.DOTENV_RELEASE }}' > .env

- name: Create Nightly .env
if: ${{ inputs.channel == 'nightly' }}
run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env

- name: Replace Version in files
run: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${{ env.BUILD_VERSION }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml
echo "build_arch: aarch64" >> linux/packaging/rpm/make_config.yaml
- name: Generate Secrets
run: |
flutter config --enable-linux-desktop
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
- name: Setup Docker build
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name spotube_builder --use
docker buildx inspect spotube_builder --bootstrap
- name: Run Docker build
run: |
docker buildx build -t spotube_arm:latest .github \
--platform linux/arm64 \
--build-arg BUILD_VERSION=${{ env.BUILD_VERSION }}
docker run -v $(pwd)/bundle:/host/app/bundle spotube_arm:latest
- name: Debug With SSH When fails
if: ${{ failure() && inputs.debug && inputs.channel == 'nightly' }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true

- uses: actions/upload-artifact@v3
with:
name: Spotube-Release-Binaries
path: bundle/

android:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 33bcc1d

Please sign in to comment.