Skip to content

Commit 3c13fdd

Browse files
committed
Using Enrico's patch for the action to report errors properly
1 parent 9645246 commit 3c13fdd

8 files changed

+7429
-3093
lines changed

.github/workflows/nix-action-8.16-mathcomp2.yml

+1,164-485
Large diffs are not rendered by default.

.github/workflows/nix-action-8.16.yml

+1,308-545
Large diffs are not rendered by default.

.github/workflows/nix-action-8.17.yml

+1,284-535
Large diffs are not rendered by default.

.github/workflows/nix-action-8.18.yml

+1,296-540
Large diffs are not rendered by default.

.github/workflows/nix-action-8.19.yml

+1,248-520
Large diffs are not rendered by default.

.github/workflows/nix-action-8.20.yml

+1,080-450
Large diffs are not rendered by default.

.github/workflows/nix-action-master.yml

+24-10
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,19 @@ jobs:
3636
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
3737
extraPullNames: coq, math-comp
3838
name: coq-community
39+
- id: stepGetDerivation
40+
name: Getting derivation for current job (coq)
41+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
42+
\"master\" --argstr job \"coq\" \\\n --dry-run 2> err > out || (touch fail;
43+
true)\n"
44+
- name: Error reporting
45+
run: cat err
46+
- name: Failure check
47+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
3948
- id: stepCheck
40-
name: Checking presence of CI target coq
41-
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr
42-
bundle \"master\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n
43-
echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\
44-
s/.*/built/\") >> $GITHUB_OUTPUT\n"
49+
name: Checking presence of CI target for current job
50+
run: "(cat out; echo -n status=; cat out | grep \\\"built:\\\" | sed \\\"s/.*/built/\\\
51+
\") >> $GITHUB_OUTPUT\\n\"\n"
4552
- if: steps.stepCheck.outputs.status == 'built'
4653
name: Building/fetching current CI target
4754
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "master"
@@ -84,12 +91,19 @@ jobs:
8491
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
8592
extraPullNames: coq, math-comp
8693
name: coq-community
94+
- id: stepGetDerivation
95+
name: Getting derivation for current job (coq-shell)
96+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
97+
\"master\" --argstr job \"coq-shell\" \\\n --dry-run 2> err > out || (touch
98+
fail; true)\n"
99+
- name: Error reporting
100+
run: cat err
101+
- name: Failure check
102+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
87103
- id: stepCheck
88-
name: Checking presence of CI target coq-shell
89-
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr
90-
bundle \"master\" --argstr job \"coq-shell\" \\\n --dry-run 2>&1 > /dev/null)\n
91-
echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\
92-
s/.*/built/\") >> $GITHUB_OUTPUT\n"
104+
name: Checking presence of CI target for current job
105+
run: "(cat out; echo -n status=; cat out | grep \\\"built:\\\" | sed \\\"s/.*/built/\\\
106+
\") >> $GITHUB_OUTPUT\\n\"\n"
93107
- if: steps.stepCheck.outputs.status == 'built'
94108
name: 'Building/fetching previous CI target: coq'
95109
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "master"

action.nix

+25-8
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,32 @@ with builtins; with lib; let
7676
extraPullNames = map (v: v.name) (tail reordered);
7777
})) ];
7878

79-
stepCheck = { job, bundles ? [] }:
79+
stepGetDerivation = { job, bundles ? [] }:
8080
let bundlestr = if isList bundles then "\${{ matrix.bundle }}" else bundles; in {
81-
name = "Checking presence of CI target ${job}";
82-
id = "stepCheck";
81+
name = "Getting derivation for current job (${job})";
82+
id = "stepGetDerivation";
8383
run = ''
84-
nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \
84+
NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \
8585
--argstr bundle "${bundlestr}" --argstr job "${job}" \
86-
--dry-run 2>&1 > /dev/null)
87-
echo $nb_dry_run
88-
echo status=$(echo $nb_dry_run | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
86+
--dry-run 2> err > out || (touch fail; true)
87+
'';
88+
};
89+
90+
stepErrorReporting = {
91+
name = "Error reporting";
92+
run = "cat err";
93+
};
94+
95+
stepFailureCheck = {
96+
name = "Failure check";
97+
run = "if [ -e fail ]; then exit 1; else exit 0; fi;";
98+
};
99+
100+
stepCheck = {
101+
name = "Checking presence of CI target for current job";
102+
id = "stepCheck";
103+
run = ''
104+
(cat out; echo -n status=; cat out | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n"
89105
'';
90106
};
91107

@@ -108,7 +124,8 @@ with builtins; with lib; let
108124
steps = [ stepCommitToInitiallyCheckout stepCheckout1
109125
stepCommitToTest stepCheckout2 stepCachixInstall ]
110126
++ (stepCachixUseAll cachix)
111-
++ [ (stepCheck { inherit job bundles; }) ]
127+
++ [ (stepGetDerivation { inherit job bundles; })
128+
stepErrorReporting stepFailureCheck stepCheck ]
112129
++ (map (job: stepBuild { inherit job bundles; }) jdeps)
113130
++ [ (stepBuild { inherit job bundles; current = true; }) ];
114131
} // (optionalAttrs (isList bundles) {strategy.matrix.bundle = bundles;});

0 commit comments

Comments
 (0)