Skip to content

Commit 1660831

Browse files
github-actions[bot]github-actionsfabasoad
authored
Bump actionlint from 1.7.4 to 1.7.6 (#120)
## Changelog - Update license copyright year to 2025 --- Powered by [FantasticFiasco/action-update-license-year](https://github.com/FantasticFiasco/action-update-license-year) --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: fabasoad <[email protected]>
1 parent 645d75a commit 1660831

9 files changed

+176
-81
lines changed
+72-18
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,58 @@
11
---
22
name: Functional Tests
33

4-
on:
5-
pull_request: {}
4+
on: # yamllint disable-line rule:truthy
65
push:
76
branches:
87
- main
8+
pull_request:
9+
paths:
10+
- .github/workflows/functional-tests.yml
11+
- src/**
12+
- action.yml
13+
schedule:
14+
# Every Friday at 09:00 JST
15+
- cron: "0 0 * * 5"
16+
workflow_dispatch: {}
917

1018
defaults:
1119
run:
1220
shell: sh
1321

1422
jobs:
15-
functional-tests:
16-
name: Run init
23+
get-versions:
24+
name: Get 3 latest versions
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
outputs:
28+
versions: ${{ steps.prepare-list.outputs.versions }}
29+
steps:
30+
- name: Get releases
31+
id: github-releases
32+
uses: yakubique/[email protected]
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
repository: "mint-lang/mint"
37+
sort: "desc"
38+
- name: Prepare list
39+
id: prepare-list
40+
env:
41+
RELEASES_AMOUNT: "3"
42+
run: |
43+
versions=$(echo '${{ steps.github-releases.outputs.releases }}' \
44+
| jq -c -r --arg n "${RELEASES_AMOUNT}" '.[0:($n | tonumber)] | . += ["latest"]')
45+
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
46+
setup-mint:
47+
name: Setup mint
48+
needs: [get-versions]
49+
runs-on: ${{ matrix.os }}-latest
1750
timeout-minutes: 5
1851
strategy:
1952
fail-fast: false
2053
matrix:
21-
os: ["ubuntu-latest", "macos-13", "macos-latest"]
22-
version: ["0.21.0", "0.20.1", "0.20.0", "0.19.0", "0.18.0"]
23-
exclude:
24-
- os: "macos-latest"
25-
version: "0.18.0"
26-
- os: "macos-latest"
27-
version: "0.19.0"
28-
- os: "macos-13"
29-
version: "0.20.0"
30-
- os: "macos-13"
31-
version: "0.20.1"
32-
- os: "macos-13"
33-
version: "0.21.0"
34-
runs-on: ${{ matrix.os }}
54+
os: ["ubuntu", "macos"]
55+
version: ${{ fromJSON(needs.get-versions.outputs.versions) }}
3556
steps:
3657
- name: Checkout ${{ github.repository }}
3758
uses: actions/checkout@v4
@@ -41,3 +62,36 @@ jobs:
4162
version: ${{ matrix.version }}
4263
- name: Print version
4364
run: mint version
65+
test-force:
66+
name: Test force
67+
runs-on: ubuntu-latest
68+
timeout-minutes: 5
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
force: ["true", "false"]
73+
steps:
74+
- name: Checkout ${{ github.repository }}
75+
uses: actions/checkout@v4
76+
- name: Setup Mint 1
77+
id: setup-mint-1
78+
uses: ./
79+
- name: Setup Mint 2
80+
id: setup-mint-2
81+
uses: ./
82+
with:
83+
force: ${{ matrix.force }}
84+
- name: Test action completion
85+
run: |
86+
test_equal() {
87+
if [ "${2}" != "${3}" ]; then
88+
echo "::error title=${1}::Expected: ${3}. Actual: ${2}."
89+
exit 1
90+
fi
91+
}
92+
test_equal "Wrong \"installed\" output from setup-mint-1" \
93+
"${{ steps.setup-mint-1.outputs.installed }}" \
94+
"true"
95+
test_equal "Wrong \"installed\" output from setup-mint-2" \
96+
"${{ steps.setup-mint-2.outputs.installed }}" \
97+
"${{ matrix.force }}"

.github/workflows/security.yml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ jobs:
1414
contents: read
1515
security-events: write
1616
uses: fabasoad/reusable-workflows/.github/workflows/wf-security-sast.yml@main
17+
with:
18+
code-scanning: true
19+
sca: true

.github/workflows/update-license.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: License
33

44
on: # yamllint disable-line rule:truthy
55
schedule:
6+
# Every January 1st at 14:00 JST
67
- cron: "0 5 1 1 *"
78

89
jobs:

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
hooks:
2222
- id: detect-secrets
2323
- repo: https://github.com/gitleaks/gitleaks
24-
rev: v8.22.0
24+
rev: v8.22.1
2525
hooks:
2626
- id: gitleaks
2727
- repo: https://github.com/fabasoad/pre-commit-grype
@@ -53,7 +53,7 @@ repos:
5353
stages: ["pre-push"]
5454
# GitHub Actions
5555
- repo: https://github.com/rhysd/actionlint
56-
rev: v1.7.4
56+
rev: v1.7.6
5757
hooks:
5858
- id: actionlint
5959
args: ["-pyflakes="]

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2024 Yevhen Fabizhevskyi
3+
Copyright (c) 2020-2025 Yevhen Fabizhevskyi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+20-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,30 @@ This action sets up a [Mint](https://www.mint-lang.com/) programming language.
2222

2323
## Prerequisites
2424

25-
None
25+
None.
2626

2727
## Inputs
2828

29+
```yaml
30+
- uses: fabasoad/setup-mint-action@v1
31+
with:
32+
# (Optional) Mint version. Defaults to the latest version.
33+
version: "0.21.0"
34+
# (Optional) If "false" skips installation if mint is already installed. If
35+
# "true" installs mint in any case. Defaults to "false".
36+
force: "false"
37+
# (Optional) GitHub token that is used to send requests to GitHub API such
38+
# as downloading asset. Defaults to the token provided by GitHub Actions
39+
# environment.
40+
github-token: "${{ github.token }}"
41+
```
42+
43+
## Outputs
44+
2945
<!-- prettier-ignore-start -->
30-
| Name | Required | Description | Default | Possible values |
31-
|---------|----------|-----------------------------------------------------------------------------------|----------|--------------------------|
32-
| version | No | Mint version that can be found [here](https://github.com/mint-lang/mint/releases) | `0.21.0` | `0.19.0`, `0.20.1`, etc. |
46+
| Name | Description | Example |
47+
|-----------|-----------------------------------|---------|
48+
| installed | Whether mint was installed or not | `true` |
3349
<!-- prettier-ignore-end -->
3450

3551
## Example usage
@@ -46,7 +62,6 @@ jobs:
4662
name: Setup
4763
runs-on: ubuntu-latest
4864
steps:
49-
- uses: actions/checkout@v4
5065
- uses: fabasoad/setup-mint-action@v1
5166
- name: Run script
5267
run: mint init test-project

action.yml

+43-18
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,25 @@ branding:
77
color: green
88
inputs:
99
version:
10-
description: "Mint version"
10+
description: Mint version. Defaults to the latest version.
1111
required: false
12-
default: "0.21.0"
12+
default: "latest"
13+
force:
14+
description: |
15+
If "false" skips installation if mint is already installed. If "true"
16+
installs mint in any case. Defaults to "false".
17+
required: false
18+
default: "false"
19+
github-token:
20+
description: |
21+
GitHub token that is used to send requests to GitHub API such as getting
22+
latest release. Defaults to the token provided by GitHub Actions environment.
23+
required: false
24+
default: ${{ github.token }}
25+
outputs:
26+
installed:
27+
description: Whether mint was installed or not.
28+
value: "${{ steps.install-mint.outcome == 'success' }}"
1329
runs:
1430
using: "composite"
1531
steps:
@@ -20,29 +36,38 @@ runs:
2036
echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
2137
exit 1
2238
shell: sh
39+
2340
- name: Collect info
2441
id: info
2542
env:
26-
INPUT_VERSION: "${{ inputs.version }}"
27-
run: ./collect-info.sh "${INPUT_VERSION}"
43+
INPUT_FORCE: "${{ inputs.force }}"
44+
run: ./collect-info.sh "${INPUT_FORCE}"
2845
shell: sh
2946
working-directory: "${{ github.action_path }}/src"
30-
- name: Download
31-
if: ${{ steps.info.outputs.mint-installed == 'false' }}
47+
48+
- name: Download binary
49+
if: ${{ steps.info.outputs.bin-installed == 'false' }}
50+
id: download-binary
3251
uses: robinraju/release-downloader@v1
3352
with:
34-
repository: mint-lang/mint
35-
latest: false
36-
tag: ${{ inputs.version }}
37-
fileName: ${{ steps.info.outputs.mint-binary }}
38-
tarBall: false
39-
zipBall: false
40-
out-file-path: mint
41-
- name: Install
42-
if: ${{ steps.info.outputs.mint-installed == 'false' }}
53+
repository: "mint-lang/mint"
54+
latest: "${{ inputs.version == 'latest' }}"
55+
tag: "${{ inputs.version == 'latest' && '' || inputs.version }}"
56+
fileName: "mint-*-${{ runner.os == 'Linux' && 'linux' || 'osx' }}-${{ startsWith(runner.arch, 'ARM') && 'arm64' || 'x86_64' }}"
57+
out-file-path: "${{ steps.info.outputs.bin-dir }}"
58+
token: "${{ inputs.github-token }}"
59+
60+
- name: Install mint
61+
if: ${{ steps.info.outputs.bin-installed == 'false' }}
62+
id: install-mint
4363
run: |
44-
mv "${{ steps.info.outputs.mint-binary }}" mint
64+
tag_name="${{ steps.download-binary.outputs.tag_name }}"
65+
mv "mint-${tag_name}-${{ runner.os == 'Linux' && 'linux' || 'osx' }}-${{ startsWith(runner.arch, 'ARM') && 'arm64' || 'x86_64' }}" mint
4566
chmod +x mint
46-
echo "${{ steps.info.outputs.mint-path }}" >> "$GITHUB_PATH"
67+
echo "$(pwd)" >> "$GITHUB_PATH"
68+
shell: sh
69+
working-directory: ${{ steps.info.outputs.bin-path }}
70+
71+
- name: Print version
72+
run: mint version
4773
shell: sh
48-
working-directory: ${{ steps.info.outputs.mint-path }}

src/collect-info.sh

+20-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,33 @@
11
#!/usr/bin/env sh
22

3-
# Starting from v0.20.0-alpha.1 mint supports macos arm64 OS. This function
4-
# checks if requested version is less than 0.20.x
5-
_if_old_version() {
6-
version="${1}"
3+
SCRIPT_PATH=$(realpath "$0")
4+
SRC_DIR_PATH=$(dirname "$SCRIPT_PATH")
5+
LIB_DIR_PATH="${SRC_DIR_PATH}/lib"
76

8-
major=$(echo "$version" | cut -d '.' -f 1)
9-
minor=$(echo "$version" | cut -d '.' -f 2)
10-
if [ "$major" -lt 1 ] && [ "$minor" -lt 20 ]; then
11-
echo "true"
12-
else
13-
echo "false"
14-
fi
15-
}
7+
. "${LIB_DIR_PATH}/logging.sh"
168

179
main() {
18-
input_version="${1}"
10+
input_force="${1}"
1911

20-
echo "mint-installed=$(if command -v mint >/dev/null 2>&1; then echo true; else echo false; fi)" >> "$GITHUB_OUTPUT"
21-
mkdir -p "${GITHUB_WORKSPACE}/mint"
22-
echo "mint-path=${GITHUB_WORKSPACE}/mint" >> "$GITHUB_OUTPUT"
23-
if [ "${RUNNER_OS}" = "Linux" ]; then
24-
if [ "$(_if_old_version "${input_version}")" = "true" ]; then
25-
mint_binary="mint-${input_version}-linux"
12+
bin_installed="false"
13+
if command -v mint >/dev/null 2>&1; then
14+
if [ "${input_force}" = "false" ]; then
15+
msg="Installation skipped."
16+
bin_installed="true"
2617
else
27-
mint_binary="mint-${input_version}-linux-x86_64"
18+
msg="Executing forced installation."
2819
fi
20+
log_info "mint is found at $(which mint). ${msg}"
2921
else
30-
if [ "${RUNNER_ARCH#ARM}" != "$RUNNER_ARCH" ]; then
31-
if [ "$(_if_old_version "${input_version}")" = "true" ]; then
32-
msg="${RUNNER_OS} ${RUNNER_ARCH} is not supported by mint ${input_version}."
33-
msg="${msg} Try newer version of mint (>= 0.20.0)."
34-
echo "::error title=OS is not supported::${msg}"
35-
exit 1
36-
else
37-
mint_binary="mint-${input_version}-osx-arm64"
38-
fi
39-
else
40-
if [ "$(_if_old_version "${input_version}")" = "true" ]; then
41-
mint_binary="mint-${input_version}-osx"
42-
else
43-
mint_binary="mint-${input_version}-osx-x86_64"
44-
fi
45-
fi
22+
log_info "mint is not found. Executing installation."
4623
fi
47-
echo "mint-binary=${mint_binary}" >> "$GITHUB_OUTPUT"
24+
echo "bin-installed=${bin_installed}" >> "$GITHUB_OUTPUT"
25+
26+
bin_dir="mint_$(date +%s)"
27+
echo "bin-dir=${bin_dir}" >> "$GITHUB_OUTPUT"
28+
29+
bin_path="$GITHUB_WORKSPACE/${bin_dir}"
30+
echo "bin-path=${bin_path}" >> "$GITHUB_OUTPUT"
4831
}
4932

5033
main "$@"

src/lib/logging.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
3+
# Printing log to the console.
4+
# Parameters:
5+
# 1. (Required) Log level. Options: debug, info, warning, error.
6+
# 2. (Required) Message.
7+
log() {
8+
header="setup-mint-action"
9+
printf "[%s] [%s] %s %s\n" "${1}" "${header}" "$(date +'%Y-%m-%d %T')" "${2}" 1>&2
10+
}
11+
12+
log_info() {
13+
log "info" "${1}"
14+
}

0 commit comments

Comments
 (0)