Skip to content

Commit

Permalink
Migrate from CircleCI to GHA (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax authored Nov 10, 2022
1 parent 1d9b75e commit 64318b7
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 210 deletions.
150 changes: 0 additions & 150 deletions .circleci/config.yml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy --all-targets --locked -- --deny warnings
- name: rustfmt
run: cargo fmt -- --check

unit-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run unit tests
run: cargo test --locked

libcnb-test:
name: Cargo integration tests (${{ matrix.integration-test-cnb-builder }})
runs-on: ubuntu-22.04
strategy:
matrix:
integration-test-cnb-builder: [ "heroku/buildpacks:20", "heroku/builder:22" ]
env:
INTEGRATION_TEST_CNB_BUILDER: ${{ matrix.integration-test-cnb-builder }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install musl-tools
run: sudo apt-get install musl-tools --no-install-recommends
- name: Update Rust toolchain
run: rustup update
- name: Install Rust linux-musl target
run: rustup target add x86_64-unknown-linux-musl
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install Pack CLI
uses: buildpacks/github-actions/[email protected]
- name: Run integration tests
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests).
run: cargo test --locked -- --ignored

cutlass-test:
name: Cutlass (${{ matrix.spec-dir }} on ${{ matrix.integration-test-cnb-builder }})
runs-on: ubuntu-22.04
strategy:
matrix:
integration-test-cnb-builder: ["heroku/buildpacks:20", "heroku/builder:22"]
spec-dir: ["test/specs/java", "test/specs/java-function"]
env:
INTEGRATION_TEST_CNB_BUILDER: ${{ matrix.integration-test-cnb-builder }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install musl-tools
run: sudo apt-get install musl-tools --no-install-recommends
- name: Update Rust toolchain
run: rustup update
- name: Install Rust linux-musl target
run: rustup target add x86_64-unknown-linux-musl
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install libcnb-cargo
run: cargo install libcnb-cargo
- name: Install Pack CLI
uses: buildpacks/github-actions/[email protected]
- name: Install Ruby and dependencies
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "2.7"
- name: Run integration tests
run: bundle exec rspec ${{ matrix.spec-dir }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Heroku Cloud Native JVM Buildpacks
[![CircleCI](https://circleci.com/gh/heroku/buildpacks-jvm/tree/main.svg?style=shield)](https://circleci.com/gh/heroku/buildpacks-jvm/tree/main)
[![CI](https://github.com/heroku/buildpacks-jvm/actions/workflows/ci.yml/badge.svg)](https://github.com/heroku/buildpacks-jvm/actions/workflows/ci.yml)

Heroku's official [Cloud Native Buildpacks](https://buildpacks.io) for the JVM ecosystem.

Expand Down
2 changes: 1 addition & 1 deletion buildpacks/jvm-function-invoker/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::Path;
use toml::Value;

pub fn project_toml_salesforce_type_is_function(project_toml_path: &Path) -> bool {
read_toml_file(&project_toml_path)
read_toml_file(project_toml_path)
.ok()
.and_then(|table: Value| {
toml_select_value(vec!["com", "salesforce", "type"], &table)
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/jvm-function-invoker/src/layers/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Layer for BundleLayer {

match exit_status.code() {
Some(0) => {
log_function_metadata(&layer_path)?;
log_function_metadata(layer_path)?;
LayerResultBuilder::new(GenericMetadata::default())
.env(LayerEnv::new().chainable_insert(
Scope::All,
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/jvm-function-invoker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Buildpack for JvmFunctionInvokerBuildpack {
}

fn on_error(&self, error: libcnb::Error<Self::Error>) {
on_error(handle_buildpack_error, error)
on_error(handle_buildpack_error, error);
}
}

Expand Down
5 changes: 3 additions & 2 deletions buildpacks/jvm/src/bin/heroku_database_env_var_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use libcnb::exec_d::write_exec_d_program_output;
use std::collections::HashMap;
use url::Url;

#[allow(clippy::missing_panics_doc)]
pub fn main() {
write_exec_d_program_output(
jvm_env_vars_for_env(&std::env::vars().collect())
Expand Down Expand Up @@ -352,7 +353,7 @@ mod test {
String::from("postgres://pooluser:[email protected]:5432/testdb"),
)]));

assert_eq!(result, HashMap::new())
assert_eq!(result, HashMap::new());
}

#[test]
Expand Down Expand Up @@ -466,7 +467,7 @@ mod test {
String::from("postgres://test123@ec2-52-13-12"),
)]));

assert_eq!(result, HashMap::new())
assert_eq!(result, HashMap::new());
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions buildpacks/jvm/src/layers/openjdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Layer for OpenJdkLayer {
std::fs::File::open(&path)
.map_err(OpenJdkBuildpackError::CannotOpenOpenJdkTarball)
.and_then(|mut file| {
libherokubuildpack::tar::decompress_tarball(&mut file, &layer_path)
libherokubuildpack::tar::decompress_tarball(&mut file, layer_path)
.map_err(OpenJdkBuildpackError::CannotDecompressOpenJdkTarball)
})?;

Expand All @@ -68,11 +68,11 @@ impl Layer for OpenJdkLayer {

let symlink_ubuntu_java_cacerts_file = ubuntu_java_cacerts_file_path.is_file()
&& !app_jdk_overlay_dir_path
.join(&relative_jdk_cacerts_path)
.join(relative_jdk_cacerts_path)
.exists();

if symlink_ubuntu_java_cacerts_file {
let absolute_jdk_cacerts_path = layer_path.join(&relative_jdk_cacerts_path);
let absolute_jdk_cacerts_path = layer_path.join(relative_jdk_cacerts_path);

fs::rename(
&absolute_jdk_cacerts_path,
Expand All @@ -95,7 +95,7 @@ impl Layer for OpenJdkLayer {

fs_extra::copy_items(
&jdk_overlay_contents,
&layer_path,
layer_path,
&CopyOptions {
overwrite: true,
skip_exist: false,
Expand All @@ -116,7 +116,7 @@ impl Layer for OpenJdkLayer {
Scope::All,
ModificationBehavior::Override,
"JAVA_HOME",
&layer_path,
layer_path,
)
.chainable_insert(
Scope::All,
Expand Down
18 changes: 9 additions & 9 deletions buildpacks/jvm/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ pub fn normalize_version_string<S: Into<String>>(
) -> Result<(OpenJDKDistribution, String), NormalizeVersionStringError> {
let user_version_string = user_version_string.into();

let (user_distribution_string, user_version_string) = user_version_string
.trim()
.split_once("-")
.map(|(split_distribution_string, split_version_string)| {
(Some(split_distribution_string), split_version_string)
})
.unwrap_or((None, &user_version_string));
let (user_distribution_string, user_version_string) =
user_version_string.trim().split_once('-').map_or(
(None, user_version_string.as_str()),
|(split_distribution_string, split_version_string)| {
(Some(split_distribution_string), split_version_string)
},
);

let version_string = match user_version_string {
"7" | "1.7" => "1.7.0_352",
Expand All @@ -34,8 +34,8 @@ pub fn normalize_version_string<S: Into<String>>(
};

match user_distribution_string {
None => Ok(default_distribution(&stack_id)),
Some("heroku") | Some("openjdk") => Ok(OpenJDKDistribution::Heroku),
None => Ok(default_distribution(stack_id)),
Some("heroku" | "openjdk") => Ok(OpenJDKDistribution::Heroku),
Some("zulu") => Ok(OpenJDKDistribution::AzulZulu),
Some(unknown) => Err(NormalizeVersionStringError::UnknownDistribution(
String::from(unknown),
Expand Down
1 change: 1 addition & 0 deletions buildpacks/jvm/tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use libcnb_test::{assert_contains, BuildConfig, TestRunner};

#[test]
#[ignore = "integration test"]
fn test() {
let builder_name = std::env::var("INTEGRATION_TEST_CNB_BUILDER").unwrap();

Expand Down
2 changes: 1 addition & 1 deletion buildpacks/maven/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Heroku Cloud Native Maven Buildpack
[![CircleCI](https://circleci.com/gh/heroku/buildpacks-jvm/tree/main.svg?style=shield)](https://circleci.com/gh/heroku/buildpacks-jvm/tree/main)
[![CI](https://github.com/heroku/buildpacks-jvm/actions/workflows/ci.yml/badge.svg)](https://github.com/heroku/buildpacks-jvm/actions/workflows/ci.yml)
[![Registry](https://img.shields.io/badge/dynamic/json?url=https://registry.buildpacks.io/api/v1/buildpacks/heroku/maven&label=version&query=$.latest.version&color=DF0A6B&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACSVJREFUaAXtWQ1sFMcVnp/9ub3zHT7AOEkNOMYYp4CQQFBLpY1TN05DidI2NSTF0CBFQAOBNrTlp0a14sipSBxIG6UYHKCO2ka4SXD4SUuaCqmoJJFMCapBtcGYGqMkDgQ4++52Z2e3b87es+/s+wNHVSUPsnZv9s2b97335v0MCI2NMQ2MaeD/WgP4FqQnX//2K4tVWfa0X+9+q/N4dfgWeESXPPjUUd+cu+5cYmMcPvzawQOtrdVG9GMaLxkD+OZDex6WVeUgwhiZnH1g62bNX4+sPpLGXvEkdPNzLd93e9y/cCnabIQJCnz+2Q9rNs9tjCdM9ltK9nGkb5jYxYjIyDJDSCLSV0yFHCr/XsObvQH92X+8u/b0SGvi5zZUn1joc/u2qapajglB4XAfUlQPoqpyRzxtqt8ZA+AIcQnZEb6WZSKCMSZUfSTLg8vv/86e3b03AztO/u3p7pE2fvInfy70TpiwRVKU5YqqygbTEWL9lISaiDFujbQu2VzGAIYzs5HFDUQo8WKibMzy0Yr7Ht5Td/Nyd0NLS3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F5RXRzFgNK6yAzwzX551+MVswxABxOefmP3etS5a2YSuVizjkfBAo9l0tzyCDbSqKC7YUIu/daOFB3pbUxrf721B0rc/w+9zrYfK2K5QlhcCvnfFCigUr6L0ucDA3KeR8iYO3U8y8M6+ZGBDAgIc0vWl5BEakiijQTYmhkWpEVEBwOELgUt+y3QtysuXT21ahGoujSePl3/qpiRVK2wO3KY1ClyuJ8YHATcDPIyhQFud6JbfKr1vZz+xehd0a8e08GICKC318xzpejrpUQ3UAkaZK4yoGU/HduWts72hsPpyFnSpL2wjWlFNFfSoSWipqIWVYP1J27rwcCL839eF9PMgYpATiLJ01eOs2jaU+D03508cK/9iHUkm6F4LBI+hTlc9m0BSsVSufcCBkvzu7afSHpgrGPYxoY00BEA/8FOPrYBqYsE44AAAAASUVORK5CYII=&labelColor=white)](https://registry.buildpacks.io/buildpacks/heroku/maven)

Heroku's official Cloud Native Buildpack for [Apache Maven](https://maven.apache.org/).
Expand Down
Loading

0 comments on commit 64318b7

Please sign in to comment.