Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.72 KiB
Newer Older
  • Learn to ignore specific revisions
  • image: registry.gitlab.freifunk-stuttgart.de/firmware/ffs-buildenv:master
    
    nrbffs's avatar
    nrbffs committed
    
    variables:
      GIT_SUBMODULE_STRATEGY: normal
    
      DOCKER_DRIVER: overlay2
    
    nrbffs's avatar
    nrbffs committed
    
    stages:
    
    Nico's avatar
    Nico committed
      - generate_date
    
      - update
    
    nrbffs's avatar
    nrbffs committed
      - build
    
    Nico's avatar
    Nico committed
      - package
    
    nrbffs's avatar
    nrbffs committed
    
    
    Nico's avatar
    Nico committed
    default:
    
      before_script:
    
    Nico's avatar
    Nico committed
        - git submodule foreach 'git fetch --tags'
    
        - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
        - eval $(ssh-agent -s)
        - ssh-add <(echo "$GIT_SSH_PRIV_KEY")
        - git config --global user.email "firmware@freifunk-stuttgart.de"
        - git config --global user.name "FFS Buildbot"
        - mkdir -p ~/.ssh
        - cat gitlab-known-hosts >> ~/.ssh/known_hosts
    
        - test -d ffs-openwrt-dl-cache || git clone ssh://git@ssh.gitlab.freifunk-stuttgart.de:22220/firmware/ffs-openwrt-dl-cache.git
    
        - git -C ffs-openwrt-dl-cache pull --no-rebase || true
    
        - rm -rf gluon/openwrt/dl && mkdir -p gluon/openwrt && ln -s ../../ffs-openwrt-dl-cache gluon/openwrt/dl
        - rm -rf gluon/openwrt/staging_dir && mkdir -p staging_dir && ln -s ../../staging_dir gluon/openwrt/staging_dir
    
        # we need to start the SSH agent again because it doesn't seem to stay running
        - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
        - eval $(ssh-agent -s)
        - ssh-add <(echo "$GIT_SSH_PRIV_KEY")
        - git config --global user.email "firmware@freifunk-stuttgart.de"
        - git config --global user.name "FFS Buildbot"
        - mkdir -p ~/.ssh
        - cat gitlab-known-hosts >> ~/.ssh/known_hosts
    
        - cd gluon/openwrt/dl 
    
        - git pull --no-rebase || true
    
    Nico's avatar
    Nico committed
        - git add . && git commit -m "update DL cache" || true
    
        - git pull --no-rebase && git push || true
    
    Nico's avatar
    Nico committed
    generate_date:
      stage: generate_date
    
      before_script:
        - echo dummy
    
      after_script:
        - echo dummy
    
    Nico's avatar
    Nico committed
      script: 
        - date '+%Y-%m-%d' > build.date
      artifacts:
        paths:
          - build.date
        expire_in: 1 day
    
    Nico's avatar
    Nico committed
      except:
        - tags
    
    Nico's avatar
    Nico committed
    
    
    update:
      stage: update
      script:
        - make -C gluon update GLUON_SITEDIR="$CI_PROJECT_DIR" FFS_BUILD_DATE=$(cat build.date)
      artifacts:
        paths:
          - gluon/
        expire_in: 1 day
    
    Nico's avatar
    Nico committed
      except:
        - tags
    
    build-target:
    
    nrbffs's avatar
    nrbffs committed
      stage: build
    
    nrbffs's avatar
    nrbffs committed
      except:
        - tags
    
    Nico's avatar
    Nico committed
      script:
    
        - make -C gluon GLUON_SITEDIR="$CI_PROJECT_DIR" GLUON_TARGET="$TARGET" GLUON_AUTOUPDATER_BRANCH=stable GLUON_AUTOUPDATER_ENABLED=1 FFS_BUILD_DATE=$(cat build.date) BROKEN="$BROKEN" V=1 -j`nproc`
    
    nrbffs's avatar
    nrbffs committed
      artifacts: 
        paths:
          - gluon/output/
        expire_in: 1 day
    
    Nico's avatar
    Nico committed
      cache: []
    
      parallel:
        matrix:
          - TARGET: armsr-armv7
          - TARGET: armsr-armv8
          - TARGET: ath79-generic
          - TARGET: ath79-nand
          - TARGET: ath79-mikrotik
          - TARGET: bcm27xx-bcm2708
          - TARGET: bcm27xx-bcm2709
          - TARGET: ipq40xx-generic
          - TARGET: ipq40xx-mikrotik
          - TARGET: ipq806x-generic
          - TARGET: lantiq-xrx200
          - TARGET: lantiq-xway
          - TARGET: mediatek-filogic
          - TARGET: mediatek-mt7622
          - TARGET: mpc85xx-p1010
          - TARGET: mpc85xx-p1020
          - TARGET: ramips-mt7620
          - TARGET: ramips-mt7621
          - TARGET: ramips-mt76x8
          - TARGET: realtek-rtl838x
          - TARGET: rockchip-armv8
          - TARGET: sunxi-cortexa7
          - TARGET: x86-generic
          - TARGET: x86-geode
          - TARGET: x86-legacy
          - TARGET: x86-64
    
    Nico's avatar
    Nico committed
    
    package:
      stage: package
      script:
    
        - for branch in "stable" "beta" "nightly" "experimental"; do make -C gluon manifest GLUON_AUTOUPDATER_BRANCH="$branch" GLUON_AUTOUPDATER_ENABLED=1 GLUON_SITEDIR="$CI_PROJECT_DIR" FFS_BUILD_DATE=$(cat build.date) V=1 -j`nproc`; done
    
    nrbffs's avatar
    nrbffs committed
        - if [ -n "$GLUON_SIGN_KEY" ]; then cd gluon && for branch in "nightly" "experimental"; do ./contrib/sign.sh <(echo "$GLUON_SIGN_KEY") "output/images/sysupgrade/$branch.manifest"; done; fi
    
    Nico's avatar
    Nico committed
      artifacts:
        paths:
          - gluon/output
        expire_in: 7 days
    
    Nico's avatar
    Nico committed
      except:
        - tags