Skip to content

Commit

Permalink
Migrate to nodejs action, add rattler-build auth login
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Mar 6, 2024
1 parent 0e52d41 commit d06acaa
Show file tree
Hide file tree
Showing 14 changed files with 3,567 additions and 65 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
ignorePatterns: ['dist/**/*', 'build/**/*'],
extends: ['standard', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: '2020'
},
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'import/order': 'error',
'no-use-before-define': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'n/no-callback-literal': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/no-use-before-define': 'error',
'prettier/prettier': [
'error',
{
tabWidth: 2,
printWidth: 120,
singleQuote: true,
trailingComma: 'none',
semi: false
}
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
99 changes: 99 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.2
uses: prefix-dev/rattler-build-action@v0.3.0
```
> [!WARNING]
> Since rattler-build is still experimental and the API can change in minor versions, please pin this action to its minor version, i.e., `prefix-dev/rattler-build-action@v0.2.2`.
> Since rattler-build is still experimental and the API can change in minor versions, please pin this action to its minor version, i.e., `prefix-dev/rattler-build-action@v0.3.0`.

> [!TIP]
> You can use dependabot to automatically update the version of `rattler-build-action`. Add the following to your `.github/dependabot.yml`:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.2
uses: prefix-dev/rattler-build-action@v0.3.0
with:
# needs to be unique for each matrix entry
artifact-name: package-${{ matrix.target-platform }}
Expand All @@ -117,7 +117,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.2
uses: prefix-dev/rattler-build-action@v0.3.0
- run: |
for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
echo "Uploading ${pkg}"
Expand All @@ -139,7 +139,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.2
uses: prefix-dev/rattler-build-action@v0.3.0
- run: |
for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
echo "Uploading ${pkg}"
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
echo '{"my.quetz.server": {"CondaToken": "${{ secrets.QUETZ_API_KEY }}"}}' > "$RATTLER_AUTH_FILE"
echo "RATTLER_AUTH_FILE=$RATTLER_AUTH_FILE" >> "$GITHUB_ENV"
- name: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.2
uses: prefix-dev/rattler-build-action@v0.3.0
with:
build-args: -c conda-forge -c https://my.quetz.server/get/my-channel
```
121 changes: 63 additions & 58 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,67 @@ inputs:
description: arguments to pass to rattler-build
required: false
default: ''
# runs:
# using: composite
# steps:
# - name: Generate rattler-build URL
# shell: bash
# id: url
# run: |
# arch=$(uname -m)
# if [ "$arch" = "arm64" ]; then
# arch="aarch64"
# fi
# platform=${{ runner.os == 'macOS' && 'apple-darwin' || '' }}${{ runner.os == 'Linux' && 'unknown-linux-musl' || '' }}${{ runner.os == 'Windows' && 'pc-windows-msvc' || '' }}
# if [ ${{ inputs.rattler-build-version }} = "latest" ]; then
# url="https://github.com/prefix-dev/rattler-build/releases/latest/download/rattler-build-$arch-$platform${{ runner.os == 'Windows' && '.exe' || '' }}"
# else
# url="https://github.com/prefix-dev/rattler-build/releases/download/${{ inputs.rattler-build-version }}/rattler-build-$arch-$platform${{ runner.os == 'Windows' && '.exe' || '' }}"
# fi
# echo "url=$url" >> $GITHUB_OUTPUT
# - name: Install rattler-build (Unix)
# shell: bash
# if: ${{ runner.os != 'Windows' }}
# run: |
# mkdir -p ${{ runner.temp }}/rattler-build
# curl -Ls \
# ${{ steps.url.outputs.url }} \
# -o ${{ runner.temp }}/rattler-build/rattler-build
# chmod +x ${{ runner.temp }}/rattler-build/rattler-build
# echo ${{ runner.temp }}/rattler-build >> $GITHUB_PATH
# - name: Install rattler-build (Windows)
# shell: powershell
# if: ${{ runner.os == 'Windows' }}
# run: |
# New-Item -ItemType Directory -Path "${{ runner.temp }}\rattler-build" -Force
# Invoke-WebRequest -Uri "${{ steps.url.outputs.url }}" -OutFile "${{ runner.temp }}\rattler-build\rattler-build.exe"
# Add-Content -Path $env:GITHUB_PATH -Value "${{ runner.temp }}\rattler-build"
# - name: Build conda package (non-Windows)
# shell: bash
# if: ${{ runner.os != 'Windows' }}
# run: |
# rattler-build build --recipe "${{ inputs.recipe-path }}" ${{ inputs.build-args }}
# env:
# RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true'
# RATTLER_BUILD_COLOR: 'always'
# - name: Build conda package (Windows)
# shell: powershell
# if: ${{ runner.os == 'Windows' }}
# run: |
# rattler-build build --recipe "${{ inputs.recipe-path }}" ${{ inputs.build-args }}
# env:
# RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true'
# RATTLER_BUILD_COLOR: 'always'
# - name: Upload build artifacts
# uses: actions/upload-artifact@v4
# if: ${{ inputs.upload-artifact == 'true' }}
# with:
# name: ${{ inputs.artifact-name }}
# path: |
# output/**/*.tar.bz2
# output/**/*.conda

runs:
using: composite
steps:
- name: Generate rattler-build URL
shell: bash
id: url
run: |
arch=$(uname -m)
if [ "$arch" = "arm64" ]; then
arch="aarch64"
fi
platform=${{ runner.os == 'macOS' && 'apple-darwin' || '' }}${{ runner.os == 'Linux' && 'unknown-linux-musl' || '' }}${{ runner.os == 'Windows' && 'pc-windows-msvc' || '' }}
if [ ${{ inputs.rattler-build-version }} = "latest" ]; then
url="https://github.com/prefix-dev/rattler-build/releases/latest/download/rattler-build-$arch-$platform${{ runner.os == 'Windows' && '.exe' || '' }}"
else
url="https://github.com/prefix-dev/rattler-build/releases/download/${{ inputs.rattler-build-version }}/rattler-build-$arch-$platform${{ runner.os == 'Windows' && '.exe' || '' }}"
fi
echo "url=$url" >> $GITHUB_OUTPUT
- name: Install rattler-build (Unix)
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
mkdir -p ${{ runner.temp }}/rattler-build
curl -Ls \
${{ steps.url.outputs.url }} \
-o ${{ runner.temp }}/rattler-build/rattler-build
chmod +x ${{ runner.temp }}/rattler-build/rattler-build
echo ${{ runner.temp }}/rattler-build >> $GITHUB_PATH
- name: Install rattler-build (Windows)
shell: powershell
if: ${{ runner.os == 'Windows' }}
run: |
New-Item -ItemType Directory -Path "${{ runner.temp }}\rattler-build" -Force
Invoke-WebRequest -Uri "${{ steps.url.outputs.url }}" -OutFile "${{ runner.temp }}\rattler-build\rattler-build.exe"
Add-Content -Path $env:GITHUB_PATH -Value "${{ runner.temp }}\rattler-build"
- name: Build conda package (non-Windows)
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
rattler-build build --recipe "${{ inputs.recipe-path }}" ${{ inputs.build-args }}
env:
RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true'
RATTLER_BUILD_COLOR: 'always'
- name: Build conda package (Windows)
shell: powershell
if: ${{ runner.os == 'Windows' }}
run: |
rattler-build build --recipe "${{ inputs.recipe-path }}" ${{ inputs.build-args }}
env:
RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true'
RATTLER_BUILD_COLOR: 'always'
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.upload-artifact == 'true' }}
with:
name: ${{ inputs.artifact-name }}
path: |
output/**/*.tar.bz2
output/**/*.conda
using: node20
main: dist/index.js
post: dist/post.js
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "rattler-build-action",
"version": "0.3.0",
"private": true,
"description": "GitHub Action to build rattler-build packages.",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"lint": "eslint ./src --ext ts",
"lint:fix": "eslint ./src --ext ts --fix"
},
"repository": {
"type": "git",
"url": "git+https://github.com/prefix-dev/rattler-build-action.git"
},
"keywords": [
"rattler-build",
"github-actions",
"conda"
],
"author": "Pavel Zwerschke <[email protected]>",
"license": "BSD-3-Clause",
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"untildify": "^5.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit d06acaa

Please sign in to comment.