-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jaronoff97/cleanup-and-actions
Much cleanup, new actions
- Loading branch information
Showing
28 changed files
with
380 additions
and
159 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Elixir CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
env: | ||
MIX_ENV: test | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
analysis: | ||
runs-on: ubuntu-latest | ||
name: Static analysis for ${{matrix.otp}} / Elixir ${{matrix.elixir}} | ||
strategy: | ||
# Specify the OTP and Elixir versions to use when building | ||
# and running the workflow steps. | ||
matrix: | ||
otp: ["26.0"] # Define the OTP version [required] | ||
elixir: ["1.16"] # Define the elixir version [required] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{matrix.otp}} | ||
elixir-version: ${{matrix.elixir}} | ||
|
||
- name: Restore dependencies cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-elixir-deps | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ env.cache-name }}- | ||
# Step: Download project dependencies. If unchanged, uses | ||
# the cached version. | ||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
# Cache key based on Erlang/Elixir version and the mix.lock hash | ||
- name: Restore PLT cache | ||
id: plt_cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
key: | | ||
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}- | ||
path: | | ||
priv/plts | ||
# Create PLTs if no cache was found | ||
- name: Create PLTs | ||
if: steps.plt_cache.outputs.cache-hit != 'true' | ||
run: mix dialyzer --plt | ||
|
||
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed, | ||
# so we separate the cache restore and save steps in case running dialyzer fails. | ||
- name: Save PLT cache | ||
id: plt_cache_save | ||
uses: actions/cache/save@v3 | ||
if: steps.plt_cache.outputs.cache-hit != 'true' | ||
with: | ||
key: | | ||
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} | ||
path: | | ||
priv/plts | ||
- name: Run dialyzer | ||
run: mix dialyzer --format github | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} | ||
strategy: | ||
# Specify the OTP and Elixir versions to use when building | ||
# and running the workflow steps. | ||
matrix: | ||
otp: ["26.0"] # Define the OTP version [required] | ||
elixir: ["1.16"] # Define the elixir version [required] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{matrix.otp}} | ||
elixir-version: ${{matrix.elixir}} | ||
- name: Restore dependencies cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-elixir-deps | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ env.cache-name }}- | ||
- name: Cache compiled build | ||
id: cache-build | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-compiled-build | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ env.cache-name }}- | ||
${{ runner.os }}-mix- | ||
# Step: Download project dependencies. If unchanged, uses | ||
# the cached version. | ||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
# Step: Compile the project treating any warnings as errors. | ||
# Customize this step if a different behavior is desired. | ||
- name: Compiles without warnings | ||
run: mix compile --warnings-as-errors | ||
|
||
# Step: Check that the checked in code has already been formatted. | ||
# This step fails if something was found unformatted. | ||
# Customize this step as desired. | ||
- name: Check Formatting | ||
run: mix format --check-formatted | ||
|
||
# Step: Execute the tests. | ||
- name: Run tests | ||
run: mix test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Create and publish a Docker image | ||
|
||
# Configures this workflow to run every time a change is pushed to the branch called `release`. | ||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
# | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.