Skip to content

Commit

Permalink
Merge pull request #5 from permutive-engineering/build/revamp
Browse files Browse the repository at this point in the history
Revamp build & dependencies
  • Loading branch information
alejandrohdezma authored Apr 23, 2024
2 parents 92b2ea2 + 7ad44bc commit e914e10
Show file tree
Hide file tree
Showing 39 changed files with 826 additions and 602 deletions.
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @permutive-engineering/developer-experience
2 changes: 1 addition & 1 deletion LICENSE → .github/docs/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright (C) @YEAR_RANGE@ @COPYRIGHT_OWNER@

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
28 changes: 28 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Don't edit this file!
# It is automatically updated after every release of https://github.com/alejandrohdezma/sbt-ci
# If you want to suggest a change, please open a PR or issue in that repository

# This file contains the template for the "auto-generated release notes"

changelog:
exclude:
labels:
- ":chart_with_upwards_trend: dependency-update"
authors:
- dependabot
categories:
- title: "⚠️ Breaking changes"
labels:
- ":warning: breaking"
- title: "🚀 New features"
labels:
- ":rocket: feature"
- title: "📘 Documentation updates"
labels:
- ":blue_book: documentation"
- title: "🐛 Bug fixes"
labels:
- ":beetle: bug"
- title: Other Changes
labels:
- "*"
224 changes: 60 additions & 164 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,178 +1,74 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Continuous Integration
# Don't edit this file!
# It is automatically updated after every release of https://github.com/alejandrohdezma/sbt-ci
# If you want to suggest a change, please open a PR or issue in that repository

# Runs `sbt ci-test` on the project on differnt JDKs (this task should be added to the project as a command alias
# containing the necessary steps to compile, check formatters, launch tests...).
#
# Examples of this `ci-test` alias can be found [here](https://github.com/search?q=org%3Aalejandrohdezma+%22ci-test%22+path%3Abuild.sbt++NOT+is%3Aarchived&type=code).
#
# It will also do the following:
#
# - It will automatically label PRs based on head branch.
# - It will automatically enable auto-merge on `Scala Steward` PRs. You'll need to add a `STEWARD_BOT` repository or
# organization variable with the name of your scala-steward bot. See https://docs.github.com/en/actions/learn-github-actions/variables.

name: CI

on:
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
types: [opened, reopened, labeled, unlabeled, synchronize]

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10, 3.2.1]
java: [temurin@8]
project: [rootJVM]
runs-on: ${{ matrix.os }}
labeler:
if: github.event.pull_request.state == 'OPEN' && github.actor != 'dependabot[bot]'
name: Labeler
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target .js/target log4cats-odin/target odin-testing/target odin-slf4j-bridge/target .jvm/target .native/target odin-dynamic/target odin-slf4j-bridge-benchmarks/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar target .js/target log4cats-odin/target odin-testing/target odin-slf4j-bridge/target .jvm/target .native/target odin-dynamic/target odin-slf4j-bridge-benchmarks/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
- name: Update PR labels
uses: alejandrohdezma/actions/labeler@v1
if: github.event.pull_request.head.repo.full_name == github.repository

- name: Check PR labels
uses: alejandrohdezma/actions/label-check@v1

ci-steward:
if: |
github.event.pull_request.state == 'OPEN' && github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login == vars.STEWARD_BOT
name: (Scala Steward) Enable auto-merge
runs-on: ubuntu-latest
steps:
- name: Enable auto-merge for this PR
run: gh pr merge --auto --merge ${{github.event.pull_request.number}} -R "$GITHUB_REPOSITORY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
needs: [ci-steward]
if: |
always() && !contains(needs.*.result, 'failure') && github.event.pull_request.state == 'OPEN' &&
github.actor != 'dependabot[bot]'
name: Run "sbt ci-test" on JDK ${{ matrix.jdk }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
runs-on: ${{ matrix.os }}
jdk:
- 11
- 17
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
- name: Checkout project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.10, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM

- name: Inflate target directories (2.13.10, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.1, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJVM

- name: Inflate target directories (3.2.1, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
distribution: "liberica"
java-version: ${{ matrix.jdk }}
cache: "sbt"

- name: Publish
run: sbt '++ ${{ matrix.scala }}' tlRelease
- name: Run `sbt ci-test`
run: sbt ci-test
59 changes: 0 additions & 59 deletions .github/workflows/clean.yml

This file was deleted.

Loading

0 comments on commit e914e10

Please sign in to comment.