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

all: migrate the rest of the CircleCI jobs to GitHub Actions #4250

Merged
merged 19 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
shell: bash
run: |
# Set a base, fixed modification time of all directories.
# git-restore-mtime doesn't set the mtime of of all directories.
# git-restore-mtime doesn't set the mtime of all directories.
# (see https://github.com/MestreLion/git-tools/issues/47 for details)
touch -m -t '201509301646' $(find . -type d -not -path '.git/*')
# Restore original modification time from git. git clone sets the
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/horizon-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Horizon master

on:
push:
branches: [master]
# TODO: Pull requests enabled temporarily, to test the code, remove before merging!
pull_request:

jobs:

push-horizon-image-sha:
name: Push stellar/horizon:sha to DockerHub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get image tag (short sha)
shell: bash
id: get_tag
run: echo ::set-output name=TAG::$(git rev-parse --short HEAD)

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push to DockerHub
uses: docker/build-push-action@v2
with:
# TODO: Commented out until we disable the CircleCI jobs
# push: true
tags: stellar/horizon:${{ steps.get_tag.outputs.TAG }}
file: services/horizon/docker/Dockerfile.dev

push-state-diff-image:
name: Push stellar/ledger-state-diff:{sha,latest} to DockerHub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get image tag (long sha)
shell: bash
id: get_tag
run: echo ::set-output name=TAG::$(git rev-parse HEAD)

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push to DockerHub
uses: docker/build-push-action@v2
with:
# TODO: Commented out until we disable the CircleCI jobs
# push: true
tags: stellar/ledger-state-diff:${{ steps.get_tag.outputs.TAG }},stellar/ledger-state-diff:latest
file: exp/tools/dump-ledger-state/Dockerfile
build-args: GITCOMMIT=${{ steps.get_tag.outputs.TAG }}
no-cache: true
73 changes: 73 additions & 0 deletions .github/workflows/horizon-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Horizon release

on:
push:
tags: ['horizon-v.*']
# TODO: Pull requests enabled temporarily, to test the code, remove before merging!
pull_request:

jobs:

publish-artifacts:
runs-on: ubuntu-latest
name: Upload artifacts to GitHub release
steps:
- name: Run deprecation tests
shell: bash
run: |
export VERSION=${GITHUB_REF_NAME#horizon-v}
echo "Searching for \"Action needed in release ${VERSION}\" tags..."
# Negate the result so process exits with 1 if anything found
! egrep -irn -A 1 --include=*.go "Action.+needed.+in.+release:.+$VERSION" ./

- uses: actions/checkout@v2

- uses: ./.github/actions/setup-go
with:
go-version: 1.17

- name: Check dependencies
run: ./gomod.sh

- name: Build binaries
run: go run ./support/scripts/build_release_artifacts/main.go

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
2opremio marked this conversation as resolved.
Show resolved Hide resolved
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
# TODO: Replaced with a phony value until we disable the CircleCI jobs
# file: ./dist/*
file: thisfiledoesntexist
file_glob: true
overwrite: true

push-horizon-image:
runs-on: ubuntu-latest
name: Push stellar/horizon:{version,latest} to DockerHub
steps:
- uses: actions/checkout@v2

- name: Extract Horizon version
shell: bash
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF_NAME#horizon-v}

- name: Login to DockerHub
uses: docker/login-action@v1
2opremio marked this conversation as resolved.
Show resolved Hide resolved
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
2opremio marked this conversation as resolved.
Show resolved Hide resolved

- name: Build and push to DockerHub
uses: docker/build-push-action@v2
with:
# TODO: Commented out until we disable the CircleCI jobs
# push: true
# TODO(fons): pushing stellar/horizon:latest should be reviewed and manually approved.
# We might not want the latest tag here being pushed on every release.
# We might release a patch for older versions of horizon.
# Otherwise, if we are currently on e.g. v1.6.1 and need to release v1.5.3, v1.5.3 will become latest.
2opremio marked this conversation as resolved.
Show resolved Hide resolved
tags: stellar/horizon:latest,stellar/horizon:${{ steps.get_version.outputs.VERSION }}
file: services/horizon/docker/Dockerfile.dev
25 changes: 25 additions & 0 deletions .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:

integration:
name: Integration tests
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -62,3 +63,27 @@ jobs:
run: echo 'HORIZON_INTEGRATION_ENABLE_CAPTIVE_CORE_USE_DB=true' >> $GITHUB_ENV
- run: go test -race -timeout 25m -v ./services/horizon/internal/integration/...

verify-range:
name: Test (and push) verify-range image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build and test the Verify Range Docker image
run: |
docker build -f services/horizon/docker/verify-range/Dockerfile -t stellar/horizon-verify-range services/horizon/docker/verify-range/
# Any range should do for basic testing, this range was chosen pretty early in history so that it only takes a few mins to run
docker run -e BRANCH=$(git rev-parse --short HEAD) -e FROM=10000063 -e TO=10000127 stellar/horizon-verify-range

# Push
- if: ${{ github.ref == 'master' }}
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- if: ${{ github.ref == 'master' }}
name: Push to DockerHub
# TODO(fons): Commented out until we disable the CircleCI jobs
run: \# docker push stellar/horizon-verify-range:latest

4 changes: 2 additions & 2 deletions services/horizon/docker/verify-range/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "deb https://apt.stellar.org $(lsb_release -cs) unstable" | sudo tee -a /et
apt-get update
apt-get install -y stellar-core=${STELLAR_CORE_VERSION}

wget https://dl.google.com/go/go1.17.linux-amd64.tar.gz
wget -q https://dl.google.com/go/go1.17.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz

# configure postgres
Expand All @@ -25,5 +25,5 @@ cd stellar-go
# By default "git fetch" only fetches refs/<branchname>
# Below ensures we also fetch PR refs
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pull/*"
git fetch --force --quiet origin
git fetch --force origin
/usr/local/go/bin/go build -v ./services/horizon