Skip to content

Commit

Permalink
Add pipeline to publish project
Browse files Browse the repository at this point in the history
  • Loading branch information
Qluxzz committed Oct 26, 2024
1 parent 0537104 commit 68283ad
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
on:
push:
branches:
- "main"

jobs:
test:
name: Run test suite
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: jorelali/setup-elm@v6
with:
elm-version: 0.19.1

- name: Run elm tests
run: npx elm-test --report="junit" > test-results.xml

- name: Test Summary
uses: test-summary/action@v2
with:
paths: "test-results.xml"
if: always()
build:
name: Build and minimize Elm
runs-on: ubuntu-22.04
needs: test

steps:
- uses: actions/checkout@v4
- uses: jorelali/setup-elm@v6
with:
elm-version: 0.19.1
- name: Compile Elm to JS
run: elm make src/Main.elm --optimize --output elm.js

- name: Tree shake and minimize compiled js
run: |
npx uglify-js elm.js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,unsafe_comps,unsafe' --mangle 'reserved=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9]' --output elm.min.js
- name: Move to build directory
run: |
mkdir build
mv elm.min.js build/elm.js
mv index.html build/
mv style.css build/
- name: Upload production artifacts
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: build/

# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Elm Black Jack

An implementation of Black Jack in Elm

## Testing

This program uses [elm-program-test](https://github.com/avh4/elm-program-test) to test the application logic in addition to using just regular elm-test for unit tests.

0 comments on commit 68283ad

Please sign in to comment.