Skip to content

Commit

Permalink
Hack on per-commit build
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-noland committed Nov 30, 2024
1 parent 2659d2a commit f47ad4f
Showing 1 changed file with 14 additions and 34 deletions.
48 changes: 14 additions & 34 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ jobs:
- '!(README.md|LICENSE|design-docs/**|.gitignore|.github/**)'
- '.github/workflows/dev.yml'
history:
name: "Deduce required tests from code changes"
commits:
name: "Deduce commit history"
permissions:
contents: "read"
pull-requests: "read"
runs-on: "ubuntu-latest"
outputs:
commits: "${{ steps.changes.outputs.commits }}"
commits: "${{ steps.commits.outputs.commits }}"
steps:
- name: "install jq"
run: |
Expand All @@ -80,23 +80,23 @@ jobs:
- name: "commits"
id: "commits"
run: |
git rev-list --reverse ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} \
| jq --null-input --raw-input --raw-output --compact-output '[inputs] | "commits=(. | tostring)"' \
set -euxo pipefail
git rev-list --pretty=oneline ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} \
| sed -e 's/ /", "msg": "/' -e 's/^/{"ref": "/' -e 's/$/"}/' \
| jq --null-input --raw-output --compact-output '[inputs] | "commits=" + (. | tostring)' \
| tee -a "${GITHUB_OUTPUT}"
build:
needs: [ check_changes, history ]
needs: [ check_changes, commits ]
if: "${{ needs.check_changes.outputs.devfiles == 'true' }}"
strategy:
fail-fast: false
max-parallel: 4
matrix:
commit: ${{ fromJSON(needs.history.outputs.commits) }}
commit: ${{ fromJSON(needs.commits.outputs.commits) }}
rust:
- "stable"
- "beta"
- "nightly"
name: "Developer build (Rust ${{ matrix.rust }})"
name: "rust/${{ matrix.rust }}/${{ matrix.commit.msg }}"
runs-on: "lab"
timeout-minutes: 45
steps:
Expand All @@ -111,12 +111,12 @@ jobs:
with:
toolchain: "${{ matrix.rust }}"
targets: "x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl"
- name: "Checkout"
- name: "Checkout ${{matrix.commit.msg}}"
uses: "actions/checkout@v4"
with:
ref: "${{ matrix.commit }}"
ref: "${{ matrix.commit.ref }}"
persist-credentials: "false"
fetch-depth: "0"
fetch-depth: "1"
- uses: "cargo-bins/cargo-binstall@main"
- name: "install just"
run: |
Expand All @@ -142,26 +142,6 @@ jobs:
- run: |
just --yes debug=true fake-nix
# - run: |
# # Run a simple build for each separate commit (for "pull_request")
# # or for the HEAD of the branch (other events).
# set -eu -o pipefail
# COMMITS=${{ github.sha }}
# if [[ "${{ github.event_name == 'pull_request' }}" == "true" ]]; then
# # Get all commits from Pull Request, in chronological order
# COMMITS=$(git rev-list --reverse ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
# fi
# for commit in $COMMITS ; do
# git checkout $commit || exit 1
# printf "::group::Build commit %s\n" "$(git log --oneline --no-decorate -n 1)"
# (just debug=true cargo +${{matrix.rust}} build --locked --profile=dev --target=x86_64-unknown-linux-gnu) || exit 1
# printf "::endgroup::\n"
# done
# printf "::notice::HEAD remains at %s\n" "$(git log --oneline --no-decorate -n 1)"
# continue-on-error: ${{ matrix.rust.optional }}

# At this stage, for Pull Requests, we're back to the HEAD of the branch,
# start running tests for different configurations.
- name: "tests: rust ${{ matrix.rust }} profile=dev target=x86_64-unknown-linux-gnu"
run: |
export GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -195,7 +175,7 @@ jobs:
- uses: "actions/upload-artifact@v4"
if: ${{ always() }}
with:
name: "test-results-${{ matrix.rust }}"
name: "results-${{ matrix.rust }}-${{ matrix.commit.ref }}"
path: "target/nextest/"

- name: "Setup tmate session for debug"
Expand Down

0 comments on commit f47ad4f

Please sign in to comment.