2020-05-18 19:51:04 +00:00
|
|
|
name: FreqUI CI
|
2020-05-18 18:28:24 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-10-28 17:39:02 +00:00
|
|
|
- main
|
2021-12-17 18:40:15 +00:00
|
|
|
- ci/**
|
2024-10-31 19:28:08 +00:00
|
|
|
- docker_container
|
|
|
|
|
2020-05-18 18:28:24 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-10-28 17:39:02 +00:00
|
|
|
- main
|
2020-12-06 09:26:02 +00:00
|
|
|
release:
|
2020-12-06 11:53:20 +00:00
|
|
|
types: [ published ]
|
2020-05-18 18:28:24 +00:00
|
|
|
|
2022-06-07 04:44:07 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-05-18 18:28:24 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-30 14:09:02 +00:00
|
|
|
os: [ ubuntu-22.04 ]
|
2024-10-17 04:25:38 +00:00
|
|
|
node: [ "18", "20", "22", "23"]
|
2020-05-18 18:28:24 +00:00
|
|
|
|
|
|
|
steps:
|
2023-09-07 04:47:55 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-05-18 18:28:24 +00:00
|
|
|
|
2024-05-24 05:03:38 +00:00
|
|
|
|
|
|
|
- name: Install pnpm
|
2024-05-30 03:50:56 +00:00
|
|
|
uses: pnpm/action-setup@v4
|
2024-05-24 05:03:38 +00:00
|
|
|
|
2023-10-26 03:09:48 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2022-06-13 17:30:00 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
2024-05-24 05:03:38 +00:00
|
|
|
cache: 'pnpm'
|
|
|
|
|
2020-12-05 18:43:24 +00:00
|
|
|
|
2024-05-24 05:06:14 +00:00
|
|
|
- run: pnpm install
|
2020-05-18 18:28:24 +00:00
|
|
|
|
2020-05-18 18:49:30 +00:00
|
|
|
- name: Run Lint
|
2024-05-24 04:57:04 +00:00
|
|
|
run: pnpm run lint-ci
|
2020-11-10 19:52:39 +00:00
|
|
|
|
2021-01-16 14:57:55 +00:00
|
|
|
- name: Run type check
|
2024-10-17 05:02:51 +00:00
|
|
|
run: pnpm run typecheck
|
2021-01-16 14:57:55 +00:00
|
|
|
|
2021-12-18 10:16:15 +00:00
|
|
|
- name: Run Tests
|
2024-05-24 04:57:04 +00:00
|
|
|
run: pnpm run test:unit
|
2021-12-17 18:52:26 +00:00
|
|
|
|
2023-11-19 14:37:46 +00:00
|
|
|
# Playwright section
|
|
|
|
- name: Install Playwright Browsers
|
2024-05-24 05:13:52 +00:00
|
|
|
run: pnpm exec playwright install --with-deps
|
2023-11-19 14:37:46 +00:00
|
|
|
|
|
|
|
- name: Run Playwright tests
|
2024-05-24 05:13:52 +00:00
|
|
|
run: pnpm exec playwright test
|
2023-11-19 14:37:46 +00:00
|
|
|
|
2024-04-08 04:40:03 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
if: ${{ !cancelled() }}
|
2023-11-19 14:37:46 +00:00
|
|
|
with:
|
2024-04-08 16:05:49 +00:00
|
|
|
name: playwright-report-${{ matrix.node }}
|
2023-11-19 14:37:46 +00:00
|
|
|
path: playwright-report/
|
|
|
|
retention-days: 30
|
|
|
|
|
|
|
|
# End Playwright section
|
|
|
|
|
2020-12-05 18:52:32 +00:00
|
|
|
- name: Build build
|
2024-05-24 04:57:04 +00:00
|
|
|
run: pnpm run build
|
2020-12-05 18:52:32 +00:00
|
|
|
|
2020-12-05 19:04:09 +00:00
|
|
|
- name: Archive artifacts
|
2023-12-21 06:12:17 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-21 06:11:43 +00:00
|
|
|
# Ideally this would upload the zip file from below - but this action currently does not support this.
|
2020-12-05 18:52:32 +00:00
|
|
|
with:
|
2023-12-21 06:11:43 +00:00
|
|
|
name: freqUI-${{ matrix.node }}
|
2020-12-05 18:52:32 +00:00
|
|
|
path: |
|
2020-12-06 12:45:05 +00:00
|
|
|
dist
|
|
|
|
!dist/**/*.map
|
2020-12-05 18:52:32 +00:00
|
|
|
retention-days: 10
|
2020-12-06 09:26:02 +00:00
|
|
|
|
2020-12-06 12:45:05 +00:00
|
|
|
- name: Zip files for release
|
2022-06-21 17:52:08 +00:00
|
|
|
if: github.event_name == 'release' && matrix.node == '18'
|
2020-12-06 12:45:05 +00:00
|
|
|
run: |
|
|
|
|
cd dist/
|
|
|
|
zip -r ../freqUI.zip .
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
|
2020-12-06 09:26:02 +00:00
|
|
|
- name: Upload release binaries
|
2024-03-13 05:46:56 +00:00
|
|
|
uses: alexellis/upload-assets@0.4.1
|
2022-06-21 18:04:08 +00:00
|
|
|
if: github.event_name == 'release' && matrix.node == '18'
|
2020-12-06 09:26:02 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
with:
|
2020-12-06 12:28:24 +00:00
|
|
|
asset_paths: '["./freqUI.zip"]'
|
2024-10-31 19:28:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
docker:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
environment:
|
|
|
|
name: Production
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
|
|
|
- linux/amd64
|
|
|
|
- linux/arm/v6
|
|
|
|
- linux/arm/v7
|
|
|
|
- linux/arm64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Prepare Platform_pair
|
|
|
|
run: |
|
|
|
|
platform=${{ matrix.platform }}
|
|
|
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Download digests
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
path: ./dist/
|
|
|
|
# Use node-22 build.
|
|
|
|
name: freqUI-22
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
id: build
|
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
platforms: ${{ matrix.platform }}
|
|
|
|
context: .
|
|
|
|
file: ./docker/Dockerfile
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
outputs: type=image,name=freqtradeorg/frequi,push-by-digest=true,name-canonical=true,push=true
|
|
|
|
|
|
|
|
|
|
|
|
- name: Export digest
|
|
|
|
run: |
|
|
|
|
mkdir -p /tmp/digests
|
|
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
|
|
|
|
- name: Upload digest
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: digests-${{ env.PLATFORM_PAIR }}
|
|
|
|
path: /tmp/digests/*
|
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
docker-merge:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- docker
|
|
|
|
environment:
|
|
|
|
name: Production
|
|
|
|
steps:
|
|
|
|
- name: Download digests
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
path: /tmp/digests
|
|
|
|
pattern: digests-*
|
|
|
|
merge-multiple: true
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
# list of Docker images to use as base name for tags
|
|
|
|
images: |
|
|
|
|
freqtradeorg/frequi
|
|
|
|
ghcr.io/freqtrade/frequi
|
|
|
|
# generate Docker tags based on the following events/attributes
|
|
|
|
tags: |
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=ref,event=branch
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Create manifest list and push
|
|
|
|
working-directory: /tmp/digests
|
|
|
|
run: |
|
|
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
2024-10-31 19:40:46 +00:00
|
|
|
$(printf 'freqtradeorg/frequi@sha256:%s ' *)
|
2024-10-31 19:28:08 +00:00
|
|
|
|
|
|
|
- name: Inspect image
|
|
|
|
run: |
|
2024-10-31 19:40:46 +00:00
|
|
|
docker buildx imagetools inspect freqtradeorg/frequi:${{ steps.meta.outputs.version }}
|