diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 13c66c9..6e204fc 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -2,10 +2,10 @@ name: Functional Tests on: + pull_request: {} push: branches: - - "main" - pull_request: + - main defaults: run: @@ -18,8 +18,17 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-13"] - version: ["0.16.0", "0.16.1", "0.17.0", "0.18.0", "0.19.0"] + os: ["ubuntu-latest", "macos-13", "macos-latest"] + version: ["0.16.1", "0.17.0", "0.18.0", "0.19.0", "0.20.0-alpha.1"] + exclude: + - os: "macos-latest" + version: "0.16.1" + - os: "macos-latest" + version: "0.17.0" + - os: "macos-latest" + version: "0.18.0" + - os: "macos-latest" + version: "0.19.0" runs-on: ${{ matrix.os }} steps: - name: Checkout ${{ github.repository }} diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 4d4af1f..daed082 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -8,7 +8,7 @@ on: # yamllint disable-line rule:truthy paths: - .github/labels.yml - .github/workflows/sync-labels.yml - workflow_dispatch: + workflow_dispatch: {} jobs: sync-labels: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65540b0..35c3cb8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ minimum_pre_commit_version: 2.18.0 repos: # Security - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 + rev: v1.5.0 hooks: - id: detect-secrets - repo: https://github.com/gitleaks/gitleaks @@ -27,7 +27,7 @@ repos: stages: ["push"] # GitHub Actions - repo: https://github.com/rhysd/actionlint - rev: v1.6.27 + rev: v1.7.0 hooks: - id: actionlint args: ["-pyflakes="] diff --git a/README.md b/README.md index 29b02fa..d14bb55 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ None ## Inputs -| Name | Required | Description | Default | Possible values | -|---------|----------|-----------------------------------------------------------------------------------|----------|--------------------------| -| version | No | Mint version that can be found [here](https://github.com/mint-lang/mint/releases) | `0.19.0` | `0.18.0`, `0.17.0`, etc. | +| Name | Required | Description | Default | Possible values | +|---------|----------|-----------------------------------------------------------------------------------|------------------|--------------------------| +| version | No | Mint version that can be found [here](https://github.com/mint-lang/mint/releases) | `0.20.0-alpha.1` | `0.19.0`, `0.18.0`, etc. | ## Example usage diff --git a/action.yml b/action.yml index 3a7442d..7492209 100644 --- a/action.yml +++ b/action.yml @@ -9,12 +9,14 @@ inputs: version: description: "Mint version" required: false - default: "0.19.0" + default: "0.20.0-alpha.1" runs: using: "composite" steps: - name: Fail - if: ${{ runner.os == 'Windows' || runner.arch == 'ARM' || runner.arch == 'ARM64' }} + if: (runner.os == 'Windows' + || (runner.os == 'Linux' && runner.arch == 'ARM') + || (runner.os == 'Linux' && runner.arch == 'ARM64')) run: | echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported" exit 1 @@ -23,17 +25,9 @@ runs: id: info env: INPUT_VERSION: "${{ inputs.version }}" - run: | - echo "MINT_INSTALLED=$(if command -v mint >/dev/null 2>&1; then echo true; else echo false; fi)" >> "$GITHUB_OUTPUT" - mkdir -p "$GITHUB_WORKSPACE/mint" - echo "MINT_PATH=$GITHUB_WORKSPACE/mint" >> "$GITHUB_OUTPUT" - if [ "${RUNNER_OS}" = "Linux" ]; then - MINT_BINARY=mint-${INPUT_VERSION}-linux - else - MINT_BINARY=mint-${INPUT_VERSION}-osx - fi - echo "MINT_BINARY=$MINT_BINARY" >> "$GITHUB_OUTPUT" + run: ./collect-info.sh shell: sh + working-directory: "${{ github.action_path }}/src" - name: Download if: ${{ steps.info.outputs.MINT_INSTALLED == 'false' }} uses: robinraju/release-downloader@v1.10 diff --git a/src/collect-info.sh b/src/collect-info.sh new file mode 100755 index 0000000..7c8bfda --- /dev/null +++ b/src/collect-info.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env sh + +# Starting from v0.20.0-alpha.1 mint supports macos arm64 OS. This function +# checks if requested version is less than 0.20.x +if_old_version() { + version="$1" + major=$(echo "$version" | cut -d '.' -f 1) + minor=$(echo "$version" | cut -d '.' -f 2) + if [ "$major" -lt 1 ] && [ "$minor" -lt 20 ]; then + echo "true" + else + echo "false" + fi +} + +echo "MINT_INSTALLED=$(if command -v mint >/dev/null 2>&1; then echo true; else echo false; fi)" >> "$GITHUB_OUTPUT" +mkdir -p "$GITHUB_WORKSPACE/mint" +echo "MINT_PATH=$GITHUB_WORKSPACE/mint" >> "$GITHUB_OUTPUT" +if [ "${RUNNER_OS}" = "Linux" ]; then + MINT_BINARY=mint-${INPUT_VERSION}-linux +else + if [ "${RUNNER_ARCH#ARM}" != "$RUNNER_ARCH" ]; then + if [ "$(if_old_version "${INPUT_VERSION}")" = "true" ]; then + msg="${RUNNER_OS} ${RUNNER_ARCH} is not supported by mint ${INPUT_VERSION}." + msg="${msg} Try newer version of mint (> 0.19.x)." + echo "::error title=OS is not supported::${msg}" + exit 1 + else + MINT_BINARY=mint-${INPUT_VERSION}-macos-latest + fi + else + if [ "$(if_old_version "${INPUT_VERSION}")" = "true" ]; then + MINT_BINARY=mint-${INPUT_VERSION}-osx + else + MINT_BINARY=mint-${INPUT_VERSION}-macos-13 + fi + fi +fi +echo "MINT_BINARY=$MINT_BINARY" >> "$GITHUB_OUTPUT"