Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 16 additions & 9 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
name: Example Usage

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

permissions:
contents: read

jobs:
example:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Agda
id: setup-agda
uses: agda/agda-setup-action@v1
uses: agda/agda-setup-action@master
with:
agda-version: '2.8.0'
agda-stdlib-version: '2.3'

- name: Show Agda info
run: |
echo "Agda path: ${{ steps.setup-agda.outputs.agda-path }}"
echo "Agda dir: ${{ steps.setup-agda.outputs.agda-dir }}"
agda --version
- name: Create a simple Agda file
run: |
cat > Example.agda << 'EOF'
module Example where
open import Data.Bool.Base
open import Data.Nat.Base
example : Bool
example = true
EOF
- name: Type-check Agda file
run: agda Example.agda
29 changes: 12 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Test Action
on:
push:
branches:
- main
- master
- 'copilot/**'
pull_request:
branches:
- master
workflow_dispatch:

permissions:
Expand All @@ -16,16 +17,8 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
include:
- os: ubuntu-latest
agda-stdlib-version: '2.3'
- os: windows-latest
agda-stdlib-version: ''
- os: macos-latest
agda-stdlib-version: '2.3'
- os: macos-13
agda-stdlib-version: ''
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
agda-stdlib-version: ['2.3']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -43,17 +36,19 @@ jobs:
echo "Agda path: ${{ steps.setup.outputs.agda-path }}"
echo "Agda dir: ${{ steps.setup.outputs.agda-dir }}"
agda --version
- name: Create test file
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
cat > test.agda << 'EOF'
module test where
data Bool : Set where
true false : Bool
open import Data.Bool.Base
open import Data.Nat.Base
example : Bool
example = true
EOF
- name: Test Agda
if: matrix.os == 'ubuntu-latest'
run: agda test.agda
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2025, Agda Github Community
Copyright (c) 2025, Andreas Abel

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
51 changes: 29 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

GitHub composite action to install Agda from the official deployed binaries and optionally the Agda standard library.

