Merge pull request #542 from cmoussa1/issue#539 #1461
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
on: [push, pull_request] | |
name: ci | |
jobs: | |
check-pr: | |
name: validate commits | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- run: git fetch origin master | |
- uses: flux-framework/pr-validator@master | |
spelling: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Spelling | |
uses: crate-ci/typos@bcafd462cb07ef7ba57e34abf458fe20767e808b # v1.19.0 | |
python-format: | |
name: python format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint with black | |
run: | | |
pip install --upgrade black==20.8b1 click==8.0.2 | |
# return the status of running black formatter | |
black . --check | |
python-lint: | |
name: python lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.6 | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: install pylint | |
run: python3 -m pip install 'pylint==2.4.4' --force-reinstall | |
- name: run pylint | |
run: ./scripts/pylint | |
generate-matrix: | |
# https://stackoverflow.com/questions/59977364 | |
name: generate build matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- id: set-matrix | |
run: echo "matrix=$(src/test/generate-matrix.py)" >> $GITHUB_OUTPUT | |
- run: src/test/generate-matrix.py | jq -S . | |
- run: echo "GITHUB_BRANCH=${GITHUB_REF#refs/heads}" >> $GITHUB_OUTPUT | |
- run: echo "GITHUB_TAG=${GITHUB_REF#refs/tags}" >> $GITHUB_OUTPUT | |
- run: echo "EVENT_NAME=${{ github.event_name }}" >> $GITHUB_OUTPUT | |
ci-checks: | |
needs: [ generate-matrix ] | |
runs-on: ubuntu-latest | |
env: | |
TAP_DRIVER_QUIET: 1 | |
FLUX_TEST_TIMEOUT: 300 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | |
fail-fast: false | |
name: ${{matrix.name}} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: fetch annotated tag | |
if: > | |
(matrix.create_release || matrix.docker_tag) && | |
github.ref != 'refs/heads/master' | |
run: | | |
echo github.ref == ${{ github.ref }} ; | |
git fetch -f origin ${{ github.ref }}:${{ github.ref }} ; | |
echo git describe now reports $(git describe --always) | |
- name: coverage setup | |
env: ${{matrix.env}} | |
if: matrix.coverage | |
run: | | |
# Use python3 coverage to match version in flux docker image | |
sudo apt update ; \ | |
sudo apt install -yy python3-pip ; \ | |
pip3 install --upgrade pip ; | |
pip3 install --upgrade --force-reinstall coverage ; | |
- name: docker-run-checks | |
env: ${{matrix.env}} | |
run: ${{matrix.command}} | |
- name: coverage report | |
if: success() && matrix.coverage | |
run: DOCKER_REPO= bash <(curl -s https://codecov.io/bash) | |
- name: annotate errors | |
if: failure() || cancelled() | |
env: ${{matrix.env}} | |
run: src/test/checks-annotate.sh | |
- name: create release | |
id: create_release | |
if: | | |
success() | |
&& matrix.create_release | |
&& github.repository == 'flux-framework/flux-accounting' | |
env: ${{matrix.env}} | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ matrix.tag }} | |
name: flux-accounting ${{ matrix.tag }} | |
prerelease: true | |
files: flux-accounting*.tar.gz | |
body: | | |
View [Release Notes](https://github.com/${{ github.repository }}/blob/${{ matrix.tag }}/NEWS.md) for flux-accounting ${{ matrix.tag }} |