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

Add GitHub actions to build and upload #20

Merged
merged 28 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ca664a
wip
kxc-wraikny Feb 16, 2023
e289852
update Dockerfile to specify node version
kxc-wraikny Feb 16, 2023
a3fde6f
add actions
kxc-wraikny Feb 16, 2023
d1cde3a
fix env var
kxc-wraikny Feb 16, 2023
e859457
fix reference to DOCKER_TAG_BASE
kxc-wraikny Feb 16, 2023
a1f3ecc
fix context
kxc-wraikny Feb 16, 2023
15f9b4c
fix var name
kxc-wraikny Feb 16, 2023
a33cad3
add qemu and buildx
kxc-wraikny Feb 16, 2023
f6af9ee
change node-version to 18.14.1 LTS
kxc-wraikny Feb 17, 2023
c09577e
matrix build
kxc-wraikny Feb 17, 2023
27ee976
Merge branch 'main' into add-github-actions-to-build-and-upload
haochenx Feb 17, 2023
44d3f68
rename VAR to OCAML_VERSION
kxc-wraikny Feb 17, 2023
27fa79b
update matrix
kxc-wraikny Feb 17, 2023
4bece40
add step for alias
kxc-wraikny Feb 17, 2023
3c9583b
rename step
kxc-wraikny Feb 17, 2023
0a7d702
ocaml 5 is not supported yet
kxc-wraikny Feb 17, 2023
708f49c
fix typo
kxc-wraikny Feb 17, 2023
8b16e6e
fix condition
kxc-wraikny Feb 17, 2023
2bf7df9
fix cache key
kxc-wraikny Feb 17, 2023
bce41fb
ocaml-general - ci - prep for prime time
haochenx Feb 18, 2023
248fd60
ocaml-general - ci - fix
haochenx Feb 18, 2023
5d105da
ocaml-general - ci - potential opt
haochenx Feb 18, 2023
1f0c74b
ocaml-general - ci - potential opt - fix
haochenx Feb 18, 2023
eacc5c5
ocaml-general - ci - rename workflow
haochenx Feb 18, 2023
3a521d0
ocaml-general - ci - fix
haochenx Feb 18, 2023
40fffcd
ocaml-general - ci - split cache save and restore
haochenx Feb 18, 2023
cad06b9
Update .github/workflows/ocaml-general.yml
haochenx Feb 18, 2023
db858b1
move cache file before storing
kxc-wraikny Feb 19, 2023
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
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Deploy
on:
push:
branches: [ add-github-actions-to-build-and-upload ]
jobs:
build:
strategy:
matrix:
os:
- ubuntu.22.04
ocaml-version:
kxc-wraikny marked this conversation as resolved.
Show resolved Hide resolved
- 4.12.1
node-version:
- 14.21.3
kxc-wraikny marked this conversation as resolved.
Show resolved Hide resolved
- 16.19.1
- 18.14.1
- 19.6.1
arch:
- amd64
- arm64
env:
TAG_BASE: ${{ matrix.os }}-ocaml.${{ matrix.ocaml-version }}-node.${{ matrix.node-version }}
haochenx marked this conversation as resolved.
Show resolved Hide resolved
CACHE_DIR: /tmp/docker-cache

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
haochenx marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- run: mkdir -p ${{ env.CACHE_DIR }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: ${{ env.CACHE_DIR }}
key: ${{ runner.os }}-buildx-${{ env.TAG_BASE }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-${{ env.TAG_BASE }}
kxc-wraikny marked this conversation as resolved.
Show resolved Hide resolved

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push for linux/${{ matrix.arch }}
uses: docker/build-push-action@v4
with:
context: ocaml-general
push: false
platforms: linux/${{ matrix.arch }}
build-args: |
NODE_VERSION=${{ matrix.node-version }}
kxc-wraikny marked this conversation as resolved.
Show resolved Hide resolved
tags: |
ghcr.io/kxcteam/ocaml-general:${{ env.TAG_BASE }}-${{ matrix.arch }}
cache-from: type=local,src=${{ env.CACHE_DIR }}/.buildx-cache
cache-to: type=local,dest=${{ env.CACHE_DIR }}/.buildx-cache-new,mode=max

- name: Move cache
run: |
cd ${{ env.CACHE_DIR }}
rm -rf .buildx-cache
mv .buildx-cache-new .buildx-cache
3 changes: 2 additions & 1 deletion ocaml-general/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

ARG NODE_VERSION=latest
RUN npm install n -g && \
n latest && \
n $NODE_VERSION && \
apt-get purge -y npm

RUN npm install yarn -g
Expand Down