diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 00000000..0beead68 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,49 @@ +name: Publish Docs on GitHub Pages + +on: + push: + branches: + - main + +permissions: {} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + artifact-metadata: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Python + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + python-version: "3.13" + + - name: Build docs + run: | + make docs + + - name: Upload static files as artifact + id: deployment + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: docs/_build/html + + deploy: + needs: build + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..999c680c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +name: Publish + +on: + release: + types: [published] + push: + tags: + - 'v*' + +permissions: {} #See guidance on how to set appropriate actions at workflow or job level + +jobs: + sbom: + uses: mozilla/ssdlc-actions/.github/workflows/ssdlc-sbom.yml@5cc2b20e42d53d1643853f12244fbec9ed2f2e0c + with: + sbom_name: ${{ github.event.release.tag_name || github.sha }} + permissions: + actions: read + contents: write + + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Python + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + python-version: "3.10" + + - name: Release package on PyPi + run: + # Requires that the UV_PUBLISH_TOKEN environment variable + # is configured in CircleCI's environment variables. + make release + env: + PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} diff --git a/.github/workflows/ssdlc.yml b/.github/workflows/ssdlc.yml deleted file mode 100644 index 0e9b1ca3..00000000 --- a/.github/workflows/ssdlc.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: SSDLC Actions - -on: - push: - branches: - - "main" - pull_request: - branches: - - "main" - -permissions: {} - -jobs: - code-security-analysis: - permissions: - security-events: write # required for uploading code scanning alerts - uses: mozilla/ssdlc-actions/.github/workflows/code-security-analysis-public-repo.yml@ca8be48f3c06204fb16a3bd5ffa6d916782bbc76 # 2026-06-29 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..05318d4a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,139 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + types: + - opened + - synchronize + +# Drop all default GITHUB_TOKEN permissions; each job declares its own least-privilege set. +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test-python: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.9" + os: ubuntu-latest + - python-version: "3.9" + os: ubuntu-latest + minimum-versions: true + - python-version: "3.10" + os: ubuntu-latest + - python-version: "3.11" + os: ubuntu-latest + - python-version: "3.12" + os: ubuntu-latest + - python-version: "3.13" + os: ubuntu-latest + steps: + - &checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + filter: blob:none + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Set up Python + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install glean_parser + if: matrix.minimum-versions != true + run: CC=broken_compiler uv sync + + - name: Install minimum requirements + if: matrix.minimum-versions == true + run: | + uv sync --resolution lowest-direct + + - name: Set up Ruby + uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0 + with: + ruby-version: '3.4' + + - name: Set up JDK 17 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 + with: + java-version: '17' + distribution: 'temurin' + + - name: Install Kotlin linters + run: make install-kotlin-linters + + - name: Set up Rust + uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 + with: + toolchain: stable + + - name: Set up Go + uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 + with: + go-version: "1.26" + cache: false + + - name: Python tests + run: | + make test-full + + - name: Build docs + if: matrix.python-version == '3.12' + run: | + make docs + + lint: + runs-on: ubuntu-latest + steps: + - *checkout + + - name: Set up Python + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + + - name: Lint + run: make lint + + license-check: + runs-on: ubuntu-latest + steps: + - *checkout + + - name: Set up Python + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + + - name: License check + run: | + uv run pip-licenses --fail-on 'GNU General Public License v3 (GPLv3)' --ignore-packages yamllint + + code-security-analysis: + permissions: + contents: read + actions: read + uses: mozilla/ssdlc-actions/.github/workflows/code-security-analysis-private-repo.yml@ca8be48f3c06204fb16a3bd5ffa6d916782bbc76 # v1 + + report-result: + runs-on: ubuntu-latest + if: ${{ !cancelled() }} + needs: + - test-python + - lint + - license-check + - code-security-analysis + steps: + - name: Determine result + run: | + echo "$RESULTS" | grep -v failure + env: + RESULTS: ${{ join(needs.*.result, ',') }}