final workflow update of the day

This commit is contained in:
mungai-njoroge 2023-10-14 01:40:53 +03:00
parent 72a531cbfc
commit 8d7abda646

View File

@ -24,189 +24,142 @@ on:
- false - false
jobs: jobs:
# build: build:
# strategy: strategy:
# matrix: matrix:
# os: [ubuntu-20.04, windows-2019] os: [ubuntu-20.04, windows-2019]
# runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
# name: Create binary on ${{ matrix.os }} name: Create binary on ${{ matrix.os }}
# steps:
# - name: Clone client
# uses: actions/checkout@v3
# - name: Setup Node 16
# uses: actions/setup-node@v3
# with:
# node-version: 16.x
# - name: Install yarn
# run: |
# npm install -g yarn
# - name: Clone client
# run: |
# git clone https://github.com/swing-opensource/swingmusic-client.git
# - name: Install dependencies & Build client
# run: |
# cd swingmusic-client
# yarn install
# yarn build --outDir ../client
# cd ..
# - name: Install Python 3.10.11
# uses: actions/setup-python@v2
# with:
# python-version: "3.10.11"
# - name: Install Poetry
# run: |
# pip install poetry
# - name: Install dependencies
# run: |
# python -m poetry install
# - name: Build server
# run: |
# python -m poetry run python manage.py --build
# env:
# POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
# LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
# - name: Verify Linux build success
# if: matrix.os == 'ubuntu-20.04'
# run: |
# if [ ! -f "./dist/swingmusic" ]; then
# echo "Build failed"
# exit 1
# fi
# - name: Verify Windows build success
# if: matrix.os == 'windows-2019'
# run: |
# if (-not (Test-Path "./dist/swingmusic.exe")) {
# Write-Host "Build failed"
# exit 1
# }
# - name: Upload Linux binary
# if: matrix.os == 'ubuntu-20.04'
# uses: actions/upload-artifact@v3
# with:
# name: linux
# path: dist/swingmusic
# retention-days: 1
# - name: Upload Windows binary
# if: matrix.os == 'windows-2019'
# uses: actions/upload-artifact@v3
# with:
# name: win32
# path: dist/swingmusic.exe
# retention-days: 1
build_armv7:
runs-on: ubuntu-latest
name: Create binary on armv7
steps: steps:
- uses: actions/checkout@v4 - name: Clone client
- uses: uraimo/run-on-arch-action@v2 uses: actions/checkout@v3
name: Build on armv7 - name: Setup Node 16
uses: actions/setup-node@v3
with: with:
arch: armv7 node-version: 16.x
distro: ubuntu18.04 - name: Install yarn
githubToken: ${{ secrets.GITHUB_TOKEN }}
setup: |
mkdir -p ${PWD}/armv7
dockerRunArgs: |
-v ${PWD}/armv7:/armv7
shell: /bin/sh
install: |
apt-get update
apt-get install -y ca-certificates curl gnupg git software-properties-common
run: |
mkdir -p /etc/apt/keyrings
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install Python3.10
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=16
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install -y nodejs
npm install -g yarn
curl -sSL https://install.python-poetry.org | python3 -
git clone https://github.com/swing-opensource/swingmusic-client.git --depth 1
cd swingmusic-client
yarn install
yarn build --outDir ../client
cd ..
python3.10 -m poetry install
python3.10 -m poetry run python manage.py --build
mv dist/swingmusic /dist/armv7swingmusic
mv dist/armv7swingmusic /armv7
- name: echo directory
run: | run: |
ls -R npm install -g yarn
- name: Upload armv7 binary - name: Clone client
run: |
git clone https://github.com/swing-opensource/swingmusic-client.git
- name: Install dependencies & Build client
run: |
cd swingmusic-client
yarn install
yarn build --outDir ../client
cd ..
- name: Install Python 3.10.11
uses: actions/setup-python@v2
with:
python-version: "3.10.11"
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
python -m poetry install
- name: Build server
run: |
python -m poetry run python manage.py --build
env:
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
- name: Verify Linux build success
if: matrix.os == 'ubuntu-20.04'
run: |
if [ ! -f "./dist/swingmusic" ]; then
echo "Build failed"
exit 1
fi
- name: Verify Windows build success
if: matrix.os == 'windows-2019'
run: |
if (-not (Test-Path "./dist/swingmusic.exe")) {
Write-Host "Build failed"
exit 1
}
- name: Upload Linux binary
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: armv7 name: linux
path: armv7/armv7swingmusic path: dist/swingmusic
retention-days: 1 retention-days: 1
# release: - name: Upload Windows binary
# name: Create New Release if: matrix.os == 'windows-2019'
# runs-on: ubuntu-latest uses: actions/upload-artifact@v3
# needs: build with:
# permissions: write-all name: win32
# steps: path: dist/swingmusic.exe
# - name: Checkout into repo retention-days: 1
# uses: actions/checkout@v3
# - name: Download all binaries release:
# uses: actions/download-artifact@v3 name: Create New Release
# - name: Upload binaries to GitHub Release runs-on: ubuntu-latest
# uses: ncipollo/release-action@v1 needs: build
# with: permissions: write-all
# artifacts: "./linux/swingmusic, ./win32/swingmusic.exe, ./armv7/armv7swingmusic" steps:
# token: ${{ secrets.GITHUB_TOKEN }} - name: Checkout into repo
# tag: ${{ inputs.tag }} uses: actions/checkout@v3
# commit: ${{ github.sha }} - name: Download all binaries
# draft: ${{ inputs.is_draft }} uses: actions/download-artifact@v3
# artifactErrorsFailBuild: true - name: Upload binaries to GitHub Release
# name: ${{ inputs.tag }} uses: ncipollo/release-action@v1
# bodyFile: .github/changelog.md with:
# makeLatest: ${{ inputs.is_latest }} artifacts: "./linux/swingmusic, ./win32/swingmusic.exe"
# docker: token: ${{ secrets.GITHUB_TOKEN }}
# name: Build and push Docker image tag: ${{ inputs.tag }}
# runs-on: ubuntu-latest commit: ${{ github.sha }}
# needs: build draft: ${{ inputs.is_draft }}
# permissions: write-all artifactErrorsFailBuild: true
# steps: name: ${{ inputs.tag }}
# - name: Checkout into repo bodyFile: .github/changelog.md
# uses: actions/checkout@v3 makeLatest: ${{ inputs.is_latest }}
# - name: Download linux binary docker:
# uses: actions/download-artifact@v3 name: Build and push Docker image
# with: runs-on: ubuntu-latest
# name: linux needs: build
# path: dist permissions: write-all
# - name: Set up QEMU steps:
# uses: docker/setup-qemu-action@v1 - name: Checkout into repo
uses: actions/checkout@v3
- name: Download linux binary
uses: actions/download-artifact@v3
with:
name: linux
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# - name: Set up Docker Buildx - name: Set up Docker Buildx
# id: buildx id: buildx
# uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
# - name: Login to GHCR - name: Login to GHCR
# uses: docker/login-action@v1 uses: docker/login-action@v1
# with: with:
# registry: ghcr.io registry: ghcr.io
# username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# - name: Docker meta - name: Docker meta
# id: meta # you'll use this in the next step id: meta # you'll use this in the next step
# uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
# with: with:
# # list of Docker images to use as base name for tags # list of Docker images to use as base name for tags
# images: | images: |
# ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}
# - name: print directory - name: print directory
# run: | run: |
# ls -R ls -R
# - name: Build and push - name: Build and push
# uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
# with: with:
# context: . context: .
# platforms: linux/amd64,linux/arm platforms: linux/amd64,linux/arm
# push: true push: true
# tags: ghcr.io/${{github.repository}}:${{inputs.tag}}, ${{env.LATEST_TAG}} tags: ghcr.io/${{github.repository}}:${{inputs.tag}}, ${{env.LATEST_TAG}}
# labels: org.opencontainers.image.title=Docker labels: org.opencontainers.image.title=Docker
# env: env:
# LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }} LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}