-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 2.7 KB
/
Copy pathfixtures.yml
File metadata and controls
92 lines (80 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Fixtures
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
fixture-checks:
name: Fixture checks (${{ matrix.fixture-directory }})
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
fixture-directory:
- real_contracts
- various
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
submodules: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Use Rust cache
uses: Swatinem/rust-cache@v2
- name: Resolve simfmt source
id: simfmt-source
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
PR_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "pull_request" ]]; then
printf 'repository=%s\n' "$PR_HEAD_REPOSITORY" >> "$GITHUB_OUTPUT"
printf 'revision=%s\n' "$PR_HEAD_SHA" >> "$GITHUB_OUTPUT"
else
printf 'repository=%s\n' "$REPOSITORY" >> "$GITHUB_OUTPUT"
printf 'revision=%s\n' "$SHA" >> "$GITHUB_OUTPUT"
fi
- name: Install simfmt and simfmt-check
uses: ./.github/actions/setup
with:
commit-sha: ${{ steps.simfmt-source.outputs.revision }}
owner-repo: ${{ steps.simfmt-source.outputs.repository }}
- name: Format source fixtures and compare expected output
shell: bash
env:
FIXTURE_DIRECTORY: ${{ matrix.fixture-directory }}
run: |
source_directory="crates/cli/tests/source/$FIXTURE_DIRECTORY"
target_directory="crates/cli/tests/target/$FIXTURE_DIRECTORY"
formatted_directory="$(mktemp -d)"
trap 'rm -rf "$formatted_directory"' EXIT
cp -R "$source_directory/." "$formatted_directory/"
simfmt-check -all -d "$formatted_directory"
diff --recursive --unified "$target_directory" "$formatted_directory"
- name: Check target fixture idempotence
shell: bash
env:
FIXTURE_DIRECTORY: ${{ matrix.fixture-directory }}
run: simfmt-check -all -d "crates/cli/tests/target/$FIXTURE_DIRECTORY" --check