Skip to content

Commit

Permalink
chore(ci): adds release process to circleci
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Sep 14, 2021
1 parent f4eb571 commit 094e007
Show file tree
Hide file tree
Showing 16 changed files with 596 additions and 52 deletions.
118 changes: 108 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ orbs:
gh: circleci/[email protected]
node: circleci/[email protected]

# These filters are used in all of the jobs for our release workflow
release_tags_only: &release_tags_only
filters:
branches:
ignore: /.*/
tags:
only : /v.*/

# You can replace the *release_tags_only with *test_release_branch_only when testing,
# just make sure to update the branch name to the one you're testing on so they run.
# You can bypass the tests if you don't update those steps.
test_release_branch_only: &test_release_branch_only
filters:
branches:
only: /avery/test-release-process/
tags:
ignore: /.*/

# The main workflows executed for Rover
workflows:
lint:
Expand All @@ -17,6 +35,10 @@ workflows:
platform: [ubuntu]
rust_channel: [stable]
command: [lint]
pre-steps:
- node/install:
node-version: "14.17.1"
npm-version: "7.21.1"
test:
jobs:
- xtask:
Expand All @@ -34,6 +56,54 @@ workflows:
platform: [ubuntu]
rust_channel: [stable]
command: [test]
release:
jobs:
- xtask:
name: Run cargo tests (<< matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [unit-test]
<<: *test_release_branch_only

- xtask:
name: Run supergraph-demo tests
matrix:
parameters:
platform: [ubuntu]
rust_channel: [stable]
command: [integration-test]
<<: *test_release_branch_only

- xtask:
name: Build release binaries (<< matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [dist]
requires: ["Run cargo tests (<< matrix.platform >>)", "Run supergraph-demo tests"]
<<: *test_release_branch_only

- xtask:
name: Bundle release artifacts (<< matrix.platform >>)
matrix:
parameters:
platform: [centos, musl, macos, windows]
rust_channel: [stable]
command: [package]
requires: ["Build release binaries (<< matrix.platform >>)"]
<<: *test_release_branch_only

- publish_github_draft_release:
name: Publish GitHub draft release
requires:
- "Bundle release artifacts (centos)"
- "Bundle release artifacts (musl)"
- "Bundle release artifacts (macos)"
- "Bundle release artifacts (windows)"
<<: *test_release_branch_only

jobs:
xtask:
Expand All @@ -46,7 +116,7 @@ jobs:
type: executor
command:
type: enum
enum: ["lint", "unit-test", "integration-test", "test", "dist"]
enum: [lint, unit-test, integration-test, test, dist, package]
executor: << parameters.platform >>
steps:
- checkout
Expand All @@ -57,6 +127,31 @@ jobs:
platform: << parameters.platform >>
command: << parameters.command >>

publish_github_draft_release:
docker:
- image: cimg/base:node
resource_class: small
environment:
VERSION: << pipeline.git.tag >>
steps:
- checkout
- attach_workspace:
at: artifacts
- gh/setup
- run:
command: >
cd artifacts && sha256sum *.tar.gz > sha256sums.txt
- run:
command: >
cd artifacts && md5sum *.tar.gz > md5sums.txt
- run:
command: >
cd artifacts && sha1sum *.tar.gz > sha1sums.txt
- run:
command: >
gh release create $VERSION --draft --target << pipeline.git.revision >> --notes "" --title $VERSION artifacts/*
# The machines we use to run our workflows on
executors:
centos: &centos_executor
Expand Down Expand Up @@ -147,14 +242,7 @@ commands:
- run:
name: Install musl-tools
command: sudo apt-get install -y musl-tools
- when:
condition:
or:
- equal: [ *ubuntu_executor, << parameters.platform >> ]
steps:
- node/install:
node-version: "14.17.1"
npm-version: "7.21.1"

- when:
condition:
equal: [ *macos_executor, << parameters.platform >> ]
Expand All @@ -165,6 +253,7 @@ commands:
- run:
name: Install p7zip
command: brew install p7zip

- install_rust_toolchain:
rust_channel: << parameters.rust_channel >>
platform: << parameters.platform >>
Expand Down Expand Up @@ -215,7 +304,7 @@ commands:
parameters:
command:
type: enum
enum: [lint, integration-test, unit-test, "test", "dist"]
enum: [lint, integration-test, unit-test, test, dist, package]
platform:
type: executor
steps:
Expand All @@ -242,4 +331,13 @@ commands:
key: rust-target-v1-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
paths:
- target/

- when:
condition:
equal: [ package, << parameters.command >> ]
steps:
- persist_to_workspace:
root: artifacts
paths:
- "*"

53 changes: 53 additions & 0 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ assert_fs = "1"
anyhow = "1"
camino = "1.0"
cargo_metadata = "0.14"
flate2 = "1"
lazy_static = "1.4"
regex = "1"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "native-tls"]}
semver = "1"
serde_json_traversal = "0.2"
structopt = { version = "0.3", default-features = false }
which = "4.1"
tar = "0.4"
which = "4.1"
zip = { version = "0.5", default-features = false }
6 changes: 1 addition & 5 deletions xtask/src/commands/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use structopt::StructOpt;

use crate::target::{Target, TARGET_GNU_LINUX};
use crate::tools::{CargoRunner, GitRunner, MakeRunner};
use crate::utils;

#[derive(Debug, StructOpt)]
pub struct IntegrationTest {
Expand All @@ -26,10 +25,7 @@ impl IntegrationTest {
let repo_path = git_runner.clone_supergraph_demo()?;
make_runner.test_supergraph_demo(&repo_path)?;
} else {
utils::info(&format!(
"skipping integration tests for --target {}",
&self.target
));
crate::info!("skipping integration tests for --target {}", &self.target);
}

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub(crate) mod dist;
pub(crate) mod integration_test;
pub(crate) mod lint;
pub(crate) mod package;
pub(crate) mod prep;
pub(crate) mod test;
pub(crate) mod unit_test;
Expand All @@ -9,6 +10,7 @@ pub(crate) mod version;
pub(crate) use dist::Dist;
pub(crate) use integration_test::IntegrationTest;
pub(crate) use lint::Lint;
pub(crate) use package::Package;
pub(crate) use prep::Prep;
pub(crate) use test::Test;
pub(crate) use unit_test::UnitTest;
Loading

0 comments on commit 094e007

Please sign in to comment.