Skip to content
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

Dockerize #2059

Merged
merged 2 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v6
- uses: olafurpg/setup-scala@v7
with:
java-version: ${{ matrix.java }}
- run: git fetch --tags
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v6
- uses: olafurpg/setup-scala@v7
- run: ./scalafmt --test
- run: yarn install
- run: yarn format-check
Expand All @@ -47,17 +47,20 @@ jobs:
include:
- os: macOS-latest
artifact: scalafmt-macos
env:
NATIVE_IMAGE_STATIC: false
- os: ubuntu-latest
libc: default
artifact: scalafmt-linux-glibc
env:
- NATIVE_IMAGE_STATIC: true
NATIVE_IMAGE_STATIC: true
- os: ubuntu-latest
libc: musl
artifact: scalafmt-linux-musl
env:
- NATIVE_IMAGE_STATIC: true
- NATIVE_IMAGE_MUSL: ${GITHUB_WORKSPACE}/bundle
NATIVE_IMAGE_STATIC: true
NATIVE_IMAGE_MUSL: /home/runner/work/scalafmt/scalafmt/bundle
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v7
Expand All @@ -68,11 +71,27 @@ jobs:
run: |
wget https://github.com/gradinac/musl-bundle-example/releases/download/v1.0/musl.tar.gz
tar xvf musl.tar.gz

- run: bin/build-native-image.sh
env:
CI: true
- uses: actions/upload-artifact@master
with:
name: ${{ matrix.artifact }}
path: scalafmt
dockerize:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it push new image on every PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, with a custom tag (refs/pull/2/merge | pr-2-merge)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please configure it as dedicated workflow running only on tags push?

on:
  push:
    branches: [master]
    tags: ["*"]

Image creation on every PR would be redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to add this flow only for tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added condition for tags only.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I will test it on next release

needs: [native-image,test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- run: git fetch --unshallow
- uses: actions/download-artifact@v1
with:
name: scalafmt-linux-musl
path: tmp/scalafmt-linux-musl
- uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: scalameta/scalafmt
tag_with_ref: true
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine

COPY tmp/scalafmt-linux-musl/scalafmt /bin/scalafmt
RUN chmod +x /bin/scalafmt

ENTRYPOINT ["/bin/scalafmt"]