Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,57 @@ blocks:
commands:
- 'test-results publish report.xml --name="Bats: Linux" --suite-prefix=$TEST'

- name: "Bats: Ubuntu 24.04"
dependencies:
- "Build local CLIs"
task:
agent:
machine:
type: e2-standard-2
os_image: ubuntu2404
prologue:
commands:
- checkout
- artifact pull workflow bin/linux/amd64/cache -d cache-cli/bin/linux/amd64/cache
- artifact pull workflow bin/linux/arm64/cache -d cache-cli/bin/linux/arm64/cache
- artifact pull workflow bin/darwin/amd64/cache -d cache-cli/bin/darwin/amd64/cache
- artifact pull workflow bin/darwin/arm64/cache -d cache-cli/bin/darwin/arm64/cache
- artifact pull workflow bin/linux/amd64/sem-context -d sem-context/bin/linux/amd64/sem-context
- artifact pull workflow bin/linux/arm64/sem-context -d sem-context/bin/linux/arm64/sem-context
- artifact pull workflow bin/darwin/amd64/sem-context -d sem-context/bin/darwin/amd64/sem-context
- artifact pull workflow bin/darwin/arm64/sem-context -d sem-context/bin/darwin/arm64/sem-context
- artifact pull workflow bin/linux/amd64/test-results -d test-results/bin/linux/amd64/test-results
- artifact pull workflow bin/linux/arm64/test-results -d test-results/bin/linux/arm64/test-results
- artifact pull workflow bin/darwin/amd64/test-results -d test-results/bin/darwin/amd64/test-results
- artifact pull workflow bin/darwin/arm64/test-results -d test-results/bin/darwin/arm64/test-results
- bash release/create.sh
- source tests/sftp_server/start_on_linux.sh
- sudo apt-get install -y python3.8-dev
- sem-version python 3.11
- sem-version go 1.22
- sem-version php 8.2.20
jobs:
- name: "Non-cache tests"
matrix:
- env_var: TEST
values:
- tests/install_package.bats
- tests/artifacts.bats
- tests/compiler.bats
- tests/test-results.bats
- tests/enetwork.bats
- tests/sem-semantic-release.bats
commands:
- source release/install_in_tests.sh
- git submodule init && git submodule update
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

epilogue:
always:
commands:
- 'test-results publish report.xml --name="Bats: Linux" --suite-prefix=$TEST'

- name: "Cache CLI: Tests"
dependencies: []
task:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qy
RUN apt-get install -y wget apt-transport-https software-properties-common git
RUN apt-get install -y --fix-missing wget apt-transport-https software-properties-common git

RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
Expand Down
1 change: 1 addition & 0 deletions cache-cli/pkg/utils/check.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//revive:disable-next-line:var-naming
package utils

import (
Expand Down
4 changes: 2 additions & 2 deletions test-results/cmd/resource-metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/semaphoreci/toolbox/test-results/pkg/parser"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -89,8 +90,7 @@ var resourceMetricsCmd = &cobra.Command{
dockerDiskSeries []string
)

layout := "Mon 02 Jan 2006 03:04:05 PM MST"
startTime, err := time.Parse(layout, metrics[0].Timestamp)
startTime, layout, err := parser.ParseTimeAuto(metrics[0].Timestamp)
if err != nil {
return fmt.Errorf("failed to parse start time: %w", err)
}
Expand Down
25 changes: 25 additions & 0 deletions test-results/pkg/parser/time.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package parser

import (
"fmt"
"time"
)

var layouts = []string{
time.RFC1123,
time.RFC1123Z,
"Mon 02 Jan 2006 03:04:05 PM MST",
"Mon Jan 2 15:04:05 MST 2006",
"Mon Jan 2 03:04:05 PM MST 2006",
"Mon Jan 2 15:04:05 UTC 2006",
}

func ParseTimeAuto(input string) (time.Time, string, error) {
for _, layout := range layouts {
t, err := time.Parse(layout, input)
if err == nil {
return t, layout, nil
}
}
return time.Time{}, "", fmt.Errorf("no matching layout found for: %s", input)
}