mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-22 10:10:12 +00:00
Move to GHA for PR, BUILD, DOCS (#982)
Much of this PR was generated using sbt-github-actions that I modified slightly to run our func tests in parallel, as well as publish to code cov. 1. `ci.yml` - this is most of the normal build 2. `clean.yml` - this was generated by sbt-github-actions so I kept it 3. `publish-site.yml` - this will build and publish our microsite on merge to master
This commit is contained in:
parent
ecac2cc565
commit
cfe9f0deae
137
.github/workflows/ci.yml
vendored
Normal file
137
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
# Much copied from sbt-github-actions, modified to support running e2e tests
|
||||
name: Continuous Integration
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
push:
|
||||
branches: ['master']
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
scala: [2.12.10]
|
||||
java: [adopt@1.11]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout current branch (full)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java and Scala
|
||||
uses: olafurpg/setup-scala@v5
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- name: Cache ivy2
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.ivy2/cache
|
||||
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (generic)
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.coursier/cache/v1
|
||||
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (linux)
|
||||
if: contains(runner.os, 'linux')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (macOS)
|
||||
if: contains(runner.os, 'macos')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/Library/Caches/Coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (windows)
|
||||
if: contains(runner.os, 'windows')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/AppData/Local/Coursier/Cache/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache sbt
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.sbt
|
||||
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- run: sbt ++${{ matrix.scala }} validate verify
|
||||
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
fail_ci_if_error: true # optional (default = false)
|
||||
|
||||
func:
|
||||
name: Func Test
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
scala: [2.12.10]
|
||||
java: [adopt@1.11]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout current branch (full)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java and Scala
|
||||
uses: olafurpg/setup-scala@v5
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- name: Cache ivy2
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.ivy2/cache
|
||||
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (generic)
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.coursier/cache/v1
|
||||
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (linux)
|
||||
if: contains(runner.os, 'linux')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (macOS)
|
||||
if: contains(runner.os, 'macos')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/Library/Caches/Coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (windows)
|
||||
if: contains(runner.os, 'windows')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/AppData/Local/Coursier/Cache/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache sbt
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.sbt
|
||||
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
- name: Func tests
|
||||
run: ./bin/func-test-portal.sh && ./bin/func-test-api-travis.sh
|
55
.github/workflows/clean.yml
vendored
Normal file
55
.github/workflows/clean.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
# This file was automatically generated by sbt-github-actions using the
|
||||
# githubWorkflowGenerate task. Kept it here
|
||||
|
||||
name: Clean
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
delete-artifacts:
|
||||
name: Delete Artifacts
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Delete artifacts
|
||||
run: |
|
||||
# Customize those three lines with your repository and credentials:
|
||||
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
|
||||
|
||||
# A shortcut to call GitHub API.
|
||||
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
|
||||
|
||||
# A temporary file which receives HTTP response headers.
|
||||
TMPFILE=/tmp/tmp.$$
|
||||
|
||||
# An associative array, key: artifact name, value: number of artifacts of that name.
|
||||
declare -A ARTCOUNT
|
||||
|
||||
# Process all artifacts on this repository, loop on returned "pages".
|
||||
URL=$REPO/actions/artifacts
|
||||
while [[ -n "$URL" ]]; do
|
||||
|
||||
# Get current page, get response headers in a temporary file.
|
||||
JSON=$(ghapi --dump-header $TMPFILE "$URL")
|
||||
|
||||
# Get URL of next page. Will be empty if we are at the last page.
|
||||
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
|
||||
rm -f $TMPFILE
|
||||
|
||||
# Number of artifacts on this page:
|
||||
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
|
||||
|
||||
# Loop on all artifacts on this page.
|
||||
for ((i=0; $i < $COUNT; i++)); do
|
||||
|
||||
# Get name of artifact and count instances of this name.
|
||||
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
|
||||
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
|
||||
|
||||
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
|
||||
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
|
||||
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
|
||||
ghapi -X DELETE $REPO/actions/artifacts/$id
|
||||
done
|
||||
done
|
82
.github/workflows/publish-site.yml
vendored
Normal file
82
.github/workflows/publish-site.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
# Generates the microsite on push to master
|
||||
# Relies on the SBT_MICROSITES_PUBLISH_TOKEN secret to be setup
|
||||
# as a Github secret
|
||||
name: Microsite
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
site:
|
||||
name: Publish Site
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
scala: [2.12.10]
|
||||
java: [adopt@1.11]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout current branch (full)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java and Scala
|
||||
uses: olafurpg/setup-scala@v5
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- name: Cache ivy2
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.ivy2/cache
|
||||
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (generic)
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.coursier/cache/v1
|
||||
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (linux)
|
||||
if: contains(runner.os, 'linux')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (macOS)
|
||||
if: contains(runner.os, 'macos')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/Library/Caches/Coursier/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache coursier (windows)
|
||||
if: contains(runner.os, 'windows')
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/AppData/Local/Coursier/Cache/v1
|
||||
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Cache sbt
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.sbt
|
||||
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
sudo apt install libxslt-dev &&
|
||||
gem install sass jekyll:4.0.0
|
||||
|
||||
- run: sbt ++${{ matrix.scala }} ";project docs; publishMicrosite";
|
||||
env:
|
||||
SBT_MICROSITES_PUBLISH_TOKEN: ${{ secrets.VINYLDNS_MICROSITE }}
|
Loading…
x
Reference in New Issue
Block a user