Skip to content

Commit

Permalink
Fix CI scripts and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
charlespierce committed Sep 18, 2022
1 parent 5db381f commit a820cf2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 62 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: docker build -t volta .
working-directory: ./ci/docker
- name: Compile and package Volta
run: docker run --volume ${PWD}:/root/workspace --workdir /root/workspace --rm --init --tty volta /root/workspace/ci/build-and-package.sh volta-linux
run: docker run --volume ${PWD}:/root/workspace --workdir /root/workspace --rm --init --tty volta /root/workspace/ci/build-linux.sh volta-linux
- name: Upload release artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -39,7 +39,7 @@ jobs:
toolchain: stable
override: true
- name: Compile and package Volta
run: ./ci/build-and-package.sh volta-macos
run: ./ci/build-macos-x86_64.sh volta-macos
- name: Upload release artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -60,7 +60,7 @@ jobs:
target: aarch64-apple-darwin
override: true
- name: Compile and package Volta
run: ./ci/build-for-arm.sh volta-macos-aarch64
run: ./ci/build-macos-arm.sh volta-macos-aarch64
- name: Upload release artifact
uses: actions/upload-artifact@v2
with:
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions ci/build-macos-x86_64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

echo "Building Volta"

cargo build --release

echo "Packaging Binaries"

cd target/release
tar -zcvf "$1.tar.gz" volta volta-shim volta-migrate
68 changes: 9 additions & 59 deletions dev/unix/tests/install-script.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,83 +40,33 @@ END_CARGO_TOML
diff <(echo "$output") <(echo "$expected_output")
}

# linux
@test "parse_os_info - linux" {
expected_output="linux"

# macos
@test "parse_os_info - macos" {
expected_output="macos"

run parse_os_info "Darwin" "this is ignored"
run parse_os_info "Linux"
[ "$status" -eq 0 ]
diff <(echo "$output") <(echo "$expected_output")
}

# linux - supported OpenSSL
@test "parse_os_info - linux with supported OpenSSL" {
expected_output="linux-openssl-1.2"
# macos
@test "parse_os_info - macos" {
expected_output="macos"

run parse_os_info "Linux" "OpenSSL 1.2.3a whatever else"
run parse_os_info "Darwin"
[ "$status" -eq 0 ]
diff <(echo "$output") <(echo "$expected_output")
}

# linux - unsupported OpenSSL
@test "parse_os_info - linux with unsupported OpenSSL" {
expected_output=$(echo -e "\033[1;31mError\033[0m: Releases for 'SomeSSL' not currently supported. Supported libraries are: OpenSSL.")

run parse_os_info "Linux" "SomeSSL 1.2.3a whatever else"
[ "$status" -eq 1 ]
diff <(echo "$output") <(echo "$expected_output")
}

# linux - unexpected OpenSSL version format
@test "parse_os_info - linux with unexpected OpenSSL format" {
expected_output=$(echo -e "\033[1;31mError\033[0m: Could not determine OpenSSL version for 'Some SSL 1.2.4'.")

run parse_os_info "Linux" "Some SSL 1.2.4"
[ "$status" -eq 1 ]
diff <(echo "$output") <(echo "$expected_output")
}

# unsupported OS
@test "parse_os_info - unsupported OS" {
expected_output=""

run parse_os_info "DOS" "doesn't matter"
run parse_os_info "DOS"
[ "$status" -eq 1 ]
diff <(echo "$output") <(echo "$expected_output")
}


# parsing valid OpenSSL version strings
@test "parse_openssl_version - valid versions" {
expected_output="0.9"
run parse_openssl_version "OpenSSL 0.9.5a 1 Apr 2000"
[ "$status" -eq 0 ]
diff <(echo "$output") <(echo "$expected_output")

expected_output="1.0"
run parse_openssl_version "OpenSSL 1.0.1e-fips 11 Feb 2013"
[ "$status" -eq 0 ]
diff <(echo "$output") <(echo "$expected_output")
}

# unsupported OpenSSL library
@test "parse_openssl_version - unsupported library" {
expected_output=$(echo -e "\033[1;31mError\033[0m: Releases for 'LibreSSL' not currently supported. Supported libraries are: OpenSSL.")
run parse_openssl_version "LibreSSL 2.6.5"
[ "$status" -eq 1 ]
diff <(echo "$output") <(echo "$expected_output")
}

# version string with unexpected format
@test "parse_openssl_version - unexpected format" {
expected_output=$(echo -e "\033[1;31mError\033[0m: Could not determine OpenSSL version for 'Some Weird Version 1.2.3'.")
run parse_openssl_version "Some Weird Version 1.2.3"
[ "$status" -eq 1 ]
diff <(echo "$output") <(echo "$expected_output")
}


# test element_in helper function
@test "element_in works correctly" {
run element_in "foo" "foo" "bar" "baz"
Expand Down

0 comments on commit a820cf2

Please sign in to comment.