Skip to content

CI

CI #50

Workflow file for this run

name: CI
on:
push:
branches:
main
paths-ignore:
- 'README.md'
workflow_dispatch:
concurrency:
group: CI
cancel-in-progress: false
env:
git-author-name: Doug Freed
git-author-email: [email protected]
owrt-package: vlmcsd
repo-owner: dwfreed
repo-name: openwrt-vlmcsd
usign-key-name: Doug Freed
jobs:
matrix-setup:
name: Matrix Setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: matrix
- id: get-matrix
name: Get matrix
run: echo "matrix=$(<matrix.json)" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}
build-packages:
name: Build Packages
runs-on: ubuntu-latest
needs: matrix-setup
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.matrix-setup.outputs.matrix) }}
env:
MATRIX_SDK_FILENAME: ${{ matrix.sdk_filename }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event_name == 'push' && github.ref || 'main' }}
- name: Get the SDK
run: |
mkdir sdk
cd sdk
wget "${{ matrix.sdk_url }}"
tar xf "${MATRIX_SDK_FILENAME}"
- name: Set up package dir and signing key
run: |
cd "sdk/${MATRIX_SDK_FILENAME%.tar.xz}"
mkdir package/${{ env.owrt-package }}
ln -s "${GITHUB_WORKSPACE}"/Makefile package/${{ env.owrt-package }}/
ln -s "${GITHUB_WORKSPACE}"/files package/${{ env.owrt-package }}/
echo 'untrusted comment: usign key of ${{ env.usign-key-name }}' > key-build
echo '${{ secrets.USIGN_KEY }}' >> key-build
#- name: Add SDK bins to path
# run: |
# cd "sdk/${MATRIX_SDK_FILENAME%.tar.xz}"
# echo "${GITHUB_WORKSPACE}"/sdk/"${MATRIX_SDK_FILENAME%.tar.xz}"/staging_dir/host/bin >> "$GITHUB_PATH"
# echo "${GITHUB_WORKSPACE}"/sdk/"${MATRIX_SDK_FILENAME%.tar.xz}"/staging_dir/toolchain-*/bin >> "$GITHUB_PATH"
- name: Update packages feed
run: |
cd "sdk/${MATRIX_SDK_FILENAME%.tar.xz}"
scripts/feeds update packages >/dev/null
- name: Set up OpenWrt config
run: |
cd "sdk/${MATRIX_SDK_FILENAME%.tar.xz}"
echo "CONFIG_REPRODUCIBLE_DEBUG_INFO=y" > .config
make defconfig
- name: Build package
run: |
cd "sdk/${MATRIX_SDK_FILENAME%.tar.xz}"
make -j$(nproc) V=s package/${{ env.owrt-package }}/compile
make -j1 V=s package/index
- name: Prepare artifact
run: |
mkdir -p OpenWrt_${{ matrix.major }}/${{ matrix.arch }}
rsync -av sdk/"${MATRIX_SDK_FILENAME%.tar.xz}"/bin/packages/${{ matrix.arch }}/base OpenWrt_${{ matrix.major }}/${{ matrix.arch }}
tar cf OpenWrt_${{ matrix.major }}-${{ matrix.arch }}.tar OpenWrt_${{ matrix.major }}
- uses: actions/upload-artifact@v3
with:
name: OpenWrt_${{ matrix.major }}-${{ matrix.arch }}
path: OpenWrt_${{ matrix.major }}-${{ matrix.arch }}.tar
deploy:
name: Deploy Packages
runs-on: ubuntu-latest
needs: build-packages
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
- name: Flush existing files
run: rm -rf OpenWrt_*
# Without any parameters, download-artifact grabs everything, which is what we want
- uses: actions/download-artifact@v3
- name: Extract artifacts
run: |
for tarball in OpenWrt_*-*/*.tar; do
tar xf ${tarball}
rm ${tarball}
done
find -type d -empty -delete
- name: Set up virtualenv
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
- name: Generate READMEs
run: |
source venv/bin/activate
./generate.py repo_owner=${{ env.repo-owner }} repo_name=${{ env.repo-name }} owrt_package=${{ env.owrt-package }}
- name: Clean up virtualenv
run: rm -rf venv
- name: Configure git
run: |
git config user.name "${{ env.git-author-name }}"
git config user.email ${{ env.git-author-email }}
- name: Commit
run: |
git add -A
if ! git diff-index --quiet HEAD; then
git commit -m "Deploy GH Actions build ${GITHUB_RUN_NUMBER} to gh-pages"
git push
fi