Merge pull request #1163 from milroy/partial-cancel #1935
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
on: [ pull_request, push, workflow_dispatch, merge_group] | |
name: ci | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-pr: | |
name: validate commits | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
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-20.04 | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: install black | |
run: python3 -m pip install 'black==22.3.0' --force-reinstall | |
- name: check format | |
run: ./scripts/check-format | |
python-lint: | |
name: python lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- uses: actions/checkout@v4 | |
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@v4 | |
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 | |
DOCKER_REPO: fluxrm/flux-sched | |
DOCKER_USERNAME: travisflux | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_TRAVISFLUX_TOKEN }} | |
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@v4 | |
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: | | |
# Ensure git-describe works on a tag. | |
# (checkout@v4 action may have left current tag as | |
# lightweight instead of annotated. See | |
# https://github.com/actions/checkout/issues/290) | |
# | |
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 buildx | |
uses: docker/setup-buildx-action@v3 | |
if: matrix.needs_buildx | |
- name: setup qemu-user-static | |
run: | | |
docker run --rm --privileged aptman/qus -s -- -p --credential aarch64 | |
- name: docker-run-checks | |
env: ${{matrix.env}} | |
run: ${{matrix.command}} | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{matrix.name}}-results.xml | |
path: test-results.xml | |
- name: coverage report | |
if: success() && matrix.coverage | |
env: | |
DOCKER_REPO: | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ${{matrix.coverage_flags}} | |
- name: docker deploy | |
if: success() && matrix.docker_tag | |
env: ${{matrix.env}} | |
run: src/test/docker-deploy.sh | |
- name: create release | |
id: create_release | |
if: | | |
success() | |
&& matrix.create_release | |
&& github.repository == 'flux-framework/flux-sched' | |
env: ${{matrix.env}} | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ matrix.tag }} | |
name: flux-sched ${{ matrix.tag }} | |
prerelease: true | |
files: flux-sched*.tar.gz | |
body: | | |
View [Release Notes](https://github.com/${{ github.repository }}/blob/${{ matrix.tag }}/NEWS.md) for flux-sched ${{ matrix.tag }} | |
generate-manifest: | |
name: Generate docker manifest | |
runs-on: ubuntu-latest | |
needs: [ci-checks] | |
env: | |
DOCKER_REPO: fluxrm/flux-sched | |
DOCKER_USERNAME: travisflux | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_TRAVISFLUX_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: make and push manifest as fluxrm/flux-sched | |
if: > | |
(startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
# maybe bring back later: fluxrm/flux-sched:bookworm-386 | |
docker manifest create fluxrm/flux-sched:bookworm fluxrm/flux-sched:bookworm-amd64 fluxrm/flux-sched:bookworm-arm64 | |
docker manifest push fluxrm/flux-sched:bookworm |