Build CI #1854
This file contains 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: Build CI | |
run-name: Build CI | |
on: | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: "0 3 * * *" | |
workflow_dispatch: | |
jobs: | |
generate-matrix: | |
name: Generate matrix for build | |
runs-on: ubuntu-latest | |
outputs: | |
target: ${{ steps.set-matrix.outputs.target }} | |
steps: | |
- id: set-matrix | |
run: | | |
echo "github.ref: ${GITHUB_REF}, name: ${GITHUB_REF_NAME}, event: ${GITHUB_EVENT_NAME}" | |
if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then | |
# scheduled build -> use master & stable branch | |
export TARGET='["refs/heads/master","refs/heads/stable"]' | |
else | |
# Pull Request -> only use that branch | |
export TARGET="[\"${GITHUB_REF}\"]" | |
fi | |
echo "target=${TARGET}" | tee -a $GITHUB_OUTPUT | |
build-ci: | |
needs: generate-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ focal, jammy, bullseye, bookworm, noble ] | |
target: ${{ fromJson(needs.generate-matrix.outputs.target) }} | |
runs-on: [ self-hosted, linux, x64, "${{ matrix.os }}" ] | |
timeout-minutes: 35 | |
steps: | |
- name: Add Masks | |
run: | | |
echo "::add-mask::${{ secrets.NPM_REGISTRY_URL }}" | |
echo "::add-mask::${{ secrets.NPM_REGISTRY_AUTH }}" | |
echo "::add-mask::${{ secrets.CODECOV_TOKEN }}" | |
echo "::add-mask::${{ secrets.NETWORK_MASK_1 }}" | |
echo "::add-mask::${{ secrets.NETWORK_MASK_2 }}" | |
echo "::add-mask::${{ secrets.NETWORK_MASK_3 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_1 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_2 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_3 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_4 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_5 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_6 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_7 }}" | |
echo "::add-mask::${{ secrets.INTERNAL_NODE_8 }}" | |
echo "::add-mask::${{ secrets.SECRET_STRING_1 }}" | |
echo "::add-mask::${{ secrets.SECRET_STRING_2 }}" | |
echo "::add-mask::${{ secrets.SECRET_STRING_3 }}" | |
- name: Checkout Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.target }} | |
- name: Set ulimit | |
run: ulimit -n 9999 | |
- name: venv Setup | |
run: | | |
sudo apt install -y python3-venv | |
python3 -m venv venv | |
. venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
echo venv $VIRTUAL_ENV | |
- name: Pre-Installation | |
shell: 'script -q -e -c "bash {0}"' | |
run: ./src/install/pre_install.sh | |
- name: Install FACT | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
./src/install.py -U -R -N -L DEBUG | |
- name: Unit Tests | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
python3 -m pip install codecov | |
pytest --cov=. | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |