Skip to content

Commit

Permalink
Merge pull request #89 from discentem/pr89
Browse files Browse the repository at this point in the history
  • Loading branch information
discentem authored May 11, 2023
2 parents 4340e0f + a6c6537 commit 600b64c
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test --test_output=all
test --test_size_filters=small,medium --test_output=all --test_verbose_timeout_warnings
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.2.0
6 changes: 0 additions & 6 deletions .github/workflows/actions/bazel_build/action.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/actions/lint/action.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Code Coverage
on:
pull_request:

permissions:
contents: read # for actions/checkout to fetch code

jobs:
code_coverage:
name: Bazel - Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel

- name: Build via bazel
run: bazel build //...

- name: Run bazel code-coverage
run: bazel coverage --nocache_test_results ...:all
69 changes: 69 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Integration Tests
on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
integration_tests:
name: Integration Testing - S3 Download and Retrieval of Test PKG file
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel

- name: Setup minio S3 bucket
run: |
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
MINIO_ROOT_USER=minioadmin MINIO_ROOT_PASSWORD=minioadmin ./minio server /tmp --address ":9000" --console-address ":9001" &
- name: Setup minio S3 bucket
run: |
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
export AWS_EC2_METADATA_DISABLED=true
aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
- name: Build via bazel
run: bazel build //...

- name: Setup /tmp folder to test Pantri out
run: |
mkdir -p /tmp/some_git_project
cp ./bazel-bin/pantri_but_go_/pantri_but_go /tmp/some_git_project/pantri_but_go
chmod a+x /tmp/some_git_project/pantri_but_go
- name: Init Pantri from bazel build output
run: |
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
cd /tmp/some_git_project
./pantri_but_go init /tmp/some_git_project --backend_address http://127.0.0.1:9000/test --store_type=s3 --region="us-east-1"
- name: Download and Upload some small package to Pantri test S3/minio bucket
run: |
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
cd /tmp/some_git_project
wget https://github.com/macadmins/nudge/releases/download/v1.1.11.81465/Nudge_Suite-1.1.11.81465.pkg -O nudge_suite.pkg
./pantri_but_go upload nudge_suite.pkg --vv --debug
- name: Test File Retrieval with Pantri from test S3/minio bucket
run: |
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
cd /tmp/some_git_project
rm -f ./nudge_suite.pkg
./pantri_but_go retrieve nudge_suite.pkg.pfile --vv --debug
52 changes: 52 additions & 0 deletions .github/workflows/lint_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint and Tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
golangci_lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: golangci_lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: true
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --verbose

bazel_tests:
permissions:
contents: read # for actions/checkout to fetch code
runs-on: ubuntu-latest
name: Bazel - Tests
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel
- name: Build via bazel
run: bazel build //...
- name: Test via bazel
run: bazel test //...
28 changes: 0 additions & 28 deletions .github/workflows/main.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:exclude .sl
gazelle(name = "gazelle")

gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=deps.bzl%go_dependencies",
"-prune",
],
command = "update-repos",
)

go_library(
name = "pantri_but_go_lib",
srcs = ["main.go"],
Expand Down
7 changes: 0 additions & 7 deletions _ci/lint/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion internal/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(

go_test(
name = "cli_test",
timeout = "short",
srcs = [
"helpers_test.go",
"init_test.go",
Expand All @@ -39,7 +40,7 @@ go_test(
"//internal/metadata",
"//internal/stores",
"//internal/testutil",
"@com_github_gonuts_go_shellquote//:go_default_library",
"@com_github_gonuts_go_shellquote//:go-shellquote",
"@com_github_spf13_afero//:afero",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
Expand Down
7 changes: 7 additions & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,10 @@ def go_repositories():
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
version = "v0.0.0-20200804184101-5ec99f83aff1",
)
go_repository(
name = "com_github_gonuts_go_shellquote",
build_file_proto_mode = "disable_global",
importpath = "github.com/gonuts/go-shellquote",
sum = "h1:rVmtJJsWzJJ3T52/cPd3wXnDq0X2G8oLiuzbl4fVr4A=",
version = "v0.0.0-20180428030007-95032a82bc51",
)

0 comments on commit 600b64c

Please sign in to comment.