rename file so it less deceptive #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Unit Tests and Deploy if Successful | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
AWS_REGION: eu-west-1 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 1.11.3.1463 | |
- name: Test Clojure | |
run: clojure -M:test | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 1.11.3.1463 | |
clj-kondo: 2022.10.05 | |
- name: Lint | |
run: clj-kondo --lint deps.edn src resources test | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.repository == 'xtdb/xt-fiddle' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Prepare java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Clojure | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 1.11.3.1463 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'yarn' | |
- name: Install yarn deps | |
run: yarn install --frozen-lockfile | |
- name: Cache clojure dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.deps.clj | |
key: cljdeps-${{ hashFiles('deps.edn') }} | |
# key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} | |
restore-keys: cljdeps- | |
- name: Build jar | |
run: clojure -T:build jar | |
- name: upload to s3 | |
id: upload | |
run: | | |
mv target/lib-*.jar xt-play.jar | |
version=$(aws s3api put-object --body xt-play.jar --bucket xt-play-lambda-code --key xt-play.jar --output text --query VersionId) | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
- name: Deploy to AWS CloudFormation | |
uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
with: | |
name: 'xt-play--lambda' | |
template: cloudformation/03-lambda.yml | |
parameter-overrides: "PlayCodeVersion=${{ steps.upload.outputs.version }}" |