-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
317 additions
and
1 deletion.
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,8 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,93 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: ['**.md'] | ||
pull_request: | ||
branches: [main] | ||
paths-ignore: ['**.md'] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-13, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- name: Checkout [${{ github.repository }}] | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create setup script | ||
if: ${{ runner.os == 'Linux' }} | ||
env: | ||
SCRIPTS_DIR: ${{ runner.temp }}/scripts | ||
run: | | ||
pwd | ||
mkdir "$SCRIPTS_DIR" | ||
cd "$SCRIPTS_DIR" | ||
cat >init.sql <<EOF | ||
ALTER SESSION SET CONTAINER = FREEPDB1; | ||
CREATE USER test IDENTIFIED BY test QUOTA UNLIMITED ON USERS; | ||
GRANT CONNECT, RESOURCE TO test; | ||
GRANT CREATE TABLE TO test; | ||
ALTER SESSION SET CURRENT_SCHEMA = test; | ||
EOF | ||
cat init.sql | ||
- name: Setup Oracle container on Linux runner | ||
if: ${{ runner.os == 'Linux' }} | ||
uses: gvenzl/setup-oracle-free@v1 | ||
with: | ||
container-runtime: docker | ||
app-user: app_user | ||
app-user-password: app_user_password | ||
setup-scripts: ${{ runner.temp }}/scripts | ||
|
||
- name: Check Oracle container logs for errors | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
docker container ls | ||
while : ; do | ||
docker container logs oracledb | tee -a /tmp/oracledb.log | ||
if grep 'DATABASE IS READY TO USE!' /tmp/oracledb.log >/dev/null; then | ||
break | ||
fi | ||
sleep 1s | ||
done | ||
if grep 'ERROR' /tmp/oracledb.log >/dev/null; then | ||
echo "[ERR] Something went wrong!" | ||
echo "[ERR] See above logs for more details." | ||
exit 1 | ||
fi | ||
- name: Set up Oracle Instant Client | ||
id: setup | ||
uses: ./ | ||
|
||
- name: Check output parameter [install-path] | ||
run: echo '${{ steps.setup.outputs.install-path }}' | ||
|
||
- name: Check sqlplus version | ||
run: sqlplus -V | ||
|
||
- name: Run SQL queries on Linux runner | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sqlplus -s test/test@localhost:1521/FREEPDB1 <<EOF | ||
CREATE TABLE Test | ||
( | ||
ID INT | ||
); | ||
INSERT INTO Test (ID) VALUES(123); | ||
INSERT INTO Test (ID) VALUES(456); | ||
INSERT INTO Test (ID) VALUES(789); | ||
EOF | ||
sqlplus -s test/test@localhost:1521/FREEPDB1 <<< "SELECT * FROM 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 @@ | ||
.vscode |
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 |
---|---|---|
@@ -1,2 +1,56 @@ | ||
# setup-oracle-instant-client-action | ||
GitHub Action to set up Oracle Instant Client (Linux, macOS, Windows) | ||
|
||
[![CI](https://github.com/iamazeem/setup-oracle-instant-client-action/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/iamAzeem/setup-oracle-instant-client-action/actions/workflows/ci.yml) | ||
[![License](https://img.shields.io/badge/license-MIT-darkgreen.svg?style=flat-square)](https://github.com/iamAzeem/setup-oracle-instant-client-action/blob/master/LICENSE) | ||
![Release](https://img.shields.io/github/v/release/iamAzeem/setup-oracle-instant-client-action?style=flat-square) | ||
|
||
[GitHub Action](https://docs.github.com/en/actions) to set up (download and | ||
install) the [Oracle Instant | ||
Client](https://www.oracle.com/database/technologies/instant-client/downloads.html). | ||
|
||
Supports Linux, macOS, and Windows runners. | ||
|
||
## Usage | ||
|
||
### Outputs | ||
|
||
| Output | Description | | ||
| :------------: | :--------------------------------------------- | | ||
| `install-path` | Absolute install path of Oracle Instant Client | | ||
|
||
### Example | ||
|
||
```yml | ||
- name: Set up Oracle Instant Client | ||
uses: iamazeem/setup-oracle-instant-client-action@v1 | ||
``` | ||
See [CI workflow](./.github/workflows/ci.yml) for a detailed example with | ||
[gvenzl/setup-oracle-free](https://github.com/gvenzl/setup-oracle-free). | ||
## Contribute | ||
Please [create | ||
issues](https://github.com/iamazeem/setup-oracle-instant-client-action/issues/new/choose) | ||
to report bugs or propose new features and enhancements. | ||
PRs are always welcome. Please follow this workflow for submitting PRs: | ||
- [Fork](https://github.com/iamazeem/setup-oracle-instant-client-action/fork) | ||
the repo. | ||
- Check out the latest `main` branch. | ||
- Create a `feature` or `bugfix` branch from `main`. | ||
- Commit and push changes to your forked repo. | ||
- Make sure to add/update tests. See [CI](./.github/workflows/ci.yml). | ||
- Lint and fix [Bash](https://www.gnu.org/software/bash/manual/bash.html) issues | ||
with [shellcheck](https://www.shellcheck.net/) online or with | ||
[vscode-shellcheck](https://github.com/vscode-shellcheck/vscode-shellcheck) | ||
extension. | ||
- Lint and fix [README](README.md) Markdown issues with | ||
[vscode-markdownlint](https://github.com/DavidAnson/vscode-markdownlint) | ||
extension. | ||
- Submit the PR. | ||
|
||
## License | ||
|
||
[MIT](LICENSE) |
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,21 @@ | ||
name: setup-oracle-instant-client-action | ||
description: GitHub Action to set up Oracle Instant Client | ||
author: Azeem Sajid <[email protected]> | ||
|
||
branding: | ||
icon: download | ||
color: red | ||
|
||
outputs: | ||
install-path: | ||
description: Absolute install path of Oracle Instant Client | ||
value: ${{ steps.setup.outputs.install-path }} | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Setup | ||
id: setup | ||
shell: bash | ||
run: $GITHUB_ACTION_PATH/scripts/setup.bash |
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,139 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
echo "[INF] Installing Oracle Instant Client..." | ||
|
||
echo "[INF] - RUNNER_ENVIRONMENT: $RUNNER_ENVIRONMENT" | ||
echo "[INF] - RUNNER_OS: $RUNNER_OS" | ||
echo "[INF] - RUNNER_ARCH: $RUNNER_ARCH" | ||
|
||
INSTALL_PATH= | ||
|
||
if [[ $RUNNER_OS == "Linux" ]]; then | ||
URLS=() | ||
if [[ $RUNNER_ARCH == "X86" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux.zip | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux.zip | ||
) | ||
elif [[ $RUNNER_ARCH == "X64" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip | ||
) | ||
elif [[ $RUNNER_ARCH == "ARM64" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux-arm64.zip | ||
https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux-arm64.zip | ||
) | ||
else | ||
echo "[ERR] Unsupported architecture! [$RUNNER_ARCH]" | ||
exit 1 | ||
fi | ||
|
||
cd "$RUNNER_TEMP" | ||
|
||
for URL in "${URLS[@]}"; do | ||
echo "[INF] Downloading... [$URL]" | ||
wget --quiet "$URL" | ||
done | ||
|
||
for ZIP in instantclient-*.zip; do | ||
echo "[INF] Extracting... [$ZIP]" | ||
unzip -q -o "$ZIP" | ||
done | ||
|
||
rm -rf "$RUNNER_TEMP"/*.zip | ||
|
||
INSTALL_PATH="$(realpath "$RUNNER_TEMP"/instantclient_*)" | ||
|
||
echo "[INF] Running ldconfig..." | ||
echo "$INSTALL_PATH" | sudo tee /etc/ld.so.conf.d/oracle-instantclient.conf | ||
sudo ldconfig | ||
elif [[ $RUNNER_OS == "macOS" ]]; then | ||
URLS=() | ||
if [[ $RUNNER_ARCH == "X86" || $RUNNER_ARCH == "X64" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/mac/instantclient/instantclient-basic-macos.dmg | ||
https://download.oracle.com/otn_software/mac/instantclient/instantclient-sqlplus-macos.dmg | ||
) | ||
elif [[ $RUNNER_ARCH == "ARM64" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/mac/instantclient/instantclient-basic-macos-arm64.dmg | ||
https://download.oracle.com/otn_software/mac/instantclient/instantclient-sqlplus-macos-arm64.dmg | ||
) | ||
else | ||
echo "[ERR] Unsupported architecture! [$RUNNER_ARCH]" | ||
exit 1 | ||
fi | ||
|
||
cd "$RUNNER_TEMP" | ||
|
||
for URL in "${URLS[@]}"; do | ||
echo "[INF] Downloading... [$URL]" | ||
wget --quiet "$URL" | ||
done | ||
|
||
for DMG in instantclient-*.dmg; do | ||
echo "[INF] Installing... [$DMG]" | ||
cd "$RUNNER_TEMP" | ||
hdiutil mount -quiet "$DMG" | ||
cd /Volumes/instantclient-* | ||
./install_ic.sh >/dev/null | ||
hdiutil unmount -force -quiet /Volumes/instantclient-* | ||
done | ||
|
||
rm -rf "$RUNNER_TEMP"/*.dmg | ||
|
||
INSTALL_PATH="$(realpath /Users/"$USER"/Downloads/instantclient_*)" | ||
elif [[ $RUNNER_OS == "Windows" ]]; then | ||
URLS=() | ||
if [[ $RUNNER_ARCH == "X86" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/nt/instantclient/instantclient-basic-nt.zip | ||
https://download.oracle.com/otn_software/nt/instantclient/instantclient-sqlplus-nt.zip | ||
) | ||
elif [[ $RUNNER_ARCH == "X64" ]]; then | ||
URLS=( | ||
https://download.oracle.com/otn_software/nt/instantclient/instantclient-basic-windows.zip | ||
https://download.oracle.com/otn_software/nt/instantclient/instantclient-sqlplus-windows.zip | ||
) | ||
else | ||
echo "[ERR] Unsupported architecture! [$RUNNER_ARCH]" | ||
exit 1 | ||
fi | ||
|
||
echo "[INF] Installing wget..." | ||
if ! choco install wget --no-progress >/dev/null; then | ||
echo "[ERR] Failed to install wget!" | ||
exit 1 | ||
fi | ||
|
||
cd "$RUNNER_TEMP" | ||
|
||
for URL in "${URLS[@]}"; do | ||
echo "[INF] Downloading... [$URL]" | ||
wget --quiet "$URL" | ||
done | ||
|
||
for ZIP in instantclient-*.zip; do | ||
echo "[INF] Extracting... [$ZIP]" | ||
unzip -q -o "$ZIP" | ||
done | ||
|
||
rm -rf "$RUNNER_TEMP"/*.zip | ||
|
||
INSTALL_PATH="$(realpath "$RUNNER_TEMP"/instantclient_*)" | ||
else | ||
echo "[ERR] Unsupported OS! [$RUNNER_OS]" | ||
exit 1 | ||
fi | ||
|
||
echo "[INF] Setting PATH... [$INSTALL_PATH]" | ||
echo "$INSTALL_PATH" >>"$GITHUB_PATH" | ||
|
||
echo "[INF] Setting output parameter... [install-path]" | ||
echo "install-path=$INSTALL_PATH" >>"$GITHUB_OUTPUT" | ||
|
||
echo "[INF] Installed successfully!" |