refactor: simplify julia command to run tests #14
This file contains 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
name: CI Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
# Commits with 'no-ci' in the message prevent the workflow from running | |
# This is useful when commiting non code files, like the README for example | |
if: ${{ !contains(github.event.head_commit.message, 'no-ci') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Necessary for commits message check | |
# Set up Julia | |
- name: Set up Julia | |
uses: julia-actions/setup-julia@v2 | |
with: | |
version: '1.10.2' # Specify the Julia version here; use '1.x' for the latest stable version | |
# Prepare for testing | |
- name: Install dependencies and precompile the application | |
run: | | |
julia --project -e " / | |
using Pkg; / | |
Pkg.instantiate(); / | |
Pkg.precompile(); " | |
# Run your application's tests | |
- name: Run tests | |
run: | | |
julia --project test/runtests.jl | |
# Log in to GitHub Container Registry | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and tag your Docker application | |
- name: Build and tag the Docker image | |
run: | | |
docker build . --file Dockerfile --tag ghcr.io/aircentre/julia-web-app-example | |
# Push the Docker image to GitHub Container Registry | |
- name: Push the Docker image to ghcr.io | |
run: | | |
docker push ghcr.io/aircentre/julia-web-app-example |