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

Migrate to nodejs action, add rattler-build auth login #13

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4
- name: Check rattler-build-action version mentions
run: |
project_version="$(yq '.version' project.toml)"
project_version="$(jq -r '.version' package.json)"
count_expected=6
count_actual="$(grep -c "prefix-dev/rattler-build-action@v${project_version}" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
Expand Down
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
1 change: 1 addition & 0 deletions dist/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading