-
Notifications
You must be signed in to change notification settings - Fork 50
[Experiment] Enable GitHub Actions #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
231c6da
Add GH Actions workflow
thomashoneyman 3fcef12
Run on push
thomashoneyman 2a61b4f
Run on push, pull request
thomashoneyman abaa25d
Fix release job
thomashoneyman d86bde1
Fix client
thomashoneyman c8684f1
Update bundle names
thomashoneyman 42206e8
Add cache, temporarily enable release steps
thomashoneyman b0882f5
Remove setup-ghc options and extend timeout
thomashoneyman 7e28af4
Use persisted artifacts
thomashoneyman 7c30eca
Set short retention period
thomashoneyman 145f761
Move env to top level
thomashoneyman 2c7192e
Adjust cache
thomashoneyman 43eb83c
Adjust cache again
thomashoneyman e5534b9
Remove if checks
thomashoneyman e11c653
Add names to upload-artifact
thomashoneyman 0f62899
Enable if checks
thomashoneyman 8869878
Pin stack version as is done with the compiler
thomashoneyman 83a44c5
Update ci.yml
thomashoneyman 7a9ef5b
Update ci.yml
thomashoneyman b3bb261
Update changelog
thomashoneyman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
release: | ||
types: [published] | ||
|
||
|
||
env: | ||
SERVER_ASSET: trypurescript-server | ||
CLIENT_ASSET: trypurescript-client | ||
|
||
jobs: | ||
build_server: | ||
name: Build server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: haskell/actions/setup@v1 | ||
with: | ||
enable-stack: true | ||
stack-version: "2.5.1" | ||
stack-no-global: true | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.stack | ||
.stack-work | ||
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-stack | ||
|
||
- name: Build server code | ||
run: | | ||
stack --no-terminal -j1 build | ||
|
||
- name: Build server assets | ||
if: github.event_name == 'release' | ||
run: | | ||
mkdir ${{ env.SERVER_ASSET }} | ||
cp $(stack path --dist-dir)/build/trypurescript/trypurescript ${{ env.SERVER_ASSET }}/ | ||
cp LICENSE ${{ env.SERVER_ASSET }}/ | ||
cp -r deploy/ ${{ env.SERVER_ASSET }}/ | ||
cp -r staging/ ${{ env.SERVER_ASSET}}/ | ||
tar czf ${{ env.SERVER_ASSET }}.tar.gz -C ${{ env.SERVER_ASSET }}/ . | ||
|
||
- name: Persist server assets | ||
uses: actions/upload-artifact@v2 | ||
if: github.event_name == 'release' | ||
with: | ||
name: ${{ env.SERVER_ASSET }}.tar.gz | ||
path: ${{ env.SERVER_ASSET }}.tar.gz | ||
retention-days: 1 | ||
|
||
build_client: | ||
name: Build client | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
|
||
- name: Build client code | ||
run: | | ||
cd client | ||
npm install | ||
npm run build | ||
npm run test | ||
npm run build:production | ||
|
||
- name: Build client assets | ||
if: github.event_name == 'release' | ||
run: | | ||
mkdir ${{ env.CLIENT_ASSET }} | ||
cp LICENSE ${{ env.CLIENT_ASSET }}/ | ||
cp -r client/public/ ${{ env.CLIENT_ASSET }}/ | ||
tar czf ${{ env.CLIENT_ASSET }}.tar.gz -C ${{ env.CLIENT_ASSET }}/ . | ||
|
||
- name: Persist client assets | ||
uses: actions/upload-artifact@v2 | ||
if: github.event_name == 'release' | ||
with: | ||
name: ${{ env.CLIENT_ASSET }}.tar.gz | ||
path: ${{ env.CLIENT_ASSET }}.tar.gz | ||
retention-days: 1 | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
needs: | ||
- build_server | ||
- build_client | ||
steps: | ||
- name: Retrieve server assets | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.SERVER_ASSET }}.tar.gz | ||
|
||
- name: Retrieve client assets | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.CLIENT_ASSET }}.tar.gz | ||
|
||
- name: Upload server and client assets | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
${{ env.SERVER_ASSET }}.tar.gz | ||
${{ env.CLIENT_ASSET }}.tar.gz |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.