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

PNE-6228: Replace Travis CI with Github Actions #320

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
103 changes: 103 additions & 0 deletions .github/workflows/merge_workflow.yml
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:
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

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 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The 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)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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/')
79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

Loading