Skip to content

Commit

Permalink
Update & simplify github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Apr 24, 2024
1 parent c9b1571 commit 2cac684
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 143 deletions.
145 changes: 71 additions & 74 deletions .github/workflows/continuous-deployment-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,40 @@ on:
jobs:
test:
name: Test
runs-on: ubuntu-20.04
container:
# Source: https://github.com/day8/dockerfiles-for-dev-ci-images
image: ghcr.io/day8/chrome-56:2
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v1
- name: Maven cache
id: maven-cache
uses: actions/cache@v1

- name: Setup java
uses: actions/setup-java@v3
with:
path: /root/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj', '.github/workflows/**') }}
restore-keys: |
${{ runner.os }}-maven-
- name: npm cache
uses: actions/cache@v1
distribution: 'temurin'
java-version: '21'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('project.clj') }}-${{ hashFiles('**/deps.cljs') }}
restore-keys: |
${{ runner.os }}-npm-
- name: shadow-cljs compiler cache
uses: actions/cache@v1
cli: 'latest'
bb: 'latest'

- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: .shadow-cljs
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
restore-keys: |
${{ runner.os }}-shadow-cljs-
- if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
lein ci
lein prod-once
- if: steps.maven-cache.outputs.cache-hit == 'true'
run: |
lein -o ci
lein -o prod-once
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
~/.npm
.shadow-cljs
key: cljdeps-${{ hashFiles('deps.edn') }}-${{ hashFiles ('package.json') }}-${{ hashFiles ('package-lock.json') }}
restore-keys: cljdeps-

- name: Fix git dubious directory ownership error
run: git config --global --add safe.directory /__w/re-com/re-com

- run: lein prod-once

- name: Slack notification
uses: homoluctus/[email protected]
if: failure() || cancelled()
Expand All @@ -56,68 +51,70 @@ jobs:
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
needs: test
runs-on: ubuntu-20.04
container:
# Source: https://github.com/day8/dockerfiles-for-dev-ci-images
image: ghcr.io/day8/chrome-56:2
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}

steps:
- uses: actions/checkout@v1
- name: Maven cache
id: maven-cache
uses: actions/cache@v1

- name: Setup java
uses: actions/setup-java@v3
with:
path: /root/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj', '.github/workflows/**') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run lein release
if: steps.maven-cache.outputs.cache-hit != 'true'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
lein release
- name: Run lein -o release
if: steps.maven-cache.outputs.cache-hit == 'true'
distribution: 'temurin'
java-version: '21'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 'latest'
bb: 'latest'

- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
~/.npm
.shadow-cljs
key: cljdeps-${{ hashFiles('deps.edn') }}-${{ hashFiles ('package.json') }}-${{ hashFiles ('package-lock.json') }}
restore-keys: cljdeps-

- run: lein release
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
lein -o release

# This creates a 'GitHub Release' from the tag and includes link to CHANGELOG.md at the current
# git ref. We do not use draft or prerelease features as we always want
# the latest release to show in the right hand column of the project page regardless
# of if it is a stable release.
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
[Changelog](https://github.com/day8/re-com/blob/master/CHANGELOG.md)
draft: false
prerelease: false
# - name: Create GitHub Release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# release_name: ${{ github.ref }}
# body: |
# [Changelog](https://github.com/day8/re-com/blob/master/CHANGELOG.md)
# draft: false
# prerelease: false

- name: Slack notification
uses: homoluctus/[email protected]
if: always()
Expand Down
71 changes: 36 additions & 35 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,52 @@ name: ci
on: [push]

jobs:

test:

name: Test
runs-on: ubuntu-20.04
container:
# Source: https://github.com/day8/dockerfiles-for-dev-ci-images
image: ghcr.io/day8/chrome-56:2
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v1
- name: Maven cache
uses: actions/cache@v1
id: maven-cache

- name: Setup java
uses: actions/setup-java@v3
with:
path: /root/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj', 'deps.edn', '.github/workflows/**') }}
restore-keys: |
${{ runner.os }}-maven-
- name: npm cache
uses: actions/cache@v1
distribution: 'temurin'
java-version: '21'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package.json', 'package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: shadow-cljs compiler cache
uses: actions/cache@v1
cli: 'latest'
bb: 'latest'

- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: .shadow-cljs
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
restore-keys: |
${{ runner.os }}-shadow-cljs-
- if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
lein ci
lein build-report-ci
- if: steps.maven-cache.outputs.cache-hit == 'true'
run: |
lein -o ci
lein -o build-report-ci
- uses: actions/upload-artifact@v2
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
~/.npm
.shadow-cljs
key: cljdeps-${{ hashFiles('deps.edn') }}-${{ hashFiles ('package.json') }}-${{ hashFiles ('package-lock.json') }}
restore-keys: cljdeps-

- name: Fix git dubious directory ownership error
run: git config --global --add safe.directory /__w/re-com/re-com

- run: bb ci

- run: bb build-report-ci

- uses: actions/upload-artifact@v4
with:
name: build-report
path: target/build-report.html

- name: Slack notification
uses: homoluctus/[email protected]
if: failure() || cancelled()
Expand Down
62 changes: 29 additions & 33 deletions .github/workflows/docs-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,42 @@ on:
jobs:
deploy:
name: Deploy
runs-on: ubuntu-20.04
container:
# Source: https://github.com/day8/dockerfiles-for-dev-ci-images
image: ghcr.io/day8/chrome-56:2
runs-on: ubuntu-22.04

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}

steps:
- uses: actions/checkout@v1
- name: Maven cache
id: maven-cache
uses: actions/cache@v1

- name: Setup java
uses: actions/setup-java@v3
with:
path: /root/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: npm cache
uses: actions/cache@v1
distribution: 'temurin'
java-version: '21'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('project.clj') }}-${{ hashFiles('**/deps.cljs') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Run lein deploy-aws
if: steps.maven-cache.outputs.cache-hit != 'true'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_EC2_METADATA_DISABLED: true
run: |
lein deploy-aws
- name: Run lein -o deploy-aws
if: steps.maven-cache.outputs.cache-hit == 'true'
cli: 'latest'
bb: 'latest'

- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
~/.npm
.shadow-cljs
key: cljdeps-${{ hashFiles('deps.edn') }}-${{ hashFiles ('package.json') }}-${{ hashFiles ('package-lock.json') }}
restore-keys: cljdeps-

- run: bb deploy-aws
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -55,8 +51,7 @@ jobs:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_EC2_METADATA_DISABLED: true
run: |
lein -o deploy-aws

- name: Invalidate CloudFront Distribution
uses: chetan/invalidate-cloudfront-action@master
env:
Expand All @@ -65,6 +60,7 @@ jobs:
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Slack notification
uses: homoluctus/[email protected]
if: always()
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

> Committed but unreleased changes are put here, at the top. Older releases are detailed chronologically below.
## 2.21.0 (2024-04-24)

#### Added

- New tooling, using `bb.edn` and `deps.edn`.


## 2.20.0 (2024-04-23)

#### Added
Expand Down
Loading

0 comments on commit 2cac684

Please sign in to comment.