1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/.github/workflows/main.yml

129 lines
5.6 KiB
YAML
Raw Normal View History

2020-09-11 07:33:30 +00:00
name: Build OpenMPTCProuter
2020-02-22 07:30:40 +00:00
on: [push]
2020-09-11 09:00:01 +00:00
env:
2020-09-11 13:26:37 +00:00
REPO_URL: 'https://github.com/ysurac/openmptcprouter'
OMR_KERNEL: '5.4'
2020-09-11 09:00:01 +00:00
2020-02-22 07:30:40 +00:00
jobs:
build:
2020-09-13 13:21:50 +00:00
strategy:
matrix:
2020-09-14 15:54:36 +00:00
OMR_TARGET: [bpi-r2, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64]
2020-02-23 08:50:53 +00:00
runs-on: ubuntu-latest
2020-09-13 15:05:35 +00:00
continue-on-error: true
2020-02-22 07:30:40 +00:00
steps:
2020-09-11 13:26:37 +00:00
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
2020-09-14 16:02:01 +00:00
echo ::set-output name=WORKSPACE::${GITHUB_WORKSPACE}
2020-02-22 07:30:40 +00:00
- name: Prepare
2020-02-23 08:53:02 +00:00
run: |
sudo apt-get update
2020-03-04 09:10:11 +00:00
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler
2020-09-11 07:32:13 +00:00
- name: Clone source code
2020-09-14 12:51:15 +00:00
working-directory: ../../
2020-09-11 07:32:13 +00:00
env:
REPO_URL: https://github.com/ysurac/openmptcprouter
2020-09-11 17:45:17 +00:00
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
2020-09-14 16:00:38 +00:00
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
2020-09-11 07:32:13 +00:00
run: |
2020-09-14 11:02:03 +00:00
git clone --depth 1 $REPO_URL omr
cd omr
2020-09-11 17:45:17 +00:00
if [ "$SOURCE_NAME" != "Test-Github-Actions" ] && [ "$SOURCE_NAME" != "develop" ]; then
git checkout master
2020-09-11 13:31:38 +00:00
else
git checkout develop
fi
2020-09-11 13:26:37 +00:00
git pull
2020-09-14 16:02:01 +00:00
ln -s omr ${GITHUB_WORKSPACE}/omr
2020-03-04 09:11:29 +00:00
- name: Build toolchain
2020-09-14 12:51:15 +00:00
working-directory: ../../omr
2020-02-22 07:30:40 +00:00
env:
2020-09-11 07:46:43 +00:00
OMR_FEED_URL: https://github.com/ysurac/openmptcprouter-feeds
2020-09-11 17:45:17 +00:00
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
2020-09-13 13:21:50 +00:00
OMR_TARGET: ${{ matrix.OMR_TARGET }}
2020-02-22 07:30:40 +00:00
run: |
2020-09-14 07:45:29 +00:00
OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j$(nproc) || OMR_FEED_SRC="${SOURCE_NAME}" sh build.sh prepare {tools,toolchain}/install -j1 V=s
2020-09-11 13:26:37 +00:00
#echo -e "${{ secrets.OMR_PRIVKEY }}" > $OMR_TARGET/source/key-build
#echo -e "${{ secrets.OMR_PUBKEY }}" > $OMR_TARGET/source/key-build.pub
2020-09-11 07:46:43 +00:00
- name: Build packages
2020-09-14 12:51:15 +00:00
working-directory: ../../omr
2020-09-13 13:21:50 +00:00
env:
OMR_TARGET: ${{ matrix.OMR_TARGET }}
2020-09-11 07:46:43 +00:00
run: |
2020-09-14 07:45:29 +00:00
make IGNORE_ERRORS=m -C $OMR_TARGET/source package/{compile,install,index} -j$(nproc) || make IGNORE_ERRORS=m -C $OMR_TARGET/source package/{compile,install,index} -j1 V=s
2020-09-11 07:46:43 +00:00
- name: Build image
2020-09-14 12:51:15 +00:00
working-directory: ../../omr
2020-09-13 13:21:50 +00:00
env:
OMR_TARGET: ${{ matrix.OMR_TARGET }}
2020-09-11 07:46:43 +00:00
run: |
2020-09-14 07:45:29 +00:00
make IGNORE_ERRORS=m -C $OMR_TARGET/source target/install -j$(nproc) || make IGNORE_ERRORS=m -C $OMR_TARGET/source target/install -j1 V=s
2020-09-12 06:49:00 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2020-09-13 13:21:50 +00:00
name: ${{ matrix.OMR_TARGET }}
2020-09-14 15:54:36 +00:00
path: ./omr/${{ matrix.OMR_TARGET }}/source/bin
2020-09-11 17:45:17 +00:00
- if: steps.branch_name.outputs.SOURCE_BRANCH == ''
name: Deploy - Create directory
2020-09-11 13:26:37 +00:00
uses: fifsky/ssh-action@master
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
with:
command: |
2020-09-13 13:21:50 +00:00
mkdir -p deploy/release/${{env.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
2020-09-11 13:26:37 +00:00
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
2020-09-11 17:45:17 +00:00
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
name: Deploy - Create directory
uses: fifsky/ssh-action@master
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
with:
command: |
2020-09-13 13:21:50 +00:00
mkdir -p deploy/${{env.SOURCE_BRANCH}}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
2020-09-11 17:45:17 +00:00
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
- if: steps.branch_name.outputs.SOURCE_BRANCH == ''
name: Deploy - Upload via rsync
2020-09-12 18:19:03 +00:00
uses: burnett01/rsync-deployments@4.1
2020-09-11 13:26:37 +00:00
with:
2020-09-12 18:19:03 +00:00
switches: -av --delete-after
2020-09-13 13:21:50 +00:00
remote_path: deploy/release/${{env.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
2020-09-14 15:54:36 +00:00
path: ./omr/${{matrix.OMR_TARGET}}/source/bin/
2020-09-12 18:19:03 +00:00
remote_key: ${{ secrets.PRIVATE_KEY }}
remote_user: deploy
remote_host: ${{ secrets.OMR_DEPLOY_HOST }}
remote_port: ${{ secrets.OMR_DEPLOY_PORT }}
2020-09-13 05:53:51 +00:00
env:
2020-09-11 13:26:37 +00:00
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
2020-09-11 17:45:17 +00:00
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
name: Deploy - Upload via rsync
2020-09-12 18:19:03 +00:00
uses: burnett01/rsync-deployments@4.1
2020-09-11 17:45:17 +00:00
with:
2020-09-12 18:19:03 +00:00
switches: -av --delete-after
2020-09-13 13:21:50 +00:00
remote_path: deploy/${{env.SOURCE_BRANCH}}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
2020-09-14 15:54:36 +00:00
path: ./omr/${{matrix.OMR_TARGET}}/source/bin/
2020-09-12 18:19:03 +00:00
remote_key: ${{ secrets.PRIVATE_KEY }}
remote_user: deploy
remote_host: ${{ secrets.OMR_DEPLOY_HOST }}
remote_port: ${{ secrets.OMR_DEPLOY_PORT }}
2020-09-13 05:53:51 +00:00
env:
2020-09-11 17:45:17 +00:00
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}