It supports Agda 2.8.0 (and up).
For older Agda versions, please use [`wenkokke/setup-agda`](https://github.com/wenkokke/setup-agda).

## Features

- Installs Agda from official GitHub releases.
- Optional installation of the Agda standard library.
- Cross-platform support:
- Ubuntu (latest)
- Windows (latest)
- macOS (latest, including macOS-15-intel)
- Linux
- Windows
- macOS (ARM and x86)
- Outputs the path to the Agda executable and Agda application directory.

## Usage

### Basic Usage (Agda only)
### Basic Usage (default Agda version)

```yaml
- name: Setup Agda
uses: agda/agda-setup-action@v1
with:
agda-version: '2.8.0'
```

### With Standard Library
Expand Down Expand Up @@ -52,17 +53,22 @@ GitHub composite action to install Agda from the official deployed binaries and

## Inputs

| Name | Description | Required | Default |
|------|-------------|----------|---------|
| `agda-version` | Version of Agda to install (e.g., `2.8.0`) | Yes | - |
| `agda-stdlib-version` | Version of Agda standard library to install (e.g., `2.3`). If not specified, stdlib will not be installed. | No | `''` |
| Name | Description | Required | Default |
|-----------------------|-----------------------------------------------------------------------------------------------------------------|----------|---------|
| `agda-version` | Version of Agda to install (e.g., `2.8.0`) | Yes | `2.8.0` |
| `agda-stdlib-version` | Version of Agda standard library to install (e.g., `2.3`). If not specified, the library will not be installed. | No | `''` |

If the standard library is installed, it is also added to the default libraries:

- The path to `standard-library.agda-lib` is added to the `libraries` file in the Agda directory (`${{ steps.setup-agda.outputs.agda-dir }}`).
- The string `standard-library-${{ agda-stdlib-version }}` is added to the `defaults` file there.

## Outputs

| Name | Description |
|------|-------------|
| `agda-path` | Path to the Agda executable |
| `agda-dir` | Path to the Agda application directory |
| Name | Description |
|-------------|----------------------------------------|
| `agda-path` | Path to the Agda executable |
| `agda-dir` | Path to the Agda application directory |

## Example Workflow

Expand All @@ -74,30 +80,31 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Setup Agda
uses: agda/agda-setup-action@v1
with:
agda-version: '2.8.0'
agda-stdlib-version: '2.3'

- name: Build Agda files
run: agda Main.agda
```

## Platform Support

This action supports the following platforms:
- `ubuntu-latest`
- `windows-latest`
- `macos-latest`
- `macos-15-intel`

- Linux, e.g. `ubuntu-latest`
- Windows, e.g. `windows-latest`
- macOS ARM, e.g. `macos-latest`
- macOS x86, e.g. `macos-15-intel`

The action automatically detects the platform and downloads the appropriate binary for your runner.

## License

This project is licensed under the same terms as Agda itself.
This project is licensed under the BSD 3-clause license.
37 changes: 22 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: 'Setup Agda'
description: 'Install Agda from official releases and optionally the standard library'
author: 'Agda Team'
author: 'Andreas Abel'

inputs:
agda-version:
description: 'Version of Agda to install (e.g., 2.8.0)'
required: true
default: '2.8.0'
agda-stdlib-version:
description: 'Version of Agda standard library to install (e.g., 2.3). If not specified, stdlib will not be installed.'
description: 'Version of Agda standard library to install (e.g., 2.3). If not specified, the standard library will not be installed.'
required: false
default: ''

Expand Down Expand Up @@ -60,14 +61,14 @@ runs:
run: |
archive_name="${{ steps.platform.outputs.archive-name }}"
download_url="https://github.com/agda/agda/releases/download/v${{ inputs.agda-version }}/${archive_name}"

echo "Downloading Agda from: ${download_url}"
http_code=$(curl -w '%{http_code}\n' -L "${download_url}" -o "agda-archive.${{ steps.platform.outputs.archive-ext }}")
exit_code=$?

echo "curl exit code: ${exit_code}"
echo "curl http code: ${http_code}"

if [[ "${exit_code}" != "0" || "${http_code}" != "200" ]]; then
echo "Download of Agda archive failed."
exit 1
Expand Down Expand Up @@ -108,23 +109,23 @@ runs:
run: |
agda --version
agda --setup

if [[ "${{ runner.os }}" == "Windows" ]]; then
AGDA_DIR=$(agda --print-agda-app-dir | sed 's/\\/\//g')
else
AGDA_DIR=$(agda --print-agda-app-dir)
fi

mkdir -p "${AGDA_DIR}"
mkdir -p "${AGDA_DIR}/libraries.d"

# Find agda executable path
if [[ "${{ runner.os }}" == "Windows" ]]; then
AGDA_PATH=$(where agda | head -1)
else
AGDA_PATH=$(which agda)
fi

echo "agda-dir=${AGDA_DIR}" >> "${GITHUB_OUTPUT}"
echo "agda-path=${AGDA_PATH}" >> "${GITHUB_OUTPUT}"
echo "AGDA_DIR=${AGDA_DIR}" >> "${GITHUB_ENV}"
Expand All @@ -134,34 +135,40 @@ runs:
shell: bash
run: |
download_url="https://github.com/agda/agda-stdlib/archive/refs/tags/v${{ inputs.agda-stdlib-version }}.tar.gz"

echo "Downloading Agda standard library from: ${download_url}"
http_code=$(curl -w '%{http_code}\n' -L "${download_url}" -o "agda-stdlib.tar.gz")
exit_code=$?

echo "curl exit code: ${exit_code}"
echo "curl http code: ${http_code}"

if [[ "${exit_code}" != "0" || "${http_code}" != "200" ]]; then
echo "Download of Agda standard library archive failed."
exit 1
fi

tar xf agda-stdlib.tar.gz -C "${AGDA_DIR}/libraries.d/"

- name: Setup Agda standard library
if: inputs.agda-stdlib-version != ''
shell: bash
run: |
stdlib_path="${AGDA_DIR}/libraries.d/agda-stdlib-${{ inputs.agda-stdlib-version }}/standard-library.agda-lib"

if [[ ! -f "${stdlib_path}" ]]; then
echo "Standard library file not found at: ${stdlib_path}"
echo "Contents of libraries.d:"
ls -la "${AGDA_DIR}/libraries.d/"
exit 1
fi

echo "${stdlib_path}" >> "${AGDA_DIR}/libraries"
echo "Agda libraries file content:"
cat "${AGDA_DIR}/libraries"

- name: Make Agda standard library default
if: inputs.agda-stdlib-version != ''
shell: bash
run: |
echo "standard-library-${{ inputs.agda-stdlib-version }}" >> "${AGDA_DIR}/defaults"
Loading