|
| 1 | +--- |
| 2 | +name: CI-BUILD |
| 3 | +# Continuous Integration workflow for building, the project |
| 4 | +# |
| 5 | +# Jobs included: |
| 6 | +# - BUILD: Ensures the project compiles correctly |
| 7 | +# - BOOTSTRAP: Tests installation across Python versions and locales |
| 8 | +# |
| 9 | +# Required Secrets: |
| 10 | +# NONE |
| 11 | + |
| 12 | +on: # yamllint disable-line rule:truthy |
| 13 | + push: |
| 14 | + branches: ["**"] # matches any branch |
| 15 | + tags: ["v*"] |
| 16 | + |
| 17 | +# Declare default permissions as none. |
| 18 | +permissions: {} |
| 19 | + |
| 20 | +env: |
| 21 | + ENVIRONMENT: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable' || startsWith(github.ref, 'refs/tags/v')) && 'Deployment' || (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/feature') || startsWith(github.ref, 'refs/heads/patch-') || startsWith(github.ref, 'refs/tags/v')) && 'Testing' || 'Experimenting' }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + BUILD: |
| 25 | + permissions: |
| 26 | + actions: read |
| 27 | + contents: read |
| 28 | + statuses: write |
| 29 | + packages: none |
| 30 | + pull-requests: read |
| 31 | + security-events: none |
| 32 | + if: ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }} |
| 33 | + runs-on: ubuntu-latest |
| 34 | + environment: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable' || startsWith(github.ref, 'refs/tags/v')) && 'Deployment' || (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/feature') || startsWith(github.ref, 'refs/heads/patch-') || startsWith(github.ref, 'refs/tags/v')) && 'Testing' || 'Experimenting' }} |
| 35 | + defaults: |
| 36 | + run: |
| 37 | + shell: bash |
| 38 | + env: |
| 39 | + LANG: "en_US.UTF-8" |
| 40 | + outputs: |
| 41 | + build_status: ${{ steps.build.outcome }} |
| 42 | + steps: |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + persist-credentials: false |
| 47 | + - uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: "3.12" |
| 50 | + - name: Pre-Clean |
| 51 | + id: clean |
| 52 | + run: make -j1 -f Makefile purge 2>/dev/null || true |
| 53 | + - name: Test Build |
| 54 | + id: build |
| 55 | + run: make -j1 -f Makefile build |
| 56 | + - name: Post-Clean |
| 57 | + id: post |
| 58 | + run: make -j1 -f Makefile purge || true |
| 59 | + |
| 60 | + BOOTSTRAP: |
| 61 | + permissions: |
| 62 | + actions: read |
| 63 | + contents: read |
| 64 | + statuses: write |
| 65 | + packages: none |
| 66 | + pull-requests: read |
| 67 | + security-events: none |
| 68 | + if: ${{ !cancelled() }} |
| 69 | + needs: BUILD |
| 70 | + runs-on: ubuntu-latest |
| 71 | + environment: ${{ needs.BUILD.environment }} |
| 72 | + defaults: |
| 73 | + run: |
| 74 | + shell: bash |
| 75 | + timeout-minutes: 5 |
| 76 | + continue-on-error: ${{ matrix.experimental }} |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + python-version: ["3.10", "3.11", "3.12"] |
| 81 | + lang-var: ["de.utf-8", "jp.utf-8"] |
| 82 | + experimental: [true] |
| 83 | + include: |
| 84 | + - python-version: "3.10" |
| 85 | + lang-var: "de.utf-8" |
| 86 | + experimental: false |
| 87 | + - python-version: "3.10" |
| 88 | + lang-var: "jp.utf-8" |
| 89 | + experimental: false |
| 90 | + - python-version: "3.10" |
| 91 | + lang-var: "en_US.utf-8" |
| 92 | + experimental: false |
| 93 | + - python-version: "3.11" |
| 94 | + lang-var: "en_US.utf-8" |
| 95 | + experimental: false |
| 96 | + - python-version: "3.11" |
| 97 | + lang-var: "en_US.utf-8" |
| 98 | + experimental: false |
| 99 | + - python-version: "3.12" |
| 100 | + lang-var: "en_US.utf-8" |
| 101 | + experimental: false |
| 102 | + outputs: |
| 103 | + bootstrap_status: ${{ steps.bootstrap.outcome }} |
| 104 | + env: |
| 105 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 106 | + LANG: ${{ matrix.lang-var }} |
| 107 | + steps: |
| 108 | + - name: Checkout repository |
| 109 | + uses: actions/checkout@v4 |
| 110 | + with: |
| 111 | + persist-credentials: false |
| 112 | + - name: Set up Python |
| 113 | + uses: actions/setup-python@v5 |
| 114 | + with: |
| 115 | + python-version: ${{ matrix.python-version }} |
| 116 | + - name: Set up dependencies |
| 117 | + run: | |
| 118 | + pip install --upgrade "pip>=24.3.1" "setuptools>=75.0" "wheel>=0.44" "build>=1.2.1"; |
| 119 | + pip install -r ./requirements.txt ; |
| 120 | + - name: Pre-build |
| 121 | + id: bootstrap |
| 122 | + run: | |
| 123 | + make -j1 -f Makefile clean || true ; |
| 124 | + make -j1 -f Makefile build ; |
| 125 | + shell: bash |
| 126 | + - name: Summerize Building |
| 127 | + id: sumerize-py-build |
| 128 | + run: | |
| 129 | + echo "- Building works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY |
| 130 | + if: ${{ success() }} |
| 131 | + shell: bash |
| 132 | + - name: Run Tests |
| 133 | + id: test-user-install |
| 134 | + run: make -j1 -f Makefile user-install ; |
| 135 | + shell: bash |
| 136 | + - name: Summerize Install |
| 137 | + id: sumerize-user-install |
| 138 | + run: | |
| 139 | + echo "- User Installing works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY |
| 140 | + if: ${{ success() }} |
| 141 | + shell: bash |
| 142 | + - name: Test Info |
| 143 | + id: test-info |
| 144 | + run: python -m setup --name --version --license || true ; |
| 145 | + - name: Post-Clean |
| 146 | + id: post-bootstrap |
| 147 | + run: | |
| 148 | + make -j1 -f Makefile purge || true ; |
| 149 | + make -j1 -f Makefile clean || true ; |
| 150 | + if: ${{ always() }} |
| 151 | + shell: bash |
| 152 | + |
| 153 | + BUILD_STATUS: |
| 154 | + permissions: |
| 155 | + actions: read |
| 156 | + pull-requests: read |
| 157 | + needs: [BUILD, BOOTSTRAP] |
| 158 | + runs-on: ubuntu-latest |
| 159 | + if: ${{ !cancelled() }} |
| 160 | + outputs: |
| 161 | + didBUILD: ${{ steps.check_status.outputs.build_success }} |
| 162 | + steps: |
| 163 | + - id: check_status |
| 164 | + run: | |
| 165 | + if [[ "${{ needs.BUILD.result }}" == "success" && "${{ needs.BOOTSTRAP.result }}" == "success" ]]; then |
| 166 | + echo "build_success=true" >> $GITHUB_OUTPUT |
| 167 | + else |
| 168 | + echo "build_success=false" >> $GITHUB_OUTPUT |
| 169 | + fi |
0 commit comments