-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c1b73c
commit 0850630
Showing
19 changed files
with
1,702 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: "GitHub Action: Self-Test" | ||
on: | ||
push: | ||
|
||
jobs: | ||
setup-iggy: | ||
name: Test setup-iggy | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build dist | ||
run: yarn run build | ||
|
||
- name: Setup iggy (using local GitHub Action) | ||
uses: "./" | ||
with: | ||
version: "0.4.71" | ||
|
||
- name: Print $PATH for iggy | ||
run: which iggy-server | ||
|
||
- name: Print iggy version | ||
run: iggy-server --version | ||
|
||
- name: Check version is the one asked | ||
run: | | ||
VERSION=$(iggy-server --version | grep -oP 'server \K[0-9]+\.[0-9]+\.[0-9]+') | ||
if [ "$VERSION" != "0.4.71" ]; then | ||
echo "Error: Expected version 0.4.71, but got $VERSION" | ||
exit 1 | ||
fi | ||
echo "Version is correct: $VERSION" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Checks | ||
on: | ||
push: | ||
|
||
jobs: | ||
checks: | ||
name: Install and build | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast | ||
fail-fast: false | ||
matrix: | ||
node-version: | ||
- 22.x | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build dist | ||
run: yarn run build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
install: | ||
name: Install and build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build dist | ||
run: yarn run build | ||
|
||
semantic-release: | ||
needs: install | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ secrets.DEPLOY_APP_ID }} | ||
private-key: ${{ secrets.DEPLOY_APP_KEY }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config | ||
persist-credentials: false | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v4 | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
VERSION.txt | ||
package.json | ||
package-lock.json | ||
CHANGELOG.md | ||
key: ${{ runner.os }}-sr-version-${{ github.sha }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
22 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"printWidth": 100, | ||
"trailingComma": "all" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "always" | ||
}, | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"editor.formatOnSave": true, | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact" | ||
], | ||
} |
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @spetz @T1B0 @Tchoupinax |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
# setup-iggy | ||
# GitHub Action: `setup-iggy` | ||
|
||
<p> | ||
<a href="https://github.com/iggy-rs/setup-iggy/releases"><img alt="Latest release" src="https://img.shields.io/github/v/release/Tchoupinax/setup-iggy"></a> | ||
</p> | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: Test with Iggy server | ||
on: | ||
push: | ||
jobs: | ||
tests-iggy: | ||
name: Test setup-iggy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup iggy | ||
uses: "./" | ||
with: | ||
version: "0.4.71" | ||
- name: Print iggy version | ||
run: iggy-server --version | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# https://docs.github.com/en/actions/sharing-automations/creating-actions/publishing-actions-in-github-marketplace | ||
name: "Setup Iggy server" | ||
author: "Tchoupinax" | ||
description: "A GitHub Action to run iggy server" | ||
inputs: | ||
version: | ||
description: "The Iggy version to launch." | ||
required: false | ||
default: "0.4.72" | ||
outputs: | ||
version: | ||
description: "The Iggy version that was launched." | ||
runs: | ||
using: "node20" | ||
main: "dist/index.js" | ||
# https://actions-cool.github.io/github-action-branding | ||
branding: | ||
icon: "box" | ||
color: "orange" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import eslint from "@eslint/js"; | ||
|
||
import eslintPluginJsonc from 'eslint-plugin-jsonc'; | ||
import eslintPluginPrettierRecommended from "eslint-plugin-prettier"; | ||
import simpleImportSort from "eslint-plugin-simple-import-sort"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
tseslint.configs.recommended, | ||
...eslintPluginJsonc.configs['flat/recommended-with-jsonc'], | ||
{ | ||
plugins: { | ||
"eslint-plugin-prettier": eslintPluginPrettierRecommended, | ||
}, | ||
}, | ||
{ | ||
plugins: { | ||
"simple-import-sort": simpleImportSort, | ||
}, | ||
ignores: ["package.json"], | ||
rules: { | ||
// https://github.com/lydell/eslint-plugin-simple-import-sort | ||
"simple-import-sort/imports": [ | ||
"error", | ||
{ | ||
// https://dev.to/receter/automatic-import-sorting-in-vscode-275m | ||
groups: [["^@?\\w", "^node"], ["^[^@]?\\w"]], | ||
}, | ||
], | ||
"simple-import-sort/exports": "error", | ||
}, | ||
}, | ||
{ | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": "off", | ||
}, | ||
}, | ||
{ | ||
files: ["**/*.json"], | ||
ignores: ["package.json"], | ||
rules: { | ||
"jsonc/sort-keys": ["error"] | ||
} | ||
} | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "setup-iggy", | ||
"version": "0.1.0", | ||
"description": "A GitHub Action to install a specific version of Iggy server", | ||
"keywords": [ | ||
"github-actions", | ||
"hashicorp", | ||
"nomad" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:iggy-rs/setup-iggy.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Tchoupinax", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc && ncc build --no-cache", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "1.11.1", | ||
"@actions/tool-cache": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "22.9.3", | ||
"@vercel/ncc": "0.38.3", | ||
"eslint": "9.15.0", | ||
"eslint-plugin-jsonc": "2.18.2", | ||
"eslint-plugin-prettier": "5.2.1", | ||
"eslint-plugin-simple-import-sort": "12.1.1", | ||
"typescript": "5.6", | ||
"typescript-eslint": "8.15.0", | ||
"vite-node": "2.1.5" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as core from "@actions/core"; | ||
|
||
import { downloadFile } from "./download-binary"; | ||
|
||
export async function setupBinary(version: string) { | ||
core.info(`Installing iggy binary (${version})...`); | ||
|
||
const binaryPath = await downloadFile(version); | ||
core.info(`Binary path is: ${binaryPath}`); | ||
|
||
core.addPath(binaryPath); | ||
core.info(`iggy:${version} added to path`); | ||
|
||
core.setOutput("version", version); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as core from "@actions/core"; | ||
import tc from "@actions/tool-cache"; | ||
|
||
export async function downloadFile(version: string): Promise<string> { | ||
const binaryUrl = `https://github.com/iggy-rs/iggy/releases/download/server-${version}/Linux-x86_64.zip`; | ||
core.info(`Downloading from ${binaryUrl}`); | ||
|
||
const pathToTarball = await tc.downloadTool(binaryUrl); | ||
const pathToCLI = await tc.extractTar(pathToTarball); | ||
|
||
return pathToCLI; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as core from "@actions/core"; | ||
|
||
import { setupBinary } from "./binary"; | ||
|
||
const DEFAULT_VERSION = "0.4.72"; | ||
|
||
async function main() { | ||
let version = core.getInput("version", { required: false }); | ||
if (version == null || version == "") { | ||
version = DEFAULT_VERSION; | ||
} | ||
|
||
try { | ||
core.info(`Installing iggy:${version} and adding it to GitHub Actions Path`); | ||
|
||
await setupBinary(version); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
core.setFailed(error.message); | ||
} | ||
} | ||
} | ||
|
||
main(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os from "os"; | ||
|
||
export function getArch(): string { | ||
const arch = os.arch(); | ||
switch (arch) { | ||
case "arm": | ||
return "arm"; | ||
case "arm64": | ||
return "arm64"; | ||
case "x32": | ||
return "386"; | ||
case "x64": | ||
return "amd64"; | ||
default: | ||
throw new Error(`Unsupported operating system architecture: ${arch}`); | ||
} | ||
} |
Oops, something went wrong.