Skip to content

Commit

Permalink
Using Enrico's patch for the action to report errors properly
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenCyril committed Dec 4, 2024
1 parent 9645246 commit 60a5bab
Show file tree
Hide file tree
Showing 8 changed files with 7,432 additions and 3,093 deletions.
1,649 changes: 1,164 additions & 485 deletions .github/workflows/nix-action-8.16-mathcomp2.yml

Large diffs are not rendered by default.

1,853 changes: 1,308 additions & 545 deletions .github/workflows/nix-action-8.16.yml

Large diffs are not rendered by default.

1,819 changes: 1,284 additions & 535 deletions .github/workflows/nix-action-8.17.yml

Large diffs are not rendered by default.

1,836 changes: 1,296 additions & 540 deletions .github/workflows/nix-action-8.18.yml

Large diffs are not rendered by default.

1,768 changes: 1,248 additions & 520 deletions .github/workflows/nix-action-8.19.yml

Large diffs are not rendered by default.

1,530 changes: 1,080 additions & 450 deletions .github/workflows/nix-action-8.20.yml

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions .github/workflows/nix-action-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ jobs:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
extraPullNames: coq, math-comp
name: coq-community
- id: stepGetDerivation
name: Getting derivation for current job (coq)
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
\"master\" --argstr job \"coq\" \\\n --dry-run 2> err > out || (touch fail;
true)\n"
- name: Error reporting
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
- name: Failure check
run: if [ -e fail ]; then exit 1; else exit 0; fi;
- id: stepCheck
name: Checking presence of CI target coq
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr
bundle \"master\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n
echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\
s/.*/built/\") >> $GITHUB_OUTPUT\n"
name: Checking presence of CI target for current job
run: "(echo -n status=; cat out | grep \\\"built:\\\" | sed \\\"s/.*/built/\\\
\") >> $GITHUB_OUTPUT\n"
- if: steps.stepCheck.outputs.status == 'built'
name: Building/fetching current CI target
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "master"
Expand Down Expand Up @@ -84,12 +91,19 @@ jobs:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
extraPullNames: coq, math-comp
name: coq-community
- id: stepGetDerivation
name: Getting derivation for current job (coq-shell)
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
\"master\" --argstr job \"coq-shell\" \\\n --dry-run 2> err > out || (touch
fail; true)\n"
- name: Error reporting
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
- name: Failure check
run: if [ -e fail ]; then exit 1; else exit 0; fi;
- id: stepCheck
name: Checking presence of CI target coq-shell
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr
bundle \"master\" --argstr job \"coq-shell\" \\\n --dry-run 2>&1 > /dev/null)\n
echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\
s/.*/built/\") >> $GITHUB_OUTPUT\n"
name: Checking presence of CI target for current job
run: "(echo -n status=; cat out | grep \\\"built:\\\" | sed \\\"s/.*/built/\\\
\") >> $GITHUB_OUTPUT\n"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: coq'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "master"
Expand Down
36 changes: 28 additions & 8 deletions action.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,35 @@ with builtins; with lib; let
extraPullNames = map (v: v.name) (tail reordered);
})) ];

stepCheck = { job, bundles ? [] }:
stepGetDerivation = { job, bundles ? [] }:
let bundlestr = if isList bundles then "\${{ matrix.bundle }}" else bundles; in {
name = "Checking presence of CI target ${job}";
id = "stepCheck";
name = "Getting derivation for current job (${job})";
id = "stepGetDerivation";
run = ''
nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \
NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \
--argstr bundle "${bundlestr}" --argstr job "${job}" \
--dry-run 2>&1 > /dev/null)
echo $nb_dry_run
echo status=$(echo $nb_dry_run | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
--dry-run 2> err > out || (touch fail; true)
'';
};

stepErrorReporting = {
name = "Error reporting";
run = ''
echo "out="; cat out
echo "err="; cat err
'';
};

stepFailureCheck = {
name = "Failure check";
run = "if [ -e fail ]; then exit 1; else exit 0; fi;";
};

stepCheck = {
name = "Checking presence of CI target for current job";
id = "stepCheck";
run = ''
(echo -n status=; cat out | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT
'';
};

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

0 comments on commit 60a5bab

Please sign in to comment.