Merge pull request #2704 from artichoke/dependabot/github_actions/gha… #582
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
--- | |
name: Spec | |
"on": | |
push: | |
branches: | |
- trunk | |
concurrency: | |
group: spec-state-${{ github.head_ref }} | |
env: | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
spec-state: | |
name: spec-state | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.1.2 | |
with: | |
path: artichoke | |
- name: Install Rust toolchain | |
uses: artichoke/setup-rust/build-and-test@v1.11.0 | |
with: | |
toolchain: "1.76.0" | |
- name: Compile spec-runner | |
run: cargo build --release --verbose --bin spec-runner | |
working-directory: "artichoke/spec-runner" | |
- name: Set commit metadata | |
id: commit | |
run: | | |
commit_date="$(git show --no-patch --format="%cs")" | |
commit_year="$(git show --no-patch --date="format:%Y" --format="%cd")" | |
commit_month="$(git show --no-patch --date="format:%m" --format="%cd")" | |
commit_hash="$(git show --no-patch --format="%H")" | |
echo "Commit date: ${commit_date}" | |
echo "Commit year: ${commit_year}" | |
echo "Commit month: ${commit_month}" | |
echo "Commit hash: ${commit_hash}" | |
echo "date=${commit_date}" >> $GITHUB_OUTPUT | |
echo "year=${commit_year}" >> $GITHUB_OUTPUT | |
echo "month=${commit_month}" >> $GITHUB_OUTPUT | |
echo "hash=${commit_hash}" >> $GITHUB_OUTPUT | |
working-directory: "artichoke" | |
- name: Set spec tags artifact paths | |
id: tagged | |
run: | | |
yaml="$(git show --no-patch --format="spec-tagged-%cs-rev-%H.yaml")" | |
json="$(git show --no-patch --format="spec-tagged-%cs-rev-%H.json")" | |
echo "Spec tags YAML: ${yaml}" | |
echo "Spec tags JSON: ${json}" | |
echo "yaml=${yaml}" >> $GITHUB_OUTPUT | |
echo "json=${json}" >> $GITHUB_OUTPUT | |
working-directory: "artichoke" | |
- name: Set spec exceptions artifact paths | |
id: exceptions | |
run: | | |
yaml="$(git show --no-patch --format="spec-exceptions-%cs-rev-%H.yaml")" | |
json="$(git show --no-patch --format="spec-exceptions-%cs-rev-%H.json")" | |
echo "Spec exceptions YAML: ${yaml}" | |
echo "Spec exceptions JSON: ${json}" | |
echo "yaml=${yaml}" >> $GITHUB_OUTPUT | |
echo "json=${json}" >> $GITHUB_OUTPUT | |
working-directory: "artichoke" | |
- name: Generate spec tags | |
run: | | |
./artichoke/spec-runner/target/release/spec-runner --quiet --format tagger artichoke/spec-runner/spec-state.toml | tee "${{ steps.tagged.outputs.yaml }}" | |
./artichoke/spec-runner/scripts/spec-yaml-to-json.rb "${{ steps.tagged.outputs.yaml }}" > "${{ steps.tagged.outputs.json }}" | |
- name: Generate spec exceptions | |
run: | | |
./artichoke/spec-runner/target/release/spec-runner --quiet --format yaml artichoke/spec-runner/spec-state.toml | tee "${{ steps.exceptions.outputs.yaml }}" | |
./artichoke/spec-runner/scripts/spec-yaml-to-json.rb "${{ steps.exceptions.outputs.yaml }}" > "${{ steps.exceptions.outputs.json }}" | |
- name: Checkout spec state repository | |
uses: actions/checkout@v4.1.2 | |
with: | |
repository: artichoke/spec-state | |
path: spec-state | |
ssh-key: ${{ secrets.SPEC_STATE_SSH_DEPLOY_PRIVATE_KEY }} | |
- name: Copy spec-state reports | |
run: | | |
# tags | |
mkdir -p "spec-state/reports/tagged/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}" | |
cp "${{ steps.tagged.outputs.json }}" "spec-state/reports/tagged/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}/${{ steps.tagged.outputs.json }}" | |
cp "${{ steps.tagged.outputs.json }}" "spec-state/reports/tagged/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}/latest.json" | |
cp "${{ steps.tagged.outputs.json }}" "spec-state/reports/tagged/${{ steps.commit.outputs.year }}/latest.json" | |
cp "${{ steps.tagged.outputs.json }}" "spec-state/reports/tagged/latest.json" | |
# exceptions | |
mkdir -p "spec-state/reports/exceptions/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}" | |
cp "${{ steps.exceptions.outputs.json }}" "spec-state/reports/exceptions/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}/${{ steps.exceptions.outputs.json }}" | |
cp "${{ steps.exceptions.outputs.json }}" "spec-state/reports/exceptions/${{ steps.commit.outputs.year }}/${{ steps.commit.outputs.month }}/latest.json" | |
cp "${{ steps.exceptions.outputs.json }}" "spec-state/reports/exceptions/${{ steps.commit.outputs.year }}/latest.json" | |
cp "${{ steps.exceptions.outputs.json }}" "spec-state/reports/exceptions/latest.json" | |
- name: Push spec-state | |
run: | | |
cat <<EOF > message.txt | |
spec-state 💎📈 | |
As of artichoke/artichoke@${{ steps.commit.outputs.hash }}. | |
Generated with the spec-state.yaml GitHub Actions workflow. | |
EOF | |
git add reports | |
git -c user.name=artichoke-ci -c user.email=ci@artichokeruby.org commit --file=message.txt --allow-empty | |
git push origin trunk | |
working-directory: "spec-state" |