diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index b4c3cde..7962e97 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -1,6 +1,13 @@ name: Example Usage -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: permissions: contents: read @@ -8,35 +15,35 @@ permissions: 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f6d262..8c95214 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,10 +3,11 @@ name: Test Action on: push: branches: - - main - master - 'copilot/**' pull_request: + branches: + - master workflow_dispatch: permissions: @@ -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 @@ -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 diff --git a/LICENSE b/LICENSE index 855192c..908ac1e 100644 --- a/LICENSE +++ b/LICENSE @@ -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: diff --git a/README.md b/README.md index eb23b9d..9680583 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -74,16 +80,16 @@ 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 ``` @@ -91,13 +97,14 @@ jobs: ## 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. diff --git a/action.yml b/action.yml index 6aafe91..211294b 100644 --- a/action.yml +++ b/action.yml @@ -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: '' @@ -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 @@ -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}" @@ -134,19 +135,19 @@ 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 @@ -154,14 +155,20 @@ runs: 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"