Commit 0138a552 authored by suyanlong's avatar suyanlong

init file

parent 7afd92b9
name: Codecov
on:
push:
branches: [ master ]
pull_request:
jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-java@v10
with:
java-version: 11
- run: sbt clean coverage test coverageReport && sbt coverageAggregate
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
name: codecov-alephium
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
name: Build and publish docker image
on:
workflow_run:
workflows: ["Release"]
types:
- completed
jobs:
buildx_and_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Get the version
id: get_version
run: |
version=$(git describe --tags --abbrev=0)
echo $version
echo ${version:1}
echo ::set-output name=VERSION::$version
echo ::set-output name=VERSION-NO-V::${version:1}
shell: bash
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and publish docker image
uses: docker/build-push-action@v2
with:
context: docker/release
file: ./docker/release/Dockerfile.release
build-args: RELEASE=${{ steps.get_version.outputs.VERSION-NO-V }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
docker.io/alephium/alephium:${{ steps.get_version.outputs.VERSION }}
docker.io/alephium/alephium:latest
push: true
name: Publish Docker image
on:
push:
branches: [ master ]
tags: [ "v[0-9]+.[0-9]+.[0-9]+*" ]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: olafurpg/setup-scala@v10
with:
java-version: 11
- run: sbt app/docker app/dockerPush
shell: bash
name: Integration-Test
on:
push:
branches: [ master ]
pull_request:
jobs:
itest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
java: [ '1.8', '11' ]
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- run: sbt it:test
shell: bash
name: Publish
on:
push:
tags: [ "v[0-9]+.[0-9]+.[0-9]+*" ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: olafurpg/setup-gpg@v3
- name: Publish To Sonatype
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
name: Release
on:
push:
tags: [ "v[0-9]+.[0-9]+.[0-9]+*" ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-java@v1
with:
java-version: 8
- name: Get the version
id: get_version
run: |
version=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-)
echo ::set-output name=VERSION::$version
shell: bash
- run: make assembly
- name: Generate checksums (Release prep)
run: |
cd app/target/scala-2.13/
sha256sum "alephium-${{ steps.get_version.outputs.VERSION }}.jar" > "alephium-${{ steps.get_version.outputs.VERSION }}.jar.checksum"
cd ../../../wallet/target/scala-2.13/
sha256sum "alephium-wallet-${{ steps.get_version.outputs.VERSION }}.jar" > "alephium-wallet-${{ steps.get_version.outputs.VERSION }}.jar.checksum"
cd ../../../
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
app/target/scala-2.13/alephium-${{ steps.get_version.outputs.VERSION }}.jar
app/target/scala-2.13/alephium-${{ steps.get_version.outputs.VERSION }}.jar.checksum
wallet/target/scala-2.13/alephium-wallet-${{ steps.get_version.outputs.VERSION }}.jar
wallet/target/scala-2.13/alephium-wallet-${{ steps.get_version.outputs.VERSION }}.jar.checksum
name: Styling
on:
push:
branches: [ master ]
pull_request:
jobs:
styling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-java@v10
with:
java-version: 11
- run: sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck it:scalafmtCheck scalastyle test:scalastyle it:scalastyle doc
- run: make assembly
name: Unit-Test
on:
push:
branches: [ master ]
pull_request:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
java: [ '1.8', '11' ]
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- run: sbt test
shell: bash
target/
log
.idea
version = 2.7.5
project.git = true
align.preset = more
rewrite.rules = [RedundantParens, PreferCurlyFors, SortModifiers]
maxColumn = 100
# Contributing to luju-chain33
As an open source project, everyone is invited to contribute to Luyu-chain33.
Nevertheless, following Luyu-chain33's good practices regarding coding, styling, git committing etc
will give you higher chance to get reviewed and merged.
## Getting Started
Fork the project, apply your changes in your feature branch and be sure to run:
```
make test-all
```
Before opening your PR (Pull Request), otherwise the CI (Continuous Integration) will probably fail.
Code review can be long and complex, please follow the few rules below to ease everyone's work.
## Git good practices
Small commits are easier to review and should be [atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) as much
as possible.
A good commit message and description helps a lot the reviewers, have a look at
the famous [seven rules of a great Git commit message](https://chris.beams.io/posts/git-commit/#seven-rules)
Ideally each individual commit should work on its own (i.e.`make test-all` should pass)
## Pull Request creation
As the commit messages, a good PR description will ease the reviewing work.
Try to explain the:
- Why
- What
- How
## Pull Request review
During the review it's important to never rebase, squash, force push or more generally apply any action that can change commits' hash or history.
Review is done commit per commit, if one hash changed the all review needs to be redone, to prevent malicious code to be added to approved commits.
In case one of those actions is required, the maintainers will ask for it and the result must be easy to review with the `git range-diff` tool.
Please address PR's comments in some fix commits, respecting all the previous rules.
## Merging Pull Request
The PR can be merged by the maintainers once all the following criteria are reached:
- No conflicts
- CI passes
- 2 approvals
import Dependencies._
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
lazy val root = (project in file("."))
.settings(
name := "luju-chain33",
libraryDependencies += scalaTest % Test
)
// Uncomment the following for publishing to Sonatype.
// See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for more detail.
// ThisBuild / description := "Some descripiton about your project."
// ThisBuild / licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
// ThisBuild / homepage := Some(url("https://github.com/example/project"))
// ThisBuild / scmInfo := Some(
// ScmInfo(
// url("https://github.com/your-account/your-project"),
// "scm:git@github.com:your-account/your-project.git"
// )
// )
// ThisBuild / developers := List(
// Developer(
// id = "Your identifier",
// name = "Your Name",
// email = "your@email",
// url = url("http://your.url")
// )
// )
// ThisBuild / pomIncludeRepository := { _ => false }
// ThisBuild / publishTo := {
// val nexus = "https://oss.sonatype.org/"
// if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
// else Some("releases" at nexus + "service/local/staging/deploy/maven2")
// }
// ThisBuild / publishMavenStyle := true
import sbt._
object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.5"
}
package example
object Hello extends Greeting with App {
println(greeting)
}
trait Greeting {
lazy val greeting: String = "hello"
}
package example
import org.scalatest._
class HelloSpec extends FlatSpec with Matchers {
"The Hello object" should "say hello" in {
Hello.greeting shouldEqual "hello"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment