Bump actions/checkout
#3
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: Test Setup Forklift | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
#os: [macos-latest, windows-latest, ubuntu-latest] | |
os: [ubuntu-latest] | |
version: ["<0.5", "0.5.0"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup forklift | |
uses: ./ | |
with: | |
version: ${{ matrix.version }} | |
- name: Get expected version | |
run: | | |
if [ "${{ matrix.version }}" = "<0.5" ]; then | |
export EXPECTED_VERSION=v0.4.0 | |
elif [ "${{ matrix.version }}" = "0.5.0" ]; then | |
export EXPECTED_VERSION=v0.5.0 | |
else | |
# get the latest version info from the github api | |
export EXPECTED_VERSION=$(curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/PlanktoScope/forklift/releases/latest | jq -r .name ) | |
fi | |
if [ "${{ matrix.version }}" = "edge" ]; then | |
export EXPECTED_VERSION="$(echo $EXPECTED_VERSION | awk -F. '{print $1"."$2+1".0-dev"}')" | |
fi | |
echo "Expected version for ${{ matrix.version }}: $EXPECTED_VERSION" | |
echo "EXPECTED_VERSION=$EXPECTED_VERSION" >> $GITHUB_ENV | |
- name: Capture version installed | |
run: | | |
echo "VERSION_INSTALLED=$( forklift --version | head -1 | sed 's/forklift version v/v/' )" >> $GITHUB_ENV | |
- name: Verify | |
shell: bash | |
run: | | |
if [ "$EXPECTED_VERSION" != "$VERSION_INSTALLED" ]; then | |
echo "Unexpected version, expected $EXPECTED_VERSION, got: $VERSION_INSTALLED" | |
exit 1; | |
fi | |
exit 0; | |