[chores] Move logger calls in subroutine #57 #450
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenWrt OpenWISP Monitoring CI Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| tests: | |
| name: QA-Checks and Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| # This limitation can be removed once docstrfmt | |
| # is upgraded to 2.0.0 or higher (in openwisp-utils). | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| id: deps | |
| run: | | |
| pip install "openwisp-utils[qa]~=1.2.1" | |
| sudo ./install-dev.sh | |
| - name: QA-Checks | |
| run: ./run-qa-checks | |
| env: | |
| CI: 1 | |
| - name: Run sh-checker | |
| uses: luizm/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| sh_checker_comment: true | |
| - name: Tests | |
| if: ${{ !cancelled() && steps.deps.conclusion == 'success' }} | |
| run: ./runtests | |
| - name: Upload Coverage | |
| if: ${{ success() }} | |
| run: | | |
| cd openwisp-monitoring/tests | |
| luacov-coveralls -v | |
| env: | |
| COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| name: Build and upload package as artifacts | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_DIR: "/home/runner/work/build" | |
| DOWNLOADS_DIR: "/home/runner/work/downloads" | |
| CORES: 2 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Cache OpenWrt dependencies | |
| id: cache | |
| uses: actions/cache@v5 | |
| env: | |
| cache-name: cache-openwrt-dependencies | |
| with: | |
| path: "/home/runner/work/build" | |
| key: ${{ runner.os }}-build-${{ env.cache-name }} | |
| - name: Set Environment | |
| run: | | |
| echo "START_TIME=$(date +"%Y-%m-%d")" >> $GITHUB_ENV | |
| echo "COMMIT_SHA=$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: sudo apt install gawk | |
| - name: Run Build | |
| run: ./runbuild | |
| env: | |
| CI_CACHE: ${{ steps.cache.outputs.cache-hit }} | |
| - name: Upload packages as artifacts | |
| if: ${{ github.event_name=='push' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: Packages | |
| path: "${{ env.DOWNLOADS_DIR }}/${{ env.START_TIME }}" | |
| - name: Google Cloud Auth | |
| if: ${{ github.event_name=='push' }} | |
| uses: "google-github-actions/auth@v3" | |
| with: | |
| project_id: ${{ secrets.GCS_PROJECT_ID }} | |
| credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }} | |
| - name: Google Cloud Setup | |
| if: ${{ github.event_name=='push' }} | |
| uses: google-github-actions/setup-gcloud@v3 | |
| with: | |
| project_id: ${{ secrets.GCS_PROJECT_ID }} | |
| - name: Upload compiled packages to downloads.openwisp.io | |
| if: ${{ github.event_name=='push' }} | |
| run: | | |
| gsutil -m rsync -r ${{ env.SRC_URL }} ${{ env.DST_URL }} | |
| gsutil -m rsync -r -d ${{ env.SRC_URL }} ${{ env.LATEST_URL }} | |
| env: | |
| SRC_URL: ${{ env.DOWNLOADS_DIR }}/${{ env.START_TIME }}/openwisp_monitoring | |
| DST_URL: gs://${{ secrets.GCS_DOWNLOADS_BUCKET_NAME }}/openwisp-monitoring/${{ env.START_TIME }}-${{ env.COMMIT_SHA }} | |
| LATEST_URL: gs://${{ secrets.GCS_DOWNLOADS_BUCKET_NAME }}/openwisp-monitoring/latest |