This commit is contained in:
Lev
2021-11-04 15:31:49 +03:00
parent e685dc5ebc
commit d2b18a3b48
16 changed files with 662 additions and 521 deletions

View File

@@ -1,8 +0,0 @@
#!/bin/bash
TAGS=$(git ls-remote --refs --tags --sort='v:refname' https://github.com/$REPO "v$VERSION.*")
TAG=$(echo $TAGS | tail -n1 | sed 's/.*\///')
echo "GIT_TAG=$TAG" >> $GITHUB_ENV
echo "GIT_BRANCH=version-$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV

18
.github/scripts/get-latest-tags.sh vendored Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
set -x
get_tag() {
tags=$(git ls-remote --refs --tags --sort='v:refname' https://github.com/$1 "v$2.*")
tag=$(echo "$tags" | tail -n1 | sed 's/.*\///')
echo "$tag"
}
FRAPPE_VERSION=$(get_tag frappe/frappe "$VERSION")
ERPNEXT_VERSION=$(get_tag frappe/erpnext "$VERSION")
# shellcheck disable=SC2086
echo "FRAPPE_VERSION=$FRAPPE_VERSION" >>$GITHUB_ENV
# shellcheck disable=SC2086
echo "ERPNEXT_VERSION=$ERPNEXT_VERSION" >>$GITHUB_ENV

View File

@@ -1,11 +0,0 @@
#!/bin/bash
set -e
sudo apt-get install -y w3m
./tests/check-format.sh
./tests/docker-test.sh
# This is done to not to rebuild images in the next step
git clean -fdx

View File

@@ -14,73 +14,112 @@ on:
- docker-compose.yml
- env*
# Nightly builds at 12:00 am
schedule:
# Every day at 12:00 pm
- cron: 0 0 * * *
workflow_dispatch:
env:
IS_AUTHORIZED_RUN: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
jobs:
build_bench:
name: Bench image
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: Checkout
uses: actions/checkout@v2
- uses: docker/login-action@v1
if: github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request'
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: env.IS_AUTHORIZED_RUN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
- name: Build and test
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-bench
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
targets: bench-test
build_main:
name: Frappe and ERPNext images
- name: Push
uses: docker/bake-action@v1.6.0
if: env.IS_AUTHORIZED_RUN == 'true'
with:
files: docker-bake.hcl
targets: bench-build
push: true
build_frappe:
name: Frappe
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: Checkout
uses: actions/checkout@v2
- uses: docker/login-action@v1
if: github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request'
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: env.IS_AUTHORIZED_RUN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Frappe images
- name: Build
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-develop
load: true
- name: Build ERPNext images
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-develop
targets: frappe-develop-test
load: true
- name: Test
run: ./.github/scripts/install-deps-and-test.sh
run: ./tests/test-frappe.sh
- name: Push Frappe images
if: github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request'
- name: Push
if: env.IS_AUTHORIZED_RUN == 'true'
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-develop
push: true
- name: Push ERPNext images
if: github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request'
build_erpnext:
name: ERPNext
runs-on: ubuntu-latest
needs: build_frappe
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: env.IS_AUTHORIZED_RUN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-develop-test
load: true
- name: Test
run: FRAPPE_VERSION=develop ./tests/test-erpnext.sh
- name: Push
if: env.IS_AUTHORIZED_RUN == 'true'
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl

View File

@@ -20,60 +20,47 @@ on:
workflow_dispatch:
jobs:
build:
name: Frappe and ERPNext images
build_frappe:
name: Frappe
runs-on: ubuntu-latest
strategy:
matrix:
version: [12, 13]
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: github.repository == 'frappe/frappe_docker'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Frappe variables
run: ./.github/scripts/get-latest-tag.sh
- name: Get latest versions
run: |
./.github/scripts/get-latest-tags.sh
echo "VERSION=$VERSION" >>$GITHUB_ENV
echo "GIT_TAG=$FRAPPE_VERSION" >>$GITHUB_ENV
echo "GIT_BRANCH=version-$VERSION" >>$GITHUB_ENV
env:
REPO: frappe/frappe
VERSION: ${{ matrix.version }}
- name: Build Frappe images
- name: Build
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-stable
load: true
- name: Setup ERPNext variables
run: ./.github/scripts/get-latest-tag.sh
env:
REPO: frappe/erpnext
VERSION: ${{ matrix.version }}
- name: Build ERPNext images
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-stable
targets: frappe-stable-test
load: true
- name: Test
if: ${{ matrix.version != 12 }}
run: ./.github/scripts/install-deps-and-test.sh
run: ./tests/test-frappe.sh
- name: Setup Frappe variables
if: github.repository == 'frappe/frappe_docker'
run: ./.github/scripts/get-latest-tag.sh
env:
REPO: frappe/frappe
VERSION: ${{ matrix.version }}
- name: Push Frappe images
- name: Push
if: github.repository == 'frappe/frappe_docker'
uses: docker/bake-action@v1.6.0
with:
@@ -81,14 +68,48 @@ jobs:
targets: frappe-stable
push: true
- name: Setup ERPNext variables
build_erpnext:
name: ERPNext
runs-on: ubuntu-latest
needs: build_frappe
strategy:
matrix:
version: [12, 13]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: github.repository == 'frappe/frappe_docker'
run: ./.github/scripts/get-latest-tag.sh
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get latest versions
run: |
./.github/scripts/get-latest-tags.sh
echo "VERSION=$VERSION" >>$GITHUB_ENV
echo "GIT_TAG=$ERPNEXT" >>$GITHUB_ENV
echo "GIT_BRANCH=version-$VERSION" >>$GITHUB_ENV
env:
REPO: frappe/erpnext
VERSION: ${{ matrix.version }}
- name: Push ERPNext images
- name: Build
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-stable-test
load: true
- name: Test
run: ./tests/test-erpnext.sh
- name: Push
if: github.repository == 'frappe/frappe_docker'
uses: docker/bake-action@v1.6.0
with:
@@ -96,16 +117,20 @@ jobs:
targets: erpnext-stable
push: true
- name: Setup Helm deploy key
if: github.repository == 'frappe/frappe_docker'
release_helm:
name: Release Helm
runs-on: ubuntu-latest
if: github.repository == 'frappe/frappe_docker'
needs: [build_frappe, build_erpnext]
steps:
- name: Setup deploy key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.HELM_DEPLOY_KEY }}
- name: Release Helm Chart
if: github.repository == 'frappe/frappe_docker'
- name: Release
run: |
pip install --upgrade pip
git clone git@github.com:frappe/helm.git && cd helm
pip install -r release_wizard/requirements.txt
./release_wizard/wizard 13 patch --remote origin --ci

11
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: Lint
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ludeeus/action-shellcheck@master

View File

@@ -2,18 +2,17 @@ name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
# Every day at 12:00 pm
- cron: 0 0 * * *
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale. You have a week to explain why you believe this is an error.'
stale-pr-message: 'This PR has been automatically marked as stale. You have a week to explain why you believe this is an error.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: This issue has been automatically marked as stale. You have a week to explain why you believe this is an error.
stale-pr-message: This PR has been automatically marked as stale. You have a week to explain why you believe this is an error.
stale-issue-label: no-issue-activity
stale-pr-label: no-pr-activity

17
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Test
on:
schedule:
# Every day at 01:00 am
# Develop images are built at 12:00 pm, we want to use them
- cron: 0 1 * * *
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: ./tests/integration-test.sh