-
Notifications
You must be signed in to change notification settings - Fork 12
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
PNE-6228: Replace Travis CI with Github Actions #320
Changes from 2 commits
b5bad2d
05ad6e6
863c0d5
5c72e07
c60bee9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: ['*'] | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
SCALA_VERSION: 2.13.8 | ||
JAVA_VERSION: 11 | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
test-type: ['scala', 'python'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK | ||
if: matrix.test-type == 'scala' | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these env vars set? I don't see them. Same with the secrets you reference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I just have them set in the yml itself |
||
distribution: 'adopt' | ||
- name: Cache SBT dependencies | ||
if: matrix.test-type == 'scala' | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.ivy2/cache | ||
~/.sbt | ||
~/.m2 | ||
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }} | ||
- name: Run Scala tests | ||
if: matrix.test-type == 'scala' | ||
run: | | ||
sbt -Dsbt.log.noformat=true scalafmtCheckAll | ||
sbt -Dsbt.log.noformat=true +test | ||
- name: Set up Python | ||
if: matrix.test-type == 'python' | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Cache pip dependencies | ||
if: matrix.test-type == 'python' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
- name: Install Python dependencies | ||
if: matrix.test-type == 'python' | ||
run: | | ||
cd python | ||
make | ||
pip install --only-binary=numpy,scipy -r requirements.txt | ||
pip install -r test_requirements.txt | ||
- name: Run Python tests | ||
if: matrix.test-type == 'python' | ||
run: | | ||
cd python | ||
nosetests | ||
|
||
release: | ||
needs: test | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: 'adopt' | ||
- name: Release to Maven Central | ||
env: | ||
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are these secrets? Have you set them? How do they get used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are for deploying and they are set in Github |
||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
run: sbt ci-release | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies for PyPI release | ||
run: | | ||
sudo apt-get install -y pandoc | ||
cd python | ||
make | ||
pip install --only-binary=numpy,scipy -r requirements.txt | ||
- name: Build and publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the same token as from the repo used by our other python libraries (citrine-python & gemd-python)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes but I dont think you can share them across our libraries |
||
run: | | ||
cd python | ||
python setup.py sdist bdist_wheel | ||
pip install twine | ||
twine upload dist/* | ||
if: startsWith(github.ref, 'refs/tags/') |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a matrix here feels a bit awkward since you need custom logic for each. Might be more clear to have two separate jobs that run in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I split into separate jobs.