Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub Actions #442

Merged
merged 15 commits into from
Feb 27, 2024
53 changes: 53 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Checks

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
pull-requests: read

jobs:

checks:
name: Check Process
runs-on: ubuntu-latest
env:
GO_VERSION: oldstable
GOLANGCI_LINT_VERSION: v1.56.2
CGO_ENABLED: 0

steps:

- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum

- name: vendoring
run: go mod vendor

- name: vendoring diff
run: git diff --exit-code vendor/

# https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
golangci-lint --version

ldez marked this conversation as resolved.
Show resolved Hide resolved

38 changes: 38 additions & 0 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Go Matrix
on:
push:
branches:
- main
pull_request:

permissions:
contents: read
pull-requests: read

jobs:

cross:
name: Go
ldez marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 0

strategy:
matrix:
go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Build pebble
run: go build -v -ldflags "-s -w" -trimpath -o pebble ./cmd/pebble

- name: Build pebble-challtestsrv
run: go build -v -ldflags "-s -w" -trimpath -o pebble-challtestsrv ./cmd/pebble-challtestsrv
92 changes: 92 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Tests

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
pull-requests: read

jobs:

test-linux:
name: Test on Linux
runs-on: ubuntu-latest
env:
GO_VERSION: oldstable
steps:

- name: Setup /etc/hosts
run: |
echo "127.0.0.1 example.letsencrypt.org" | sudo tee -a /etc/hosts
echo "127.0.0.1 elpmaxe.letsencrypt.org" | sudo tee -a /etc/hosts

# https://github.com/marketplace/actions/checkout
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: apt install
run: sudo apt-get install snapd python3-acme python3-josepy

- name: snap install
run: sudo snap install core && sudo snap refresh core

- name: snap install certbot
run: sudo snap install --classic certbot && sudo ln -s /snap/bin/certbot /usr/bin/certbot

- name: go install tools
run: go install golang.org/x/tools/cmd/cover@latest

- name: go install goveralls
run: go install github.com/mattn/goveralls@latest

# Clone Boulder because the go.mod contains `exclude` directives,
# and so the load-generator cannot be installed with a simple `go install`
- name: Checkout Boulder repository (load-generator)
uses: actions/checkout@v4

with:
repository: letsencrypt/boulder
path: boulder
ref: release-2024-02-20

- name: install load-generator
run: |
cd $GITHUB_WORKSPACE/boulder/test/load-generator
go install
cd -
ldez marked this conversation as resolved.
Show resolved Hide resolved

- name: go install
run: go install -v -race ./...

- name: launch pebble
run: GORACE="halt_on_error=1" PEBBLE_WFE_NONCEREJECT=0 pebble &

# Run project unit tests (with the race detector enabled and atomic coverage profile collection)
- name: unittests
run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./...

# # Upload collected coverage profile to goveralls
# - name: goveralls
# run: goveralls -coverprofile=coverage.out -service=github

# Perform a test issuance with chisel2.py
- name: chisel
run: REQUESTS_CA_BUNDLE=./test/certs/pebble.minica.pem python ./test/chisel2.py example.letsencrypt.org elpmaxe.letsencrypt.org

# Run the load-generator briefly - note, because Pebble isn't using the
# load-generator's mock DNS server none of the issuances will succeed. This
# step is performed just to shake out data races with concurrent requests.
- name: load-generator
run: load-generator -config ./test/config/load-generator-config.json > /dev/null
ldez marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
run:
timeout: 9m
ldez marked this conversation as resolved.
Show resolved Hide resolved

linters-settings:
gocyclo:
min-complexity: 25
Expand Down
Loading