Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
holzensp authored and The Pkl Team (automation) committed Feb 2, 2024
0 parents commit 83ba10b
Show file tree
Hide file tree
Showing 24 changed files with 2,190 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .circleci/config.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
amends "../packages/pkl.impl.circleci/PklCI.pkl"

jobs {
["build"] {
docker {
new { image = "cimg/openjdk:17.0" }
}
steps {
"checkout"
new RunStep {
name = "Build"
command = "./gradlew build"
environment {}
}
new StoreTestResults { path = "build/test-results" }
new PersistToWorkspaceStep {
root = "."
paths {
"build"
}
}
}
}
["release"] {
docker {
new { image = "maniator/gh:v2.40.1" }
}
steps {
"checkout" // for `git tag` querying
new AttachWorkspaceStep { at = "." }
new RunStep {
name = "Publish release on GitHub"
// language=bash
command = #"""
if [[ -d build/releases && -n "$(ls -A build/releases)" ]]
then
REPO="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
for dir in build/releases/*
do
if [[ -d "$dir" ]]
then
pkg=$(basename "$dir")
if gh release view "$pkg" ; then
echo "Package $pkg already published"
else
# TODO we can be kinder to GitHub by querying once for all releases.
echo -n "> Releasing $pkg at SHA1 ${CIRCLE_SHA1}..."
gh release create "$pkg" \
--title "$pkg" \
--target "${CIRCLE_SHA1}" \
--repo "$REPO" \
--notes "Release of $pkg" \
"$dir"/*
echo "DONE"
fi
else
echo "> SKIPPING $dir; not a directory"
fi
done
else
echo "No new packages to release."
fi
"""#
}
}
}
}

prb {
jobs {
"build"
}
}

main {
jobs {
"build"
new {
["release"] {
requires {
"build"
}
context {
"pkl-github-release"
}
}
}
}
}
85 changes: 85 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Generated from CircleCI.pkl. DO NOT EDIT.
version: '2.1'
orbs:
pr-approval: apple/pr-approval@0.1.0
jobs:
build:
steps:
- checkout
- run:
command: ./gradlew build
name: Build
environment: {}
- store_test_results:
path: build/test-results
- persist_to_workspace:
root: '.'
paths:
- build
docker:
- image: cimg/openjdk:17.0
release:
steps:
- checkout
- attach_workspace:
at: '.'
- run:
command: |-
if [[ -d build/releases && -n "$(ls -A build/releases)" ]]
then
REPO="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
for dir in build/releases/*
do
if [[ -d "$dir" ]]
then
pkg=$(basename "$dir")
if gh release view "$pkg" ; then
echo "Package $pkg already published"
else
# TODO we can be kinder to GitHub by querying once for all releases.
echo -n "> Releasing $pkg at SHA1 ${CIRCLE_SHA1}..."
gh release create "$pkg" \
--title "$pkg" \
--target "${CIRCLE_SHA1}" \
--repo "$REPO" \
--notes "Release of $pkg" \
"$dir"/*
echo "DONE"
fi
else
echo "> SKIPPING $dir; not a directory"
fi
done
else
echo "No new packages to release."
fi
name: Publish release on GitHub
docker:
- image: maniator/gh:v2.40.1
workflows:
prb:
jobs:
- hold:
type: approval
- pr-approval/authenticate:
context: pkl-pr-approval
- build:
requires:
- hold
- pr-approval/authenticate
when:
matches:
value: << pipeline.git.branch >>
pattern: ^pull/\d+(/head)?$
main:
jobs:
- build
- release:
requires:
- build
context:
- pkl-github-release
when:
equal:
- main
- << pipeline.git.branch >>
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
78 changes: 78 additions & 0 deletions CODE_OF_CONDUCT.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
== Code of Conduct

=== Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, sex
characteristics, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

=== Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual
attention or advances
* Trolling, insulting/derogatory comments, and personal or political
attacks
* Public or private harassment
* Publishing others’ private information, such as a physical or
electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

=== Our Responsibilities

Project maintainers are responsible for clarifying the standards of
acceptable behavior and are expected to take appropriate and fair
corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, or to ban
temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.

=== Scope

This Code of Conduct applies within all project spaces, and it also
applies when an individual is representing the project or its community
in public spaces. Examples of representing a project or community
include using an official project e-mail address, posting via an
official social media account, or acting as an appointed representative
at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

=== Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the open source team at
opensource-conduct@group.apple.com. All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to
maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in
good faith may face temporary or permanent repercussions as determined
by other members of the project’s leadership.

=== Attribution

This Code of Conduct is adapted from the
https://www.contributor-covenant.org[Contributor Covenant], version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44 changes: 44 additions & 0 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
:uri-github-issue-pkl: https://github.com/apple/pkl-pantry/issues/new
:uri-seven-rules: https://cbea.ms/git-commit/#seven-rules

= Pkl Project Commons Contributors Guide

Welcome to the Pkl Project Commons community, and thank you for contributing!
This guide explains how to get involved.

* <<Licensing>>
* <<Issue Tracking>>
* <<Pull Requests>>

== Licensing

Pkl Project Commons is released under the Apache 2.0 license.
This is why we require that, by submitting a pull request, you acknowledge that you have the right to license your contribution to Apple and the community, and agree that your contribution is licensed under the Apache 2.0 license.

== Issue Tracking

To file a bug or feature request, use {uri-github-issue-pkl}[GitHub].
Be sure to include the following information:

* Context
** What are/were you trying to achieve?
** What's the impact of this bug/feature?

== Pull Requests

When preparing a pull request, follow this checklist:

* Imitate the conventions of surrounding code.
* Format `.pkl` files in your PR with the JetBrains IDE formatter.
* Follow the {uri-seven-rules}[seven rules] of great Git commit messages:
** Separate subject from body with a blank line.
** Limit the subject line to 50 characters.
** Capitalize the subject line.
** Do not end the subject line with a period.
** Use the imperative mood in the subject line.
** Wrap the body at 72 characters.
** Use the body to explain what and why vs. how.

== Maintainers

The project’s maintainers (those with write access to the upstream repository) are listed in link:MAINTAINERS.adoc[].
Loading

0 comments on commit 83ba10b

Please sign in to comment.