Skip to content

Commit

Permalink
cd: Armbuild Circleci project setup (KRTirtho#723)
Browse files Browse the repository at this point in the history
* chore: fill missing translations

* chore: vscode filenesting

* docs: Add meenbeese  (KRTirtho#713)

* CircleCI Commit

* cd: updated circle ci build config

* cd: use custom flutter installation

* cd: use ubuntu 22.04

* cd: fix project var syntax

* cd: directly echo secrets to .env file

* cd: export bash env

* cd: they I'm stupid

* cd: ugghh breaking flutter changes on every major version

* cd: add other empty keys to .env

* cd: works!!!

* cd: store artifacts

* cd: add other package formats in circle ci build

* cd: add pub cache path

* cd: remove dart run from flutter_distributor

* cd: add appimage installer

* cd: sudo

* cd: appimagetool in path

* cd: use aarch64 binary of appimagetool

* cd: add rpmbuild deps

* cd: fix rpm arch

* cd: add github release upload capability

* cd: enable github creds context

* cd: remove token

* cd: remove parallelism

* cd: why typo??!

* cd: add github action to trigger Circle CI pipeline

* cd: trigger CCI using curl

* cd: remove quotes from bool field

* cd: ain't no

* cd: poor choice

---------

Co-authored-by: meenbeese <[email protected]>
  • Loading branch information
KRTirtho and meenbeese authored Sep 15, 2023
1 parent de335f4 commit 7aff0d3
Show file tree
Hide file tree
Showing 10 changed files with 528 additions and 276 deletions.
179 changes: 179 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
version: 2.1

orbs:
gh: circleci/[email protected]

jobs:
flutter_linux_arm:
machine:
image: ubuntu-2204:current
resource_class: arm.medium
parameters:
version:
type: string
default: 3.1.1
channel:
type: enum
enum:
- release
- nightly
default: release
github_run_number:
type: string
default: "0"
dry_run:
type: boolean
default: true
steps:
- checkout
- gh/setup

- run:
name: Get current date
command: |
echo "export CURRENT_DATE=$(date +%Y-%m-%d)" >> $BASH_ENV
- run:
name: Install dependencies
command: |
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 zip rpm
- run:
name: Install Flutter
command: |
git clone https://github.com/flutter/flutter.git
cd flutter && git checkout stable && cd ..
export PATH="$PATH:`pwd`/flutter/bin"
flutter precache
flutter doctor -v
- run:
name: Install AppImageTool
command: |
wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage"
chmod +x appimagetool
mv appimagetool flutter/bin
- persist_to_workspace:
root: flutter
paths:
- .

- when:
condition:
equal: [<< parameters.channel >>, nightly]
steps:
- run:
name: Replace pubspec version and BUILD_VERSION Env (nightly)
command: |
curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "+<< parameters.channel >>.")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo 'export BUILD_VERSION="<< parameters.version >>+<< parameters.channel >>.<< parameters.github_run_number >>"' >> $BASH_ENV
- when:
condition:
equal: [<< parameters.channel >>, release]
steps:
- run: echo 'export BUILD_VERSION="<< parameters.version >>"' >> $BASH_ENV

- run:
name: Generate .env file
command: |
echo "SPOTIFY_SECRETS=${SPOTIFY_SECRETS}" >> .env
echo "SUPABASE_URL=${SUPABASE_URL}" >> .env
echo "SUPABASE_API_KEY=${SUPABASE_API_KEY}" >> .env
- run:
name: Replace Version in files
command: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${BUILD_VERSION}" date="${CURRENT_DATE}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml
echo "build_arch: aarch64" >> linux/packaging/rpm/make_config.yaml
- run:
name: Build secrets
command: |
export PATH="$PATH:`pwd`/flutter/bin"
flutter config --enable-linux-desktop
flutter pub get
dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
- run:
name: Build Flutter app
command: |
export PATH="$PATH:`pwd`/flutter/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
dart pub global activate flutter_distributor
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
- when:
condition:
equal: [<< parameters.channel >>, nightly]
steps:
- run: make tar VERSION=nightly ARCH=arm64 PKG_ARCH=aarch64

- when:
condition:
equal: [<< parameters.channel >>, release]
steps:
- run: make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64

- run:
name: Move artifacts
command: |
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.AppImage
zip -r Spotube-linux-aarch64.zip bundle
- store_artifacts:
path: Spotube-linux-aarch64.zip

- when:
condition:
and:
- equal: [<< parameters.dry_run >>, false]
- equal: [<< parameters.channel >>, release]
steps:
- run:
name: Upload to release (release)
command: gh release upload v<< parameters.version >> bundle/* --clobber

- when:
condition:
and:
- equal: [<< parameters.dry_run >>, false]
- equal: [<< parameters.channel >>, nightly]
steps:
- run:
name: Upload to release (nightly)
command: gh release upload nightly bundle/* --clobber

parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""

workflows:
build_flutter_for_arm_workflow:
when: << pipeline.parameters.GHA_Action >>
jobs:
- flutter_linux_arm:
context:
- org-global
- GITHUB_CREDS
24 changes: 21 additions & 3 deletions .github/workflows/spotube-release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
default: true

env:
FLUTTER_VERSION: '3.10.0'
FLUTTER_VERSION: '3.13.2'

jobs:
windows:
Expand Down Expand Up @@ -164,11 +164,11 @@ jobs:
- name: Create tar.xz (stable)
if: ${{ inputs.channel == 'stable' }}
run: make tar VERSION=${{ env.BUILD_VERSION }}
run: make tar VERSION=${{ env.BUILD_VERSION }} ARCH=x64 PKG_ARCH=x86_64

- name: Create tar.xz (nightly)
if: ${{ inputs.channel == 'nightly' }}
run: make tar VERSION=nightly
run: make tar VERSION=nightly ARCH=x64 PKG_ARCH=x86_64

- name: Move Files to dist
run: |
Expand Down Expand Up @@ -322,6 +322,24 @@ jobs:
name: Spotube-Release-Binaries
path: |
build/Spotube-macos-universal.dmg
# linux_arm:
# runs-on: ubuntu-latest
# steps:
# - run: |
# sudo apt-get update -y
# sudo apt-get install -y curl

# - name: Extract branch name
# shell: bash
# run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV

# - name: Trigger CircleCI Pipeline
# run: |
# curl -X POST https://circleci.com/api/v2/project/cci-f9azl/spotube/pipeline \
# --header "Circle-Token: ${{secrets.CCI_TOKEN}}" \
# --header "content-type: application/json" \
# --data '{"branch": "${{env.BRANCH}}", "parameters":{"GHA_Action":"true","version":"${{inputs.version}}","channel":"${{inputs.channel}}","dry_run":${{inputs.dry_run}}}}'

upload:
runs-on: ubuntu-latest
Expand Down
17 changes: 2 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
INNO_VERSION=6.2.0
TEMP_DIR=/tmp/spotube-tar
USR_SHARE=deb-struct/usr/share
BUNDLE_DIR=build/linux/x64/release/bundle
BUNDLE_DIR=build/linux/${ARCH}/release/bundle
MIRRORLIST=${PWD}/build/mirrorlist
deb:
mkdir -p ${USR_SHARE}/spotube\
&& mkdir -p $(USR_SHARE)/applications $(USR_SHARE)/icons/spotube $(USR_SHARE)/spotube $(USR_SHARE)/appdata\
&& cp -r $(BUNDLE_DIR)/* $(USR_SHARE)/spotube\
&& cp linux/spotube.desktop $(USR_SHARE)/applications/\
&& cp linux/com.github.KRTirtho.Spotube.appdata.xml $(USR_SHARE)/appdata/spotube.appdata.xml\
&& cp assets/spotube-logo.png $(USR_SHARE)/icons/spotube\
&& sed -i 's|com.github.KRTirtho.Spotube|spotube|' $(USR_SHARE)/appdata/spotube.appdata.xml\
&& dpkg-deb -b deb-struct/ build/Spotube-linux-x86_64.deb

tar:
mkdir -p $(TEMP_DIR)\
&& cp -r $(BUNDLE_DIR)/* $(TEMP_DIR)\
&& cp linux/spotube.desktop $(TEMP_DIR)\
&& cp assets/spotube-logo.png $(TEMP_DIR)\
&& cp linux/com.github.KRTirtho.Spotube.appdata.xml $(TEMP_DIR)\
&& tar -cJf build/spotube-linux-${VERSION}-x86_64.tar.xz -C $(TEMP_DIR) .\
&& tar -cJf build/spotube-linux-${VERSION}-${PKG_ARCH}.tar.xz -C $(TEMP_DIR) .\
&& rm -rf $(TEMP_DIR)

appimage:
appimage-builder --recipe AppImageBuilder.yml\
&& mv Spotube-*-x86_64.AppImage build

aursrcinfo:
docker run -e EXPORT_SRC=1 -v ${PWD}/aur-struct:/pkg -v ${MIRRORLIST}:/etc/pacman.d/mirrorlist:ro whynothugo/makepkg

Expand Down
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div align="center">
<img width="600" src="assets/spotube_banner.png" alt="Spotube Logo">

An open source, cross-platform Spotify client compatible across multiple platforms<br />
utilizing Spotify's data API and YouTube (or Piped.video) as an audio source,<br />
eliminating the need for Spotify Premium
An open source, cross-platform Spotify client compatible across multiple platforms<br />
utilizing Spotify's data API and YouTube (or Piped.video) as an audio source,<br />
eliminating the need for Spotify Premium

Btw it's not another Electron app😉
Btw it's not another Electron app😉

<a href="https://spotube.netlify.app"><img alt="Visit the website" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/website_vector.svg"></a>
<a href="https://discord.gg/uJ94vxB6vg"><img alt="Discord Server" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/social/discord-plural_vector.svg"></a>
<a href="https://spotube.netlify.app"><img alt="Visit the website" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/website_vector.svg"></a>
<a href="https://discord.gg/uJ94vxB6vg"><img alt="Discord Server" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/social/discord-plural_vector.svg"></a>

<a href="https://patreon.com/krtirtho"><img alt="Support me on Patron" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/donate/patreon-singular_vector.svg"></a>
<a href="https://www.buymeacoffee.com/krtirtho"><img alt="Buy me a Coffee" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/donate/buymeacoffee-singular_vector.svg"></a>
<a href="https://patreon.com/krtirtho"><img alt="Support me on Patron" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/donate/patreon-singular_vector.svg"></a>
<a href="https://www.buymeacoffee.com/krtirtho"><img alt="Buy me a Coffee" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/donate/buymeacoffee-singular_vector.svg"></a>

<a href="https://opencollective.com/spotube"><img src="https://opencollective.com/spotube/donate/button.png?color=blue" alt="Donate to our Open Collective" height="45"></a>
<a href="https://opencollective.com/spotube"><img src="https://opencollective.com/spotube/donate/button.png?color=blue" alt="Donate to our Open Collective" height="45"></a>

---
---

![Spotube Desktop](assets/spotube-screenshot.png)
![Spotube Desktop](assets/spotube-screenshot.png)

![Spotube Mobile](assets/mobile-screenshots/combined.png)
![Spotube Mobile](assets/mobile-screenshots/combined.png)

</div>

Expand Down Expand Up @@ -161,7 +161,7 @@ This handy table lists all methods you can use to install Spotube:

Grab the latest nightly builds of Spotube [from the GitHub Releases](https://github.com/KRTirtho/spotube/releases/tag/nightly).

## 🕳️ Building from source
## 🕳️ Building from source

<a href="https://github.com/KRTirtho/spotube/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/KRTirtho/spotube/spotube-release-binary.yml?+label=Build%20Status"></a>

Expand All @@ -170,8 +170,9 @@ You can compile Spotube's source code by [following these instructions](CONTRIBU
## 👥 The Spotube team

- [Kingkor Roy Tirtho](https://github.com/KRTirtho) - The Founder, Maintainer and Lead Developer
- [Owen Connor](https://github.com/owencz1998) - The Cool Discord Moderator
- [RaptaG](https://github.com/RaptaG) - The GitHub Moderator and Community Manager
- [Owen Connor](https://github.com/owencz1998) - The Cool Discord Moderator
- [Meenbeese](https://github.com/meenbeese) - The Android Developer
- [Piotr Rogowski](https://github.com/karniv00l) - The MacOS Developer
- [Rusty Apple](https://github.com/RustyApple) - The Mysterious Unknown Guy

Expand Down
11 changes: 10 additions & 1 deletion lib/collections/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions lib/collections/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ part 'env.g.dart';
@Envied(obfuscate: true, requireEnvFile: true, path: ".env")
abstract class Env {
@EnviedField(varName: 'SUPABASE_URL')
static final supabaseUrl = _Env.supabaseUrl;
static final String? supabaseUrl = _Env.supabaseUrl;

@EnviedField(varName: 'SUPABASE_API_KEY')
static final supabaseAnonKey = _Env.supabaseAnonKey;
static final String? supabaseAnonKey = _Env.supabaseAnonKey;

@EnviedField(varName: 'SPOTIFY_SECRETS')
static final spotifySecrets = _Env.spotifySecrets.split(',').map((e) {
static final String rawSpotifySecrets = _Env.rawSpotifySecrets;

static final spotifySecrets = rawSpotifySecrets.split(',').map((e) {
final secrets = e.trim().split(":").map((e) => e.trim());
return {
"clientId": secrets.first,
Expand All @@ -20,7 +22,7 @@ abstract class Env {
}).toList();

@EnviedField(varName: 'ENABLE_UPDATE_CHECK', defaultValue: "1")
static final _enableUpdateChecker = _Env._enableUpdateChecker;
static final String _enableUpdateChecker = _Env._enableUpdateChecker;

static bool get enableUpdateChecker => _enableUpdateChecker == "1";
}
4 changes: 2 additions & 2 deletions lib/services/supabase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:supabase/supabase.dart';

class SupabaseService {
static final api = SupabaseClient(
Env.supabaseUrl,
Env.supabaseAnonKey,
Env.supabaseUrl ?? "",
Env.supabaseAnonKey ?? "",
);

Future<void> insertTrack(MatchedTrack track) async {
Expand Down
1 change: 0 additions & 1 deletion linux/packaging/rpm/make_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ generic_name: Music Streaming Application
categories:
- Music


startup_notify: true
Loading

0 comments on commit 7aff0d3

Please sign in to comment.