diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..377927a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +name: Platformics CI + +on: + push + +jobs: + cancel-previous: + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + build-and-test: + name: build and test + runs-on: ubuntu-latest + + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: install poetry + run: | + python -m pip install --no-cache-dir poetry==1.8 supervisor + + - name: set up docker + run: | + make gha-setup + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: build docker image and push to gchr.io + run: | + TAG=$(git describe --long --tags --always --dirty) + IMAGE_NAME=platformics + IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}" + + make build + + docker push "${IMAGE_URI}:${TAG}" + + if [[ ${GITHUB_REF##*/} == "main" ]]; then + docker tag "${IMAGE_URI}:${TAG}" "${IMAGE_URI}:latest" + docker push "${IMAGE_URI}:latest" + fi + + - name: run tests + run: | + make test diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml deleted file mode 100644 index 3a17e7e..0000000 --- a/.github/workflows/run_tests.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Run tests on push" - -on: - push: - branches: - - '**' - -jobs: - pytest: - name: "Pytest" - runs-on: ubuntu-latest - - steps: - - name: "Checkout code" - uses: actions/checkout@v4 - - name: "Set up Python" - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: "Install poetry" - run: | - python -m pip install --no-cache-dir poetry==1.8 supervisor - - - name: "Set up docker" - run: | - make gha-setup - - - - - - name: "Run tests" - run: | - make test