Skip to content

Commit 2eeaafa

Browse files
authored
fix: use api endpoint for snapshots data (#110)
* fix: use api endpoint for snapshots data Fixes #109. * chore(ci): use built binary in test-action Previously, we had a run of the action in the `test` job that used the built binary (`no-install`), then we had a run of the action in `test-action` (per os) that installed the latest release. The benefit here was that the run in `test` exercised a built binary in the context of the action, and the runs `test-action` exercised the install step on each os. The downside is that if there is a problem with the currently-released version (as there is right now), the `test-action` runs will fail. Since we have strict status checks on PRs, this makes it difficult to address that latest release. This commit addresses the downside while losing that upside: it makes the installation steps become untested. I think that's acceptable because the bulk of the logic is provided by a 3rd-party action (`pbrisbin/setup-tool-action`) which has its own test suite. Querying for "latest" is the only logic truly becoming untested (for now). * Revert "chore(ci): use built binary in test-action" This reverts commit dc75a78. * fix(ci): test installation only in test-action Running SLED in the context of an action is already tested as a step in the `test` job. `test-action` exists to test the (os-specific) installation steps, so it installs the latest release. Sometimes (as is the case now) there is a problem with that release which can cause `test-action` to fail. This can make it hard to merge the PR that is fixing things, since that status is required. By adding a `run` input and not actually running the tool in `test-action`, we can avoid this scenario by making the test only test what it cares about, and so be more robust to false failures like this.
1 parent 626f9ca commit 2eeaafa

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v5
1717
- uses: freckle/stack-action@v5
18+
19+
# NOTE: This step tests execution in the context of an action, and is here
20+
# so that it uses the branch-built binary. The test-action matrix exists
21+
# separately to test the _installation_ portion of the action only, which
22+
# is affected by operating system.
1823
- uses: ./
1924
with:
2025
arguments: --format gha --path test/examples/lts-18.18.yaml --no-exit
@@ -36,7 +41,8 @@ jobs:
3641
- uses: actions/checkout@v5
3742
- uses: ./
3843
with:
39-
arguments: --path test/examples/lts-18.18.yaml --no-exit
44+
run: false
45+
- run: stack-lint-extra-deps --version
4046

4147
nix:
4248
strategy:

action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ inputs:
1818
to be installed and on PATH already.
1919
required: false
2020
default: false
21+
run:
22+
description: |
23+
Whether to run the tool or not. This is mostly useful for testing the
24+
install portion of the action. Default is `true`.
25+
required: false
26+
default: true
2127
github-token:
2228
description: |
2329
GitHub token for authenticating with GitHub API (to determine release
@@ -59,7 +65,8 @@ runs:
5965
os-darwin: osx
6066
arch-x64: x86_64
6167

62-
- shell: bash
68+
- if: ${{ inputs.run == 'true' }}
69+
shell: bash
6370
run: |
6471
${{inputs.executable}} ${{ inputs.arguments }}
6572
env:

src/SLED/Stackage/Snapshots.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ getSnapshotsPage
6262
getSnapshotsPage page = liftIO $ try $ do
6363
req <-
6464
parseRequestThrow
65-
$ "http://www.stackage.org/snapshots?page="
65+
$ "https://www.stackage.org/api/v1/snapshots?page="
6666
<> show page
6767
resp <- httpJSON req
6868
pure $ getResponseBody resp

0 commit comments

Comments
 (0)