Skip to content

Commit

Permalink
Adds back some workflows and updates scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ForestEckhardt committed Mar 18, 2022
1 parent ca5dd9a commit 51ae999
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 29 deletions.
25 changes: 25 additions & 0 deletions .github/.patch_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.github/.patch_files
.github/.syncignore
.github/CODEOWNERS
.github/dependabot.yml
.github/labels.yml
.github/workflows/approve-bot-pr.yml
.github/workflows/auto-merge.yml
.github/workflows/check-pr-labels.yml
.github/workflows/codeql-analysis.yml
.github/workflows/label-pr.yml
.github/workflows/lint-yaml.yml
.github/workflows/lint.yml
.github/workflows/synchronize-labels.yml
.github/workflows/test-pull-request.yml
.github/workflows/update-dependencies.yml
.github/workflows/update-github-config.yml
.gitignore
LICENSE
NOTICE
README.md
scripts/.util/print.sh
scripts/.util/tools.json
scripts/.util/tools.sh
scripts/integration.sh
scripts/unit.sh
1 change: 1 addition & 0 deletions .github/.syncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CODEOWNERS
27 changes: 0 additions & 27 deletions .github/labels.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # Once a day at midnight

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language:
- 'go'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17.x

- name: Checkout
uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.32.2
52 changes: 52 additions & 0 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test Pull Request

on:
pull_request:
branches:
- main

jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17.x

- name: Checkout
uses: actions/checkout@v3

- name: Run Unit Tests
run: ./scripts/unit.sh

integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: unit
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17.x

- name: Checkout
uses: actions/checkout@v3

- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true

- name: Run Integration Tests
run: ./scripts/integration.sh --use-token
env:
GIT_TOKEN: ${{ github.token }}

upload:
name: Upload Workflow Event Payload
runs-on: ubuntu-latest
steps:
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: event-payload
path: ${{ github.event_path }}
5 changes: 3 additions & 2 deletions scripts/.util/tools.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"jam": "v1.1.0",
"pack": "v0.21.1"
"createpackage": "v1.58.0",
"jam": "v1.2.0",
"pack": "v0.24.0"
}
27 changes: 27 additions & 0 deletions scripts/.util/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,33 @@ function util::tools::packager::install () {
fi
}

function util::tools::create-package::install () {
local dir version
while [[ "${#}" != 0 ]]; do
case "${1}" in
--directory)
dir="${2}"
shift 2
;;

*)
util::print::error "unknown argument \"${1}\""
;;

esac
done

version="$(jq -r .createpackage "$(dirname "${BASH_SOURCE[0]}")/tools.json")"

mkdir -p "${dir}"
util::tools::path::export "${dir}"

if [[ ! -f "${dir}/create-package" ]]; then
util::print::title "Installing create-package"
GOBIN="${dir}" go install -ldflags="-s -w" "github.com/paketo-buildpacks/libpak/cmd/create-package@${version}"
fi
}

function util::tools::tests::checkfocus() {
testout="${1}"
if grep -q 'Focused: [1-9]' "${testout}"; then
Expand Down
3 changes: 3 additions & 0 deletions scripts/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ function tools::install() {
util::tools::jam::install \
--directory "${BUILDPACKDIR}/.bin"

util::tools::create-package::install \
--directory "${BUILDPACKDIR}/.bin"

if [[ -f "${BUILDPACKDIR}/.libbuildpack" ]]; then
util::tools::packager::install \
--directory "${BUILDPACKDIR}/.bin"
Expand Down

0 comments on commit 51ae999

Please sign in to comment.