Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine pre/main/post into single run entrypoint #68

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
tools-deps: 1.10.1.693

Expand All @@ -36,15 +38,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install Clojure CLI
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
cli: 1.10.1.693

Expand All @@ -59,15 +63,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install leiningen
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
lein: 2.9.1
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -83,15 +89,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install boot
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
boot: 2.8.3
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -107,15 +115,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install babashka
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
bb: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -131,15 +141,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clj-kondo
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
clj-kondo: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -155,15 +167,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install cljstyle
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
cljstyle: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -180,15 +194,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install zprint
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
zprint: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -200,15 +216,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@master

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install all the tools
uses: DeLaGuardo/setup-clojure@main
# uses: ./
uses: ./
with:
cli: 1.11.1.1149
lein: 2.9.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
java-version: '8'

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@9.3
uses: DeLaGuardo/setup-clojure@9.4
with:
# Install just one or all simultaneously
# The value must indicate a particular version of the tool, or use 'latest'
Expand Down
24 changes: 12 additions & 12 deletions __tests__/entrypoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as _cljKondo from '../src/clj-kondo'
import * as _cljstyle from '../src/cljstyle'
import * as _zprint from '../src/zprint'
import * as _utils from '../src/utils'
import {run} from '../src/entrypoint'
import {main} from '../src/entrypoint'

jest.mock('@actions/core')
const core: jest.Mocked<typeof _core> = _core as never
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('setup-clojure', () => {
inputs['lein'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(lein.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})
Expand All @@ -59,23 +59,23 @@ describe('setup-clojure', () => {
inputs['boot'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(boot.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})

it('sets up Clojure CLI tools from deprecated `tools-deps` option', async () => {
inputs['tools-deps'] = '1.2.3'

await run()
await main()

expect(cli.setup).toHaveBeenCalledWith('1.2.3')
})

it('sets up Clojure CLI tools', async () => {
inputs['cli'] = '1.2.3'

await run()
await main()

expect(cli.setup).toHaveBeenCalledWith('1.2.3')
})
Expand All @@ -84,7 +84,7 @@ describe('setup-clojure', () => {
inputs['bb'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(bb.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})
Expand All @@ -93,7 +93,7 @@ describe('setup-clojure', () => {
inputs['clj-kondo'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(cljKondo.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})
Expand All @@ -102,7 +102,7 @@ describe('setup-clojure', () => {
inputs['cljstyle'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(cljstyle.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})
Expand All @@ -112,15 +112,15 @@ describe('setup-clojure', () => {
inputs['github-token'] = 'abc'
utils.isWindows.mockReturnValue(true)

await run()
await main()

expect(core.setFailed).toHaveBeenCalledWith(
'cljstyle on windows is not supported yet.'
)
})

it('throws if none of Clojure tools is specified', async () => {
await run()
await main()
expect(core.setFailed).toHaveBeenCalledWith(
'You must specify at least one clojure tool.'
)
Expand All @@ -130,15 +130,15 @@ describe('setup-clojure', () => {
inputs['bb'] = '1.2.3'
bb.setup.mockRejectedValueOnce('Unknown failure')

await run()
await main()
expect(core.setFailed).toHaveBeenCalledWith('Unknown failure')
})

it('sets up zprint', async () => {
inputs['zprint'] = '1.2.3'
inputs['github-token'] = 'abc'

await run()
await main()

expect(zprint.setup).toHaveBeenCalledWith('1.2.3', 'token abc')
})
Expand Down
2 changes: 0 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ inputs:
runs:
using: 'node16'
main: 'dist/index.js'
pre: 'dist/index.js'
post: 'dist/index.js'
Loading