Skip to content

Commit 735866a

Browse files
committed
Apply new CI publishing
1 parent e546749 commit 735866a

File tree

4 files changed

+98
-61
lines changed

4 files changed

+98
-61
lines changed

.circleci/config.yml

Lines changed: 87 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@ references:
1818
- image: codacy/ci-aws:3.0.2
1919
working_directory: ~/workdir/.aws
2020

21-
setup_aws_credentials: &setup_aws_credentials
22-
run:
23-
name: Setup AWS Credentials
24-
command: |
25-
mkdir -p ~/.aws && touch ~/.aws/credentials
26-
cat >> ~/.aws/credentials << EOF
27-
[default]
28-
aws_access_key_id=$ACCESS_KEY_ID
29-
aws_secret_access_key=$SECRET_ACCESS_KEY
30-
[integration]
31-
source_profile = default
32-
role_arn = arn:aws:iam::$AWS_ACCOUNT_ID_INTEGRATION:role/$CONTINUOUS_DELIVERY_ROLE
33-
region=eu-west-1
34-
3521
restore_sbt_cache: &restore_sbt_cache
3622
restore_cache:
3723
keys:
@@ -56,21 +42,102 @@ references:
5642
- "~/.m2"
5743

5844
jobs:
59-
test:
45+
checkout_and_version:
46+
docker:
47+
- image: codacy/git-version:latest
48+
working_directory: ~/workdir
49+
steps:
50+
- checkout
51+
- run:
52+
name: Set version
53+
command: /bin/git-version > .version
54+
- run:
55+
name: Set Sbt version
56+
command: echo "version in ThisBuild := \"$(cat .version)\"" > version.sbt
57+
- run:
58+
name: Current version
59+
command: cat .version
60+
- persist_to_workspace:
61+
root: ~/
62+
paths:
63+
- workdir/*
64+
65+
populate_cache:
66+
<<: *default_sbt_job
67+
steps:
68+
- attach_workspace:
69+
at: ~/
70+
- *restore_sbt_cache
71+
- run:
72+
name: Safely populate caches
73+
command: sbt ";set scalafmtUseIvy in ThisBuild := false;update"
74+
- *clean_sbt_cache
75+
- *save_sbt_cache
76+
77+
compile_and_test:
6078
<<: *default_sbt_job
6179
steps:
6280
- attach_workspace:
6381
at: ~/
6482
- *restore_sbt_cache
6583
- run:
66-
name: Test
67-
command: |
68-
sbt +test
84+
name: Compile / Test and send coverage results
85+
command: sbt ";compile;test:compile;coverage;test;coverageReport;coverageAggregate;codacyCoverage"
86+
- *clean_sbt_cache
87+
- *save_sbt_cache
88+
89+
tag_version:
90+
<<: *default_sbt_job
91+
steps:
92+
- attach_workspace:
93+
at: ~/
94+
- add_ssh_keys:
95+
fingerprints:
96+
- "df:83:d7:c7:d5:79:06:c2:3b:d1:fd:e2:a3:d1:12:c5"
97+
- run:
98+
name: Tag
99+
command: git tag $(cat .version) && git push --tags
100+
101+
publish:
102+
<<: *default_sbt_job
103+
steps:
104+
- attach_workspace:
105+
at: ~/
106+
- *restore_sbt_cache
107+
- run:
108+
name: Publish to sonatype
109+
command: sbt ";clean;retrieveGPGKeys;+publishSigned;sonatypeReleaseAll"
69110

70111
workflows:
71112
version: 2
72113
compile_deploy:
73114
jobs:
74-
- test:
115+
- checkout_and_version
116+
- populate_cache:
117+
requires:
118+
- checkout_and_version
119+
- checkfmt:
120+
requires:
121+
- populate_cache
122+
- compile_and_test:
123+
requires:
124+
- populate_cache
125+
- publish:
126+
filters:
127+
branches:
128+
only:
129+
- master
130+
- newCI
131+
context: CodacyAWS
132+
requires:
133+
- compile_and_test
134+
- checkfmt
135+
- tag_version:
136+
filters:
137+
branches:
138+
only:
139+
- master
140+
- newCI
75141
context: CodacyAWS
76-
requires:
142+
requires:
143+
- publish

build.sbt

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import Dependencies._
1+
import codacy.libs._
22

33
import scala.io.Source
44
import scala.util.parsing.json.JSON
55

66
name := """bitbucket-scala-client"""
77

8-
version := "1.9.0-SNAPSHOT"
9-
108
scalaVersion := "2.11.12"
119

1210
scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-Ywarn-adapted-args", "-Xlint")
1311

1412
resolvers += "Typesafe maven repository" at "http://repo.typesafe.com/typesafe/maven-releases/"
1513

1614
libraryDependencies ++= Seq(
17-
Dependencies.playWS,
18-
Dependencies.playJson,
19-
Dependencies.scalaTest
15+
playWs,
16+
playJson,
17+
scalatest % Test
2018
)
2119

2220
mimaPreviousArtifacts := {
@@ -32,33 +30,14 @@ val ignoredABIProblems = {
3230
Seq()
3331
}
3432

35-
organization := "com.codacy"
36-
3733
organizationName := "Codacy"
3834

3935
organizationHomepage := Some(new URL("https://www.codacy.com"))
4036

41-
publishMavenStyle := true
42-
43-
publishArtifact in Test := false
44-
45-
pomIncludeRepository := { _ => false }
46-
47-
publishTo := sonatypePublishTo.value
48-
49-
//Credentials for sonatype
50-
credentials += Credentials(
51-
"Sonatype Nexus Repository Manager",
52-
"oss.sonatype.org",
53-
sys.env.getOrElse("SONATYPE_USER", "username"),
54-
sys.env.getOrElse("SONATYPE_PASSWORD", "password"))
55-
5637
startYear := Some(2014)
5738

5839
description := "Bitbucket Scala Client"
5940

60-
licenses := Seq("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
61-
6241
homepage := Some(url("https://github.com/codacy/bitbucket-scala-client.git"))
6342

6443
pomExtra :=
@@ -75,3 +54,7 @@ pomExtra :=
7554
<url>https://github.com/rtfpessoa</url>
7655
</developer>
7756
</developers>
57+
58+
resolvers ~= { _.filterNot(_.name.toLowerCase.contains("codacy")) }
59+
60+
publicMvnPublish

project/Dependencies.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

project/plugins.sbt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import sbt._
1+
resolvers += Resolver.jcenterRepo
22

3-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
3+
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0")
44

5-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
6-
7-
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0")
5+
addSbtPlugin("com.codacy" % "codacy-sbt-plugin" % "13.0.2")

0 commit comments

Comments
 (0)