Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
Co-Authored-By: Peter Bourgon <peterbourgon@users.noreply.github.com>
  • Loading branch information
phamann and peterbourgon committed Feb 5, 2020
0 parents commit 5a8d21b
Show file tree
Hide file tree
Showing 119 changed files with 11,992 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
cli:
fetcher: custom
project: git@github.com:fastly/cli.git
analyze:
modules:
- name: github.com/fastly/cli/cmd/fastly
type: go
target: github.com/fastly/cli/cmd/fastly
path: cmd/fastly
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug report
about: Tell us about a bug to help us improve
title: ''
labels: bug
assignees: ''

---

**Version**

Please paste the output of `fastly version` here.

**What happened**

Please describe the command you ran, what you expected to happen, and what happened instead.
121 changes: 121 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
on: pull_request
name: Test
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Set GOPATH
# Temporary fix, see: https://github.com/actions/setup-go/issues/14
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- name: Restore cache
id: cache
uses: actions/cache@v1
with:
path: ~/go/bin
key: ${{ runner.os }}-go-bin-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-bin-
- name: Restore cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Install staticcheck
if: steps.cache.outputs.cache-hit != 'true'
run: go get -v -u honnef.co/go/tools/cmd/staticcheck
shell: bash
- name: Install golint
if: steps.cache.outputs.cache-hit != 'true'
run: go get -v -u golang.org/x/lint/golint
shell: bash
- name: Install gosec
if: steps.cache.outputs.cache-hit != 'true'
run: go get github.com/securego/gosec/cmd/gosec
shell: bash
- name: Fmt
run: make fmt
- name: Vet
run: make vet
shell: bash
- name: Staticcheck
run: make staticcheck
shell: bash
- name: Lint
run: make lint
shell: bash
- name: Gosec
run: make gosec
shell: bash
test:
strategy:
matrix:
go-version: [1.13.x]
rust-toolchain: [1.40.0]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Set GOPATH
# Temporary fix, see: https://github.com/actions/setup-go/issues/14
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
- name: Restore cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-toolchain }}
- name: Add wasm32-wasi Rust target
run: rustup target add wasm32-wasi --toolchain ${{ matrix.rust-toolchain }}
- name: Test
run: make test
shell: bash
env:
TEST_COMPUTE_BUILD: true
scan:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Install fossa
run: |
curl --proto '=https' --tlsv1.2 -sSf -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash
shell: bash
- name: Set GOPATH
# Temporary fix, see: https://github.com/actions/setup-go/issues/14
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- name: Checkout code
uses: actions/checkout@v1
- name: Fossa
run: make fossa
shell: bash
env:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
FOSSA_API_ENDPOINT: ${{ secrets.FOSSA_API_ENDPOINT }}
114 changes: 114 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
on:
push:
tags:
- 'v*'
name: Release
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Output upload URL to file
env:
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
run: |
echo $UPLOAD_URL > upload_url.txt
- name: Persist release upload URL
uses: actions/upload-artifact@v1
with:
name: release
path: upload_url.txt
upload:
needs: release
strategy:
matrix:
pair: [linux-amd64, linux-386, darwin-amd64, windows-amd64, windows-386]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.13.x'
- name: Checkout code
uses: actions/checkout@v1
- name: Get version
run: |
echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build release binaries
env:
PAIR: ${{ matrix.pair }}
shell: bash
run: |
GOOS=$(echo $PAIR | cut -d'-' -f1)
GOARCH=$(echo $PAIR | cut -d'-' -f2)
if [[ $GOOS =~ "windows" ]]
then
env VERSION=$VERSION GOOS=$GOOS GOARCH=$GOARCH make release-exe
else
env VERSION=$VERSION GOOS=$GOOS GOARCH=$GOARCH make release
fi
- name: Get upload URL
uses: actions/download-artifact@v1
with:
name: release
- name: Set upload URL env var
run: |
value=`cat release/upload_url.txt`
echo ::set-env name=UPLOAD_URL::$value
- name: Upload release asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ env.UPLOAD_URL }}"
asset_path: "./fastly_${{ env.VERSION }}_${{ matrix.pair }}.tar.gz"
asset_name: "fastly_${{ env.VERSION }}_${{ matrix.pair }}.tar.gz"
asset_content_type: application/gzip
- name: Persist binary
uses: actions/upload-artifact@v1
with:
name: bin
path: ./fastly_${{ env.VERSION }}_${{ matrix.pair }}.tar.gz
checksums:
needs: upload
runs-on: ubuntu-latest
steps:
- name: Get binaries
uses: actions/download-artifact@v1
with:
name: bin
- name: Set version env var
run: |
echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Get upload URL
uses: actions/download-artifact@v1
with:
name: release
- name: Set upload URL env var
run: |
value=`cat release/upload_url.txt`
echo ::set-env name=UPLOAD_URL::$value
- name: Generate checksums
run: |
cd bin
for filename in *; do
echo -e "$(sha256sum $filename)" >> fastly_${{ env.VERSION }}_SHA256SUMS
done
- name: Upload checksums asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./bin/fastly_${{ env.VERSION }}_SHA256SUMS
asset_name: fastly_${{ env.VERSION }}_SHA256SUMS
asset_content_type: text/plain
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fastly
!cmd/fastly

# Fastly package format files
**/fastly.toml
!pkg/packag/testdata/build/fastly.toml
**/Cargo.toml
!pkg/packag/testdata/build/Cargo.toml
**/Cargo.lock
!pkg/packag/testdata/build/Cargo.lock
**/*.tar.gz
!pkg/packag/testdata/deploy/pkg/package.tar.gz
**/bin
**/src
!pkg/packag/testdata/build/src
**/target

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Ignore IDEs
.idea

# Ignore binaries
build/
!pkg/packag/testdata/build/
Loading

0 comments on commit 5a8d21b

Please sign in to comment.