Fallback if Scarb does not have the cache path
command
#71
Workflow file for this run
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
merge_group: | |
jobs: | |
test: | |
name: test ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Fetch latest Scarb version from GitHub releases" | |
id: version | |
shell: pwsh | |
run: | | |
$location = (Invoke-WebRequest -Uri "https://github.com/software-mansion/scarb/releases/latest" -Method Head -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction Ignore).Headers.Location | |
$latest_version = ($location -replace '^.*/v','') | |
echo "Latest Scarb version found is $latest_version" | |
echo "LATEST_VERSION=$latest_version" >> $env:GITHUB_OUTPUT | |
$location = (Invoke-WebRequest -Uri "https://github.com/software-mansion/scarb-nightlies/releases/latest" -Method Head -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction Ignore).Headers.Location | |
$latest_version = ($location -replace '^.*/nightly-','nightly-') | |
echo "Latest Scarb nightly version found is $latest_version" | |
echo "LATEST_NIGHTLY_VERSION=$latest_version" >> $env:GITHUB_OUTPUT | |
- name: "Setup Scarb without `scarb-version`" | |
uses: ./ | |
- run: scarb --version | grep "scarb ${{ steps.version.outputs.LATEST_VERSION }}" | |
# NOTE: This is Scarb <0.7.0, thus this test checks the `cache path` fallback logic. | |
- name: "Setup Scarb with `scarb-version: 0.4.1`" | |
uses: ./ | |
with: | |
scarb-version: 0.4.1 | |
- run: scarb --version | grep "scarb 0.4.1" | |
- name: "Setup Scarb with `scarb-version: latest`" | |
uses: ./ | |
with: | |
scarb-version: latest | |
- run: scarb --version | grep "scarb ${{ steps.version.outputs.LATEST_VERSION }}" | |
- name: "Setup Scarb with `scarb-version: nightly-2023-08-10`" | |
uses: ./ | |
with: | |
scarb-version: nightly-2023-08-10 | |
- run: scarb --version | grep "scarb 0.6.0+nightly-2023-08-10" | |
- name: "Setup Scarb with `scarb-version: nightly`" | |
uses: ./ | |
with: | |
scarb-version: nightly | |
- run: scarb --version | grep "${{ steps.version.outputs.LATEST_NIGHTLY_VERSION }}" | |
- name: "Create .tool-versions file" | |
run: echo "scarb 0.7.0" >> .tool-versions | |
- name: "Setup Scarb using `.tool-versions` file" | |
uses: ./ | |
- run: scarb --version | grep "scarb 0.7.0" | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
- run: npm ci | |
- run: npm run lint |