Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to Github action [1.1.x] (#2203)
- Loading branch information
Showing
6 changed files
with
299 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 1.1.x | ||
push: | ||
branches: | ||
- 1.1.x | ||
|
||
env: | ||
GO_VERSION: 1.12.x | ||
GO111MODULE: off | ||
GOPATH: /home/runner/work/nuclio/nuclio/go | ||
NUCLIO_LABEL: ${{ github.run_number }} | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dump github context | ||
run: echo "$GITHUB_CONTEXT" | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
|
||
- name: Dump runner context | ||
run: echo "$RUNNER_CONTEXT" | ||
env: | ||
RUNNER_CONTEXT: ${{ toJson(runner) }} | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/github.com/nuclio/nuclio | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Lint | ||
run: | | ||
go get github.com/v3io/v3io-go-http | ||
go get github.com/nuclio/logger | ||
go get github.com/nuclio/nuclio-sdk-go \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio-sdk-go \ | ||
&& git checkout v0.0.1 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
go get github.com/nuclio/amqp | ||
go get github.com/v3io/scaler-types \ | ||
&& cd $GOPATH/src/github.com/v3io/scaler-types \ | ||
&& git checkout v1.0.0 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
make lint | ||
test_short: | ||
name: Test short | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/github.com/nuclio/nuclio | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Run short test | ||
run: | | ||
go get github.com/v3io/v3io-go-http | ||
go get github.com/nuclio/logger | ||
go get github.com/nuclio/nuclio-sdk-go \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio-sdk-go \ | ||
&& git checkout v0.0.1 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
go get github.com/nuclio/amqp | ||
go get -d golang.org/x/net/... | ||
go get github.com/v3io/scaler-types \ | ||
&& cd $GOPATH/src/github.com/v3io/scaler-types \ | ||
&& git checkout v1.0.0 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
make test-short | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dump github context | ||
run: echo "$GITHUB_CONTEXT" | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
|
||
- name: Dump runner context | ||
run: echo "$RUNNER_CONTEXT" | ||
env: | ||
RUNNER_CONTEXT: ${{ toJson(runner) }} | ||
|
||
- name: Dump github ref | ||
run: echo "$GITHUB_REF" | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/github.com/nuclio/nuclio | ||
|
||
# since github-actions gives us 14G only, and fills it up with some garbage | ||
# we will free up some space for us (~2GB) | ||
- name: Freeing up disk space | ||
run: | | ||
chmod +x "${GITHUB_WORKSPACE}/go/src/github.com/nuclio/nuclio/hack/scripts/ci/free-space.sh" | ||
"${GITHUB_WORKSPACE}/go/src/github.com/nuclio/nuclio/hack/scripts/ci/free-space.sh" | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Build | ||
run: | | ||
go get github.com/v3io/v3io-go-http | ||
go get github.com/nuclio/logger | ||
go get github.com/nuclio/nuclio-sdk-go \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio-sdk-go \ | ||
&& git checkout v0.0.1 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
go get github.com/nuclio/amqp | ||
go get -d golang.org/x/net/... | ||
go get github.com/v3io/scaler-types \ | ||
&& cd $GOPATH/src/github.com/v3io/scaler-types \ | ||
&& git checkout v1.0.0 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
make docker-images | ||
env: | ||
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }} | ||
|
||
- name: Build binaries | ||
run: | | ||
cd $GOPATH/src/github.com/nuclio/nuclio | ||
NUCLIO_OS=linux NUCLIO_ARCH=amd64 make tools | ||
NUCLIO_OS=darwin NUCLIO_ARCH=amd64 make tools | ||
NUCLIO_OS=windows NUCLIO_ARCH=amd64 make tools | ||
env: | ||
NUCLIO_NUCTL_CREATE_SYMLINK: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
env: | ||
REPO: quay.io | ||
REPO_NAME: nuclio | ||
GO_VERSION: 1.12.x | ||
GO111MODULE: off | ||
GOPATH: /home/runner/work/nuclio/nuclio/go | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
if: github.repository == 'nuclio/nuclio' | ||
steps: | ||
- name: Dump github context | ||
run: echo "$GITHUB_CONTEXT" | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
|
||
- name: Dump runner context | ||
run: echo "$RUNNER_CONTEXT" | ||
env: | ||
RUNNER_CONTEXT: ${{ toJson(runner) }} | ||
|
||
- name: Dump github ref | ||
run: echo "$GITHUB_REF" | ||
|
||
- name: Set NUCLIO_LABEL to release tag | ||
run: | | ||
echo "NUCLIO_LABEL=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/github.com/nuclio/nuclio | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
# since github-actions gives us 14G only, and fills it up with some garbage | ||
# we will free up some space for us (~2GB) | ||
- name: Freeing up disk space | ||
run: | | ||
chmod +x "${GITHUB_WORKSPACE}/go/src/github.com/nuclio/nuclio/hack/scripts/ci/free-space.sh" | ||
"${GITHUB_WORKSPACE}/go/src/github.com/nuclio/nuclio/hack/scripts/ci/free-space.sh" | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.REPO }} | ||
username: ${{ secrets.QUAYIO_DOCKER_USERNAME }} | ||
password: ${{ secrets.QUAYIO_DOCKER_PASSWORD }} | ||
|
||
- name: Build | ||
run: | | ||
go get github.com/v3io/v3io-go-http | ||
go get github.com/nuclio/logger | ||
go get github.com/nuclio/nuclio-sdk-go \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio-sdk-go \ | ||
&& git checkout v0.0.1 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
go get github.com/nuclio/amqp | ||
go get github.com/v3io/scaler-types \ | ||
&& cd $GOPATH/src/github.com/v3io/scaler-types \ | ||
&& git checkout v1.0.0 \ | ||
&& cd $GOPATH/src/github.com/nuclio/nuclio | ||
make docker-images | ||
env: | ||
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }} | ||
|
||
- name: Push images | ||
run: | | ||
make push-docker-images | ||
env: | ||
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }} | ||
|
||
- name: Build binaries | ||
run: | | ||
cd $GOPATH/src/github.com/nuclio/nuclio | ||
NUCLIO_OS=linux NUCLIO_ARCH=amd64 make tools | ||
NUCLIO_OS=darwin NUCLIO_ARCH=amd64 make tools | ||
NUCLIO_OS=windows NUCLIO_ARCH=amd64 make tools | ||
env: | ||
NUCLIO_NUCTL_CREATE_SYMLINK: false | ||
|
||
- name: Upload binaries | ||
uses: AButler/upload-release-assets@v2.0 | ||
with: | ||
files: '/home/runner/work/nuclio/nuclio/go/bin/nuctl-*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = async ({github, context, prNumber, labelsToAdd, labelsToRemove}) => { | ||
|
||
console.log(`Adding labels ${labelsToAdd} to PR #${prNumber}`) | ||
await github.issues.addLabels({ | ||
issue_number: prNumber, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: labelsToAdd | ||
}) | ||
|
||
console.log(`Removing labels ${labelsToRemove} from PR #${prNumber}`) | ||
await Promise.all(labelsToRemove.map(labelName => github.issues.removeLabel({ | ||
issue_number: prNumber, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: labelName | ||
}).catch(error => { | ||
if (error.toString().toLowerCase().includes('label does not exist')) { | ||
console.log(`Ignoring not existing label error: ${error.toString()}`) | ||
return | ||
} | ||
throw error | ||
}))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env sh | ||
|
||
print_free_space() { | ||
df --human-readable | ||
} | ||
|
||
# before cleanup | ||
print_free_space | ||
|
||
# clean unneeded os packages and misc | ||
sudo apt-get remove --yes '^dotnet-.*' 'php.*' azure-cli google-cloud-sdk google-chrome-stable firefox powershell | ||
sudo apt-get autoremove --yes | ||
sudo apt clean | ||
|
||
# cleanup unneeded share dirs ~30GB | ||
sudo rm --recursive --force \ | ||
/usr/local/lib/android \ | ||
/usr/share/dotnet \ | ||
/usr/share/miniconda \ | ||
/usr/share/dotnet \ | ||
/usr/share/swift | ||
|
||
# clean unneeded docker images | ||
docker system prune --all --force | ||
|
||
# post cleanup | ||
print_free_space |