Skip to content

update upload artifact action #141

update upload artifact action

update upload artifact action #141

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- main
pull_request_target:
branches:
- main
permissions:
contents: read
jobs:
build:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for SonarSource/sonarcloud-github-action to determine which PR to decorate
name: Build
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
ref: "${{ (github.event_name == 'pull_request_target') && github.event.pull_request.merge_commit_sha || github.ref }}"
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4
- name: Setup environment
run: poetry install
- name: Run Tests
run: poetry run pytest --cov klimalogger --cov-report xml --cov-report term --junitxml=junit.xml tests
- name: Build
run: poetry build
- name: SonarCloud Scan
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